Today has been a day filled with tinkering. I'd like to do some data logging with the arduino and Raspberry Pi. Ultimately, I'd like to have multiple arduinos communicating (via RF) throughout the house taking temperature readings and sending the information back to the raspberry pi to log and graph. Basically, there are a lot of little components to that project that I need to figure out and then mesh them all together for the final project.

So today I spent a big chunk of the day playing around in python. I've been interested in it ever since the Kindle Weather Display project. It has a pretty easy to read syntax and seems like it would be great for manipulating data from the arduino and graphing.

The first step is getting communication working.

I hooked up a temperature sensor, installed PySerial, a module for serial communication in python, and plugged in the arduino. For the arduino, I used the sketch in the Ladyada program for DHT11.

The program in python was more simple than I thought. Here's all I did:


import serial

arduino = 'COM7'
ser = serial.Serial('COM7', 9600)

for x in range (0,3):
    print ser.readline()
    (x)



And as you can see everything worked out pretty easily. The program will print 3 lines from the arduino and then stop.

In case you're wondering, that shield on the arduino is the OpenSourceRF wireless shield. It wasn't actually doing anything, but I was too lazy to pull it off.

0 comments:

Post a Comment