Porting indoor weather (BMP085) logging project to SFE Phant
For a while now, have had a time/temp logging system in my house. It is still hosted on my very first Raspberry Pi, and uses a BMP085 temperature/pressure sensor, and two 1.2” LED displays from Adafruit. The logging on
Pachube -> COSM -> Xively needed to be updated to something else, so I decided to use Phant from Sparkun Electronics (SFE).
- 2 of Adafruit 1.2” 4-Digit 7-Segment Display w/I2C Backpack
- BMP085 sensor breakout board
- Raspberry Pi Model B (1st gen.) plus PSU and Ethernet networking, running Raspbian
- I2C Level converter
- Solderless Breadboard, wires, and Pi Cobbler Breakout + Cable for Raspberry Pi
There are two LED displays: one for the time, and one for the temperature. The displays are programmed through I2C, and the BMP085 sensor is also located on the shared I2C bus.
The green square hollow prism with a pattern of holes in its top center is the BMP085 sensor, in a 3D-printed case. And the LED displays are residing in a bespoke case that was designed and printed by me – one of my earliest forays into 3D Printing.
The “old” version (circa Spring 2013) that uploaded to xively.com used old Adafruit python libraries and a EEML XML-based data format.
The time python code was a straight port. Method names changed slightly, and the LED API had been updated to be more user friendly. It was a quick port, as I was able to leverage the example code script.
BMP085 and Data logging
The temp port was a little more involved. The BMP sensor python API was basically unchanged, but the logging code needed to be moved to a different scheme. The Phant service (at https://data.sparkfun.com) is simple to use. You can generate a new data stream without a login. And logging to/querying from the service uses simple HTTP requests.
A new stream was created using the web form. After storing the keys along with downloading a JSON file that contained the key settings, the code was updated.
The beauty of open-source python libraries is that you can see the implementation and even fix any bugs you find in the source itself! I found an issue related to reading in the Phant stream settings from aforementioned JSON file, and was able to update the library source code to workaround it.
Pointers to customized source code
- Found some issues w.r.t. loading from JSON config file, so generated a PR