OpenSource RF wireless arduino shields for awhile with the intent of logging temperature differences throughout the house. Admittedly, I've been dragging my feet getting things set up. With cooler weather, however, I've been motivated time to poke around and get things set up.
Adafruit DHT11 library and source code to log the temperature. The whole DHT11 tutorial, including a wiring diagram, can be found here. The basic setup is pretty easy.
Note: You cannot upload a sketch to the arduino if the serial switch is on the RF wireless shield is ON
Once I got the shields communicating with one another, I install pySerial. It's a module that allows python to read from the serial port, which is what the arduino is sending data through.
At first I had some issues with data being clipped while reading from the two arduinos. Originally the arduinos were just blasting the data and I had the python script set up to catch it. That didn't work 100% every time so I had to come up with another solution.
So once an arduino receives it's specific message, it repsonds with the humidity and temperature. The python script then logs the data in a CSV file.
Once I felt comfortable with how the python script was working, I placed two arduinos around the house.
Raspberry Pi. It took a moment to figure out the tty assignment in Linux. Here's what I did.
Determining tty assignment for RF USB dongle in Linux:
- go to dev folder (type cd /dev at the command line)
- type ls and read the list. There should be a ttyUSB0
- If you're unsure you can always unplug the device and run ls again in the /dev folder
Since I want the data to log automatically at certain intervals, decided to use cron. I did had some issues getting a python script to execute properly from a cron job on the Raspberry Pi, so instead I created a shell script to execute the python script. I'm not entirely sure why python partially executes in cron, but for now this work around is solves the problem.
Overall the system has been working pretty good for the last week. The next step is to set up automatic data graphing. I've had some minor success, but I'm not 100% sure how I want to proceed quite yet.
If you're interested, I've tossed everything up on github.