From Hackerspace Amersfoort
Jump to: navigation, search

Project Weatherstation
Name Weatherstation
Start 2011/09/01
Contact r3boot
Information An arduino powered weatherstation
Status Finished

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.

System Diagram


Source Code

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.


For now, there are some rudimentary graphs available on 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:


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


# tmux

followed by:

# 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:


I've also noticed the following pattern:


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[13171]: logging initialized
2012-08-31 13:33:02 - weatherd[13171]: resetting weatherstation main unit