Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9881 Discussions

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

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 %

1 Reply
Valued Contributor I

Thanks for sharing