Mar 20, 2013

XBee Time & Temperature Monitor

After a remodel, I wanted to add one of the T2 (time and temp) monitors I've designed to the kitchen that would fit in with the new decor. There's a lot of white and gray, so decided to go with a laser cut white acrylic face plate.

The T2 is powered by arduino as a base station, collecting information and transmitting it to the T2 via XBee radio. A 1Wire DS18S20 temp sensor on my deck is attached to the arduino by repurposed CAT-5 cable run under my crawlspace. The arduino also collects time info from an EM-406A SIRF III GPS unit. All XBee units, receivers or transmitter, are on the same PAN ID channel, so the same information shows up on all. The XBee outputs serial via its TX to a Sparkfun serial LED locally on each receiver, making it easy to create a new monitor station for another location in the house.

Mar 6, 2013

OpenWRT: Start a python script at boot time

The following script will start a python weather parsing script at boot time (that script not included here). Place the script in

/etc/init.d/weather

 

#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org

START=99
start() {
        sleep 5   # make sure boot process is done, no more console msgs
        echo "Weather VFD App Started"
        . /etc/profile
        echo $PATH
        python /opt/scripts/wunderground_parse.py &
}

START=99 will create an entry in rc.d named S99weather when the script is enabled.

chmod +x /etc/init.d/weather

/etc/init.d/weather enable  #places entry S99weather in /etc/rc.d/

 

The profile command is [dot] [SPACE]/etc/profile. This will invoke the environment variables which otherwise wouldn't be included at boot time. Those variables will include the

LD_LIBRARY_PATH

and other env variables.

This can also be started with /etc/init.d/weather start. You can stop the init script from starting up with 

/etc/init.d/weather disable

You could optionally add other commands to this startup script.

See the entry at the OpenWRT wiki.