Introduce OpenPythonSensor Library

Introduce the Python driven, I2C focused, Embedded Linux application level library for digital sensors – OpenPythonLibrary.

The very first version includes supports for:

  • BMP180 Barometric Pressure sensor;
  • HTU21D Relative Humidity sensor (Only support Beaglebone Black at this moment);
  • SI1145 Proximity/UV/Ambient Light sensor;
  • TMP007 Infrared Thermopile sensor;
  • HMC6352 Digital Compass;
  • MPU6050 Six-Axis (Gyro + Accelerometer) MEMS;

The I2C bus is set to 1 in OpenPythonSensor / ops_base / ops_i2cbase.py and can be modified to support more development platforms. The python-smbus is a prerequisite of this library.

The library can be found at Github under MIT License.

Example usage of the library
#!/usr/bin/python
from lib_htu21d import HTU21D
 
# Initialize the library
htu = HTU21D()
 
temp = htu.readTemperatureData()
rh = htu.readHumidityData()
 
print "Temperature: %.2f C, Humidity: %.2f %%" % (temp, rh)
Clone the code
git clone https://github.com/randymxj/OpenPythonSensor.git
Download the library

Click -> GitHub_Logo to download

Part of the library is ported from Adafruit-Raspberry-Pi-Python-Code and should remain it’s original license. Some driver is referenced from both Adafruit and Sparkfun and thanks to their original work.

More sensor support will coming soon!

 

python powered Boris_Tux_PNG

How about build a weather station with Beaglebone Black and Node.JS?

I’m able to get some sensor data with Beaglebone Black by the help of Adafruit-Raspberry-Pi-Python-Code on my HMC6352 and HTU21D driver, but what’s next?

Sep 2014: Merging the application with the new OpenPythonSensor driver library, and deploy all the software (MongoDB, Sensor data gather and save with Python, Backend/Frontend application with Node.JS) on a single Beaglebone Black board.

 

By pushing the sensor data (Temperature, Humidity, Pressure, UVIndex) into a database, an internet front-end application is able to pull and display the data to the users.

Screenshot with plot

 

Embedded solution: A Beaglebone Black (Ubuntu) with HTU21D (Temperature / Humidity), BMP180(Temperature / Pressure) and SI1145 (Proximity/UV/Ambient Light) sensor. A Python script driven software measures the environment data and push data set to database (MongoDB).

Internet based front-end / back-end solution: Node.JS with Express and Mongoose. Back-end Node.JS code to query the database and send to front-end Angular JS function by AJAX. Supported by jQuery, Bootstrap and Chart.JS.

Screenshot with data

 

Demo is available at here. Code is shared under MIT License and can be accessed here on Github.