|Information||An arduino powered weatherstation|
Using an arduino together with a couple of sensors, I've created a weatherstation. This page contains (or should contain) all required info to use and maintain this system.
This weatherstation is based on an arduino pro mini, which has seven different (mostly analog) sensors connected to it. The arduino talks to a soekris over a RS-232 line, which has been modified on the soekris side to provide +5v over a spare wire to provide the arduino with power. I've inserted an PNP transistor inline with this +5v line which is coupled to a GPIO pin on the soekris, providing remote reset functionality. The soekris runs a C application to read the data from the secondary serial port, aggregate it and distribute the aggregated values to both a file-based datalogger and graphite.
The source for this system consists of two parts. One part that is running on the arduino, and one part that is running on a soekris.
- weatherstation (to be run on the arduino) https://github.com/r3boot/weatherstation
- weatherd (to be run on the soekris) https://github.com/r3boot/weatherd
For now, there are some rudimentary graphs available on stats.bitlair.nl. This is subject to refinement and recalibration in the future. Also, the namespaces for these graphs may change. To see these graphs, follow the link below:
- graphite based: https://stats.bitlair.nl/dashboard/weatherstation
- graphene based: http://weather.as65342.net/realtime.html
Segmentation fault (core dumped)
The server-side code hasn't been finished yet, and sometimes segfaults. To fix this, I'm running weatherd in a while true loop until I've fixed the code. Furthermore, since weatherd doesn't startup automatically, it needs to be restarted after each reboot or poweroutage. Both zarya and myself have root rights on this box, and can run the following commands (as root) to startup weatherd:
# tmux attach
# cd ~r3boot/weatherd # ./weatherd -v -g stats:2003:weatherstation
Furthermore, I'd like people to save the coredump for future analysis. For this, please run the following command:
# cd ~r3boot/weatherd # cp weatherd.core weatherd.core.`date +%d%m%Y%S`
Hanging main unit
I've also seen that the main unit might crash every now and then. Symptoms are either no values, or a continuous identical value. To verify, stop weatherd (see the above explanation), and check the serial port to see if there is any difference and/or variation in the pattern of values. To do this, run the commands below. Please note that I've added a check in weatherd that will reset the main unit after we've received the same checksum 5 times.
# cu -s 57600 -l /dev/tty01
Normal output looks something like this:
#42,16.10,27684.00,80.43,1087.53,1.99,7,0.00,28919$ #42,16.10,27681.00,80.75,1112.81,1.33,7,0.00,28940$ #42,16.10,27682.00,79.94,1063.33,1.99,7,0.00,28892$ #42,16.10,27684.00,81.40,1063.33,1.33,7,0.00,28895$ #42,16.10,27688.00,80.59,1063.33,1.99,6,0.00,28898$ #42,16.10,27683.00,80.27,1063.33,1.99,6,0.00,28892$ #42,16.10,27689.00,80.11,1166.89,1.99,6,0.00,29002$ #42,16.10,27678.00,79.94,1112.81,1.33,6,0.00,28936$ #42,16.10,27683.00,80.59,1087.53,1.99,6,0.00,28917$ #42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$ </tt>
I've also noticed the following pattern:<tt>
#42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$ #42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$ #42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$ #42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$ #42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$ #42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$ #42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$ #42,16.10,27675.00,78.33,1112.81,1.33,5,0.00,28930$
In the last case, the arduino doesn't update it's values anymore. To fix this, reset the main unit, as follows:
# ./weatherd -r 2012-08-31 13:33:02 - weatherd: logging initialized 2012-08-31 13:33:02 - weatherd: resetting weatherstation main unit