EI-1050, U6, and Python: Not returning correct Temperature and Humidity Values | LabJack
 

EI-1050, U6, and Python: Not returning correct Temperature and Humidity Values

2 posts / 0 new
Last post
B.
Falcon7's picture
EI-1050, U6, and Python: Not returning correct Temperature and Humidity Values

I'm currently working with the LabJack U6 and EI-1050 temp/humidity probe.

I started by using the EI-1050 Utility for Windows to verify that the sensor was a) Wired correctly to the U6 and b) Giving realistic readings. This gave me the results I was expecting: ~21.36 deg C and 47.4% humidity.

When I run the following code in Python, it returns a temperature of -39.6 C and -4.646 Humidity:

import u6

d = u6.U6()

d.getCalibrationData()

d.sht1x()

print(d.sht1x())

What can be done to make this return the correct values?

 

 

 

LabJack Support
labjack support's picture
First refer to the sht1x

First refer to the sht1x documentation, and note it takes three parameter (you are using the default settings):

https://github.com/labjack/LabJackPython/blob/master/src/u3.py#L1555

Also, the EI-1050 is a good source of information on connections:

https://labjack.com/support/datasheets/accessories/ei-1050

Configure based on your connections, and if you want to read humidity and/or temperature. Also, make sure to configure your power/enable lines, which is not part of the sht1x method. For example, with the data line connected to FIO0, clock connected to FIO1, and power and enable lines connected to FIO2:

import u6

# Open the first found U6
myU6 = u6.U6()

myU6.getCalibrationData()

# Set FIO2 to output-high (3.3 V) to turn on the enable and power line
myU6.getFeedback(u6.BitDirWrite(2, 1), u6.BitStateWrite(2, 1))

# Perform the reading and display results.
# Data pin is FIO0 and clock pin is FIO1.
# SHTOptions set are:
# bit 7 = 1 (Read Relative Humidity)
# bit 6 = 1 (Read Temperature)
# bit 2 = 0 (Heater off)
# bit 0 = 0 (Resolution: 12-bit RH, 14-bit Temp)
print(myU6.sht1x(DataPinNum=0, ClockPinNum=1, SHTOptions=0xc0))

# Set FIO2 to output-low (~0 V) to turn off the enable and power line.
myU6.getFeedback(u6.BitStateWrite(2, 0))

# Close the U6
myU6.close()