The TMP102 is an I2C sensor available on a breakout board from Sparkfun TMP102. It's pretty cheap, under $10. It will actually allow you to have multiple sensors on the same I2C bus just by jumpering an address pin.
I'm working on creating a software module to decode the output from the sensor. So far it isn't straight forward, at least for an amateur. If I understand correctly, the sensor reports the readings in a backwards fashion. I'm not sure I've decoded the output correctly, but I'm close. Once I get that ironed out, I'll post the code up.
I started playing with I2C bus lengths. I heard that the practical length was less than a meter. I've got around a 2-3 meter CAT-5 cable set up running the TMP102. It's dangling outside the window, inside a tupperware container, and appears to be working just fine. I'm using Sparkfun RJ-45 Jacks and breakout boards. It adds a couple of bucks to the cost of the project, but it makes for great modularity. It's also going to let me do some cable run tests. Eventually I'll post those up as well.
I modified the jacks and breakout boards slightly. In place of a simple header, I used Arduino 8-pin stackable headers. That way, I can easily add a second sensor (or more) at the cable end, while still being able to easily breadboard it. So far it's working great.
The goal with this setup is to have two sets of environmental sensors. One on the Raspberry Pi itself, and the other just slightly remote from the Raspberry Pi. This sensor set could be outside a window, inside a terrarium/fish tank, inside a science project (fermenter? soil analyzer? hot water heater?), all kinds of possibilities.
If I can make the software scale-able, anyone could add all kinds of sensors to the system and have it easily recordable. The only drawback would be writing new sensor drivers for each set of sensors. That's where I'm having a fair amount of difficulty now.
It looks like I was wrong when I figured out the size of the data files. Right now, the datafiles appear to be much smaller, despite my cramming more information into them (Temp1, Temp2, Pressure, Motion Sensor, Time, Log Level). I think I want to change the logging system even further so that it creates a better record of values. Right now I'm saving a string for each sensor cycle with just the sensor values. The software is written so that it assumes a certain value is in a certain order in the string. That's great, as long as no one else is adding sensors to the system, and you only look a certain way.
I'm wondering if I can create a log with each sensor cycle recording a dictionary. Then I could easily write code to examine which sensors were polled for each sensor cycle. I could easily pull all the sensor values, or some of the sensor values. I could have some sensors polled more often than others.
I need to grab a second Raspberry Pi, and start thinking about how to pull all the sensors nodes together, into one easy to read display.
As I'm moving closer and closer to medical school, I seem to be doing less and less medicine. From helping build a local bar as a volunteer (a worthy cause, in my book), to hack-building cool gadgets. I'm picking up bizarre skill sets left and right. This is adding to the already diverse skill sets I had acquired on my previous jobs. I'll detail my rants, raves and experiences here.
Sunday, December 16, 2012
Saturday, December 15, 2012
A quiet thought over here in my corner of the internet
As healers we find ourselves plunged in the misery and sorrow of others. We take great pride and pleasure in our work. Not from the misery and sorrow, but from the alleviation of infirmity. Not just in body, but most of all in spirit. It is there that our own pain can find relief.
Monday, December 3, 2012
GPIO Pins on the Adafruit Pi Cobbler
I posted the code for the program I used over in the Adafruit Forums: Raspberry Pi Home Datalogger (new window)
I'm cleaning the project up a little bit. I'm trying to make the code "nicer" and easier to follow (I should comment my code.... one of these days). I switched the code that runs the programs over time to a system that checks the time every second, executing specified code at the top of the minute (Poll the temperature and pressure sensors), and at the top of the hour. It works, but my system utilization never drops below 60%, and is frequently at 97%. I may have to go back to having the system "sleep" in between sensor checks. I think that's a bad way to do it, but I'd like to look at having these little nodes be battery and/or solar powered.
I messed around with the RPIO program I was screwing around with. I wanted to see which RPIO reported pins correlated with which pins labeled on the Cobbler T-Plate.
The chart is repeated over on the Adafruit forums, in the comments section of the code.
Cobbler RPIO
#4------ 7
#17----- 11
#18 -----12
#21 -----V1 13
#22 -----15
#23 -----16
#24 -----18
#25 -----22
#27 -----V2 13
I'm cleaning the project up a little bit. I'm trying to make the code "nicer" and easier to follow (I should comment my code.... one of these days). I switched the code that runs the programs over time to a system that checks the time every second, executing specified code at the top of the minute (Poll the temperature and pressure sensors), and at the top of the hour. It works, but my system utilization never drops below 60%, and is frequently at 97%. I may have to go back to having the system "sleep" in between sensor checks. I think that's a bad way to do it, but I'd like to look at having these little nodes be battery and/or solar powered.
I messed around with the RPIO program I was screwing around with. I wanted to see which RPIO reported pins correlated with which pins labeled on the Cobbler T-Plate.
The chart is repeated over on the Adafruit forums, in the comments section of the code.
Cobbler RPIO
#4------ 7
#17----- 11
#18 -----12
#21 -----V1 13
#22 -----15
#23 -----16
#24 -----18
#25 -----22
#27 -----V2 13
Labels:
Adafruit,
Equipment,
GPIO,
Hacks,
Linux,
logger,
logging,
node,
project,
Python,
Raspberry Pi,
Security,
sensors,
tech,
Technology
Subscribe to:
Posts (Atom)