1 Reply Latest reply on Oct 11, 2015 7:39 PM by Frederick Blais

    Working demo of Edison I2C in Python

    cjnaz

      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.

       

      IMG_20151006_071729.jpg

       

      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 %