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
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!

