No temperature conversion?

Hello,

I am a veteran firmware engineer, but a total newbie in this IoT world and pretty much a newbie to Python coding.

 

I have a Onion Omega2+ plugged into a CE PR32-3, thence into a MCP23008 / PEIO4R4G5LE.

Using a simply Python script, I was controlling the relays quickly.  So far, so good.

 

Then I plugged in the SI7020-A20.  The power LED lights up, but I have not been able to get a valid humidity or temperature reading out of it.

Sample code that I have found is for other control units other than the Onion, so the function calls are a bit different, but here is what I tried:

 

-----------------------------------------------------------------------------------------------

#!/usr/bin/env python
from OmegaExpansion import onionI2C
import time

i2c = onionI2C.OnionI2C()

i2c.write(0x40, [0xF5])
time.sleep(0.5)

# this device has no addressable registers, so this readBytes() call is suspect, but there is no i2c.read()

data = i2c.readBytes(0x40, 0x00, 2)  
print "%x" %data[0]
print "%x" %data[1]

-----------------------------------------------------------------------------------------------

I get:

0

3f 

Conversion gives RH of -5.88%.  I've never heard of negative humidity!

I'm sure it's something really silly, but I have fiddled around a lot with the write(), writeBytes(), and readBytes() calls and not gotten anywhere.

 

 

 

B

i use this code with SI7005, they belong to same series. so give it a try and see if it works, 

https://github.com/bhaskar-anil429/Onion-Omega-SI7005/blob/master/SI7005.py

this is a python script for SI7020

https://github.com/ControlEverythingCommunity/SI7020-A20/blob/master/python/SI7020_A20.py

 

A

Thank you for your suggestions.  However, the command sequences for the SI7005 are quite different than for the SI7020.

I started with the Control Everything python script, but it is for a different environment (not sure which board) and I have had no luck adapting it to the Onion Omega2+.