Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Using E-1050 under Linux


  • Please log in to reply
14 replies to this topic

#1 fenriq

fenriq
  • Members
  • 3 posts

Posted 28 January 2008 - 01:40 AM

Hi everyone. I'm trying to read temp and humidity with E-1050 probe under Linux with C code. Browsing the examples and driver code I'm missing the SHT family of functions. I've searching this forum but found nothing similar. Has anybody tried this before? I understand as long as E-1050 is not delivering voltage measurements but logical data is not possible to read the values directly without the appropiate functions. If using this probe under C-Linux is not possible, do you know if can be user under Java-Linux implementation? I really need to use it under Linux no matter what software layer I must use. Thanks a lot in advance for your help

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 28 January 2008 - 01:24 PM

Currently there is no Linux C low-level example for the EI-1050 probe, as you pointed out. To use the probe, you're going to need the use the SHT1X low-level command. This is documented in section 5.3.20 of the U3 User's Guide. Also, refer to the EI-1050 Datasheet so you know where each wire should go.

Here is some additional information that is not documented by us or might not be clear. For the SHT1X low-level command in older U3 firmware versions, byte 9 of the command needed to be set to 0xC0(hex) to read both temperature and humidity. In current firmware versions you can just set this byte to 0, but you might want to set it to 0xC0 to be safe.

If you're using more that one temperature probe you can only have one enabled at a time when using the SHT1X command. So say you have 2 EI-1050s with the Enable (brown) wires connected to digital lines FIO7 and FIO8. If you want to read from the probe connected to FIO7, then you will need to set FIO7 to output high (enabled) and FIO8 to output low (disabled). When you want to read from the probe connected to FIO8, you will need to set FIO7 to output low and FIO8 to output high.

Here are the conversions for the temperature and humidity raw binary values in the response to Celsius and percentage (from Section 3 of Data sheet humidity sensor SHT1x/SHT7x):

Temperature (Celsius) = -39.60 + 0.01*binaryTemperature

Humidity (%) = (Temperature - 25)*(0.01 + 0.00008*binaryHumidity) + -4 + 0.0405*binaryHumidity + -.0000028*(binaryHumidity*binaryHumidity)

Last, if you really want to check the CRCs (its complicated) go to this site, http://www.sensirion...ensor_sht11.htm and look at the CRC Calculation Humidity Sensor pdf.

#3 fenriq

fenriq
  • Members
  • 3 posts

Posted 30 January 2008 - 11:30 PM

Thanks a lot for your answer. I still have one doubt. How do I read data? From the E-1050 datasheet I see that green wire is data (FI00), and white wire is clock (FI01) so I don't know how to get "binaryTemperature" and "binaryHumidity" values from just one FIO

Currently there is no Linux C low-level example for the EI-1050 probe, as you pointed out. To use the probe, you're going to need the use the SHT1X low-level command. This is documented in section 5.3.20 of the U3 User's Guide. Also, refer to the EI-1050 Datasheet so you know where each wire should go.

Here is some additional information that is not documented by us or might not be clear. For the SHT1X low-level command in older U3 firmware versions, byte 9 of the command needed to be set to 0xC0(hex) to read both temperature and humidity. In current firmware versions you can just set this byte to 0, but you might want to set it to 0xC0 to be safe.

If you're using more that one temperature probe you can only have one enabled at a time when using the SHT1X command. So say you have 2 EI-1050s with the Enable (brown) wires connected to digital lines FIO7 and FIO8. If you want to read from the probe connected to FIO7, then you will need to set FIO7 to output high (enabled) and FIO8 to output low (disabled). When you want to read from the probe connected to FIO8, you will need to set FIO7 to output low and FIO8 to output high.

Here are the conversions for the temperature and humidity raw binary values in the response to Celsius and percentage (from Section 3 of Data sheet humidity sensor SHT1x/SHT7x):

Temperature (Celsius) = -39.60 + 0.01*binaryTemperature

Humidity (%) = (Temperature - 25)*(0.01 + 0.00008*binaryHumidity) + -4 + 0.0405*binaryHumidity + -.0000028*(binaryHumidity*binaryHumidity)

Last, if you really want to check the CRCs (its complicated) go to this site, http://www.sensirion...ensor_sht11.htm and look at the CRC Calculation Humidity Sensor pdf.



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 31 January 2008 - 07:28 AM

You pass the U3 the SHT1X low-level command documented in Section 5.3.20 of the U3 User's Guide. The U3 then uses the Data and Clock lines to send/receive a bunch of information with the EI-1050, and then sends you the response specified in 5.3.20 which includes the binary temperature and humidity values. Make sure you check the errorcode in the response also. If it does not seem to work for you, post the packet you are passing and what you get back (if anything).

#5 fenriq

fenriq
  • Members
  • 3 posts

Posted 01 February 2008 - 11:31 PM

Works great now! Thanks a lot for your quick and effective support.

You pass the U3 the SHT1X low-level command documented in Section 5.3.20 of the U3 User's Guide. The U3 then uses the Data and Clock lines to send/receive a bunch of information with the EI-1050, and then sends you the response specified in 5.3.20 which includes the binary temperature and humidity values. Make sure you check the errorcode in the response also.

If it does not seem to work for you, post the packet you are passing and what you get back (if anything).



#6 kabir

kabir
  • Members
  • 7 posts

Posted 20 April 2008 - 11:34 PM

Hi,
I am working in this similar field; although the sensors are different! and I am newbie.
Could you be able t add the code of your programmed which could help me to take the next step?
Thanks in advance!
Regards-Mamun

Works great now! Thanks a lot for your quick and effective support.


You pass the U3 the SHT1X low-level command documented in Section 5.3.20 of the U3 User's Guide. The U3 then uses the Data and Clock lines to send/receive a bunch of information with the EI-1050, and then sends you the response specified in 5.3.20 which includes the binary temperature and humidity values. Make sure you check the errorcode in the response also.

If it does not seem to work for you, post the packet you are passing and what you get back (if anything).



#7 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 21 April 2008 - 10:04 AM

I am working in this similar field; although the sensors are different! and I am newbie.
Could you be able t add the code of your programmed which could help me to take the next step?


I don't understand? What sort of code example do you need? You will have to provide more information about the equipment you are using and what you want to do.

#8 DCP @ IUB

DCP @ IUB
  • Members
  • 14 posts

Posted 22 February 2010 - 03:19 PM

I am looking at this thread since I am doing the same thing, reading an EI-1050. I have the SHT1X command performing correctly and the conversions appear to be correct. However the value for humidity coming from the EI-1050 on the Labjack (U3-HV) appear to jump around in value excessively. Has anyone else had issues like this? The receive buffer is cleared prior to being read, so I don't believe there are spurious bits set. To make sure I even masked off the extraneous bits and it made no difference. For example, the binary humidity value, expressed as a decimal will read: Mon Feb 22 16:59:57 EST 2010 - Humidity: 2564 Mon Feb 22 16:59:59 EST 2010 - Humidity: 1539 Mon Feb 22 17:00:00 EST 2010 - Humidity: 3843 Mon Feb 22 17:00:01 EST 2010 - Humidity: 1027 Mon Feb 22 17:00:03 EST 2010 - Humidity: 772 Mon Feb 22 17:00:04 EST 2010 - Humidity: 1284 Mon Feb 22 17:00:05 EST 2010 - Humidity: 2820 Mon Feb 22 17:00:07 EST 2010 - Humidity: 1796 Mon Feb 22 17:00:08 EST 2010 - Humidity: 771 Mon Feb 22 17:00:09 EST 2010 - Humidity: 3075 Mon Feb 22 17:00:11 EST 2010 - Humidity: 771 Mon Feb 22 17:00:12 EST 2010 - Humidity: 1796 Mon Feb 22 17:00:13 EST 2010 - Humidity: 3843 Mon Feb 22 17:00:15 EST 2010 - Humidity: 2563 Mon Feb 22 17:00:16 EST 2010 - Humidity: 3331 Mon Feb 22 17:00:17 EST 2010 - Humidity: 1027 Mon Feb 22 17:00:19 EST 2010 - Humidity: 2819 Mon Feb 22 17:00:20 EST 2010 - Humidity: 3331 Mon Feb 22 17:00:21 EST 2010 - Humidity: 1027 Mon Feb 22 17:00:23 EST 2010 - Humidity: 3075 Mon Feb 22 17:00:24 EST 2010 - Humidity: 259 Mon Feb 22 17:00:25 EST 2010 - Humidity: 259 Mon Feb 22 17:00:27 EST 2010 - Humidity: 2307 Mon Feb 22 17:00:28 EST 2010 - Humidity: 1795 Mon Feb 22 17:00:29 EST 2010 - Humidity: 259 Mon Feb 22 17:00:31 EST 2010 - Humidity: 259 Mon Feb 22 17:00:32 EST 2010 - Humidity: 3331 Mon Feb 22 17:00:33 EST 2010 - Humidity: 1795 Mon Feb 22 17:00:35 EST 2010 - Humidity: 1028 Mon Feb 22 17:00:36 EST 2010 - Humidity: 772 Is that normal? Doesn't seem so to me. So, when converted we'll get values from 6% to 105% .. something seems not right. I'm going to try another temp sensor but I wondered if anyone else had this problem. Derek

#9 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 23 February 2010 - 09:42 AM

If we convert your data to Hex we can see that there are some binary issues: A04 603 F03 403 304 504 B04 704 303 C03 303 704 F03 A03 D03 403 B03 D03 403 C03 103 103 903 703 103 103 D03 703 404 304 Two things are appearent. First the least significant digit is varying between two values, this is what we would expect of the most significant digit. Second the center digit is always zero, also fishy. So, the 4-bits of data that you trunkated off was actually the middle digit and your byte significance needs to be swapped. This confusion comes from the LabJack commands being little-endian while the SHT function just spits back what it reads from the sensor which is big-endian.

#10 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 23 February 2010 - 01:21 PM

Here is an excerpt from LabJackPython's SHT1x code:

# result is a list with the response bytes from the LabJack
val = (result[11]*256) + result[10]
temp = -39.60 + 0.01*val
		
val = (result[14]*256) + result[13]
humid = -4 + 0.0405*val + -.0000028*(val*val)
humid = (temp - 25)*(0.01 + 0.00008*val) + humid

Hopefully this will save you some headache trying to figure out how to convert the readings.

#11 DCP @ IUB

DCP @ IUB
  • Members
  • 14 posts

Posted 24 February 2010 - 08:10 AM

No, I didn't have any problems converting the readings once I had done the byteswap on the humidity value. Since I didn't need to do anything with the temperature value, I didn't think endianness was the issue at first. I did however modify the conversion factor since the probe is driven by something like 3.28V and not 3.0V, which the conversion charts in the datasheet specify. So I have this: tempC = -39.65 + (0.01 * binary_temperature); tempF = -39.40 + (0.018 * binary_temperature); humidity_linear = -4.0 + 0.0405 * binary_humidity + -0.0000028 * (binary_humidity * binary_humidity); humidity = (tempC - 25.0) * (0.01 + 0.00008 * binary_humidity) + humidity_linear;

#12 TommyButtchin

TommyButtchin
  • Members
  • 2 posts

Posted 14 January 2014 - 09:44 AM

Hi,  I am using this sensor on a linux system with the python wrapper u3.py  The sensor was working yesterday on FIO4 (data) and FIO5 (clock) which are the default pins in the u3.py wrapper.  Today, I unplugged the unplugged the U3 and when I plugged it back in, the sensor stopped working.  The error I'm getting is...

%%%%%%%%%%%%%%%%%%%%%%%%%%%%

raise LowlevelErrorException(results[6], "\nThe %s returned an error:\n    %s" % (self.deviceName , lowlevelErrorToString(results[6])) )
LabJackPython.LowlevelErrorException:
The U3-LV returned an error:
    SHT1x_COMM_TIME_OUT (40)
LabJack never received the ACK it was expecting from the SHT. This is usually due to incorrect wiring. Double check that all wires are securely connected to the correct pins.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I've double, triple and quadruple checked the connections.  I was getting this error yesterday when trying to run the EI-1050 on FIO0(data) and FIO1(clock).  Do I need to run u3.configIO() before calling u3.sht1x()?  Thanks in advance.



#13 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 14 January 2014 - 11:09 AM

The FIO lines you are going to use need to be configured as digital. To be safe you should call configIO before your first sht1x call to ensure this. Also, make sure you change your sht1x call to use FIO0 as the data pin and FIO1 as the clock pin. For example:

 

u3Dev.configIO(FIOAnalog = 0) #configure FIO0-7 as digital lines

 

u3Dev.sht1x(DataPinNum = 0, ClockPinNum = 1)



#14 TommyButtchin

TommyButtchin
  • Members
  • 2 posts

Posted 21 January 2014 - 05:17 PM

Thanks for the response.  Tried all of that and it still didn't work.  I figured out that after plugging in the EI1050 it works if I set the PWR pin to low, then turn it to high, the probe works.  For example:

 

PWR = FIO2 (for my case)

u3Dev.setFIOState(PWR, state = 0)

time.sleep(0.5)

u3Dev.setFIOSTate(PWR, state = 1)

 

Basically turning on an off the probe before calling sh1tx.  No idea why this needs to be done on my system but it works like a charm! 



#15 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 21 January 2014 - 05:42 PM

The sht1x call only configures the data and clock lines connections on the U3, SHT options and returns the readings. Beforehand, the power and enable lines need to be powered by 3.3 volts before you can get readings. An easy way to get 3.3 V for these lines is by setting a digital I/O to output-high or DAC0/1 to 3.3 V on your U3.

 

For details on the EI-1050 hardware and connections, take a look at its data sheet (Note the pseudocode provided uses UD driver calls and not LabJackPython calls):

 

http://labjack.com/s...-1050/datasheet




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users