Community
cancel
Showing results for 
Search instead for 
Did you mean: 
CNels10
Beginner
962 Views

Working demo of Edison I2C in Python

Hi all,

I'm working on a project to monitor fridge/freezer temperatures, after a couple events of having the doors left open and throwing out a bunch of food. I needed a good excuse for a project. I'll have the final project send me emails/texts when any sensor is out of range. I'll have three or four HTU21D sensors on one I2C bus, and since they are all address 0x40 I'll have to work out bus segmentation control using GPIOs next.

I'm finding few relevant demo implementations for MRAA on Edison in Python, and working on the Mini Breakout Board. I offer this demo implementation:

https://github.com/cjnaz/HTU21D-I2C-demo-Edison-Python-MRAA cjnaz/HTU21D-I2C-demo-Edison-Python-MRAA · GitHub

For starters, I've put one sensor on each of the two I2C ports. The demo code implements an HTU21U library which directly uses MRAA I2C functions, with no other dependencies.

Demo output:

root@Edison1:~# python HTU21D_demo_main.py

User Reg1: 0xc3L

User Reg6: 0x42L

Change HTU1 resolution and SoftReset HTU6

User Reg1: 0xc3L

User Reg6: 0x2L

Temperature1: 25.14 C, RH1: 36.00 %

Temperature6: 24.88 C, RH6: 36.00 %

Temperature1: 25.12 C, RH1: 36.00 %

Temperature6: 24.87 C, RH6: 36.00 %

Temperature1: 25.13 C, RH1: 36.00 %

Temperature6: 24.86 C, RH6: 36.00 %

Tags (1)
1 Reply
FBlai
Valued Contributor I
67 Views

Thanks for sharing

Reply