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

Sensirion SHT21 and I2C


  • Please log in to reply
2 replies to this topic

#1 user1979

user1979
  • Members
  • 62 posts

Posted 25 March 2013 - 07:29 AM

Hello, I am trying to comunicate with a SHT21 Sensirion Temperature/Humidity sensor using I2C protocole, a U6 Module and Labview. There are 2 communicating modes (Hold Master Mode/ Nohold Master Mode) and I have chosen the first one just because it seems slighlty simpler. According to what I see on my oscilloscope the Start 128 ACK 229ACK part seems ok. My problem is that I don't know how to follow this sequence by a Start 129 and making the measure. The print screen has been obtained with Condition loop set to False (empty case). Do you know what I should use and put in the case structure in order to send the Start 129 and measure? Thanks a lot, Best regards, User

Attached Thumbnails

  • Forum.PNG
  • Forum2.PNG
  • Forum3.PNG


#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 27 March 2013 - 02:25 AM

When using the hold mode the LabJack will think that a timeout has occurred. I recommend using the no hold mode. The LabJack will automatically set bit 0 to zero when writing and one when reading. No-Hold Mode: Send I2C_Address (128) and the desired command, in this case "Start RH" (229) and that's it; set the address and write one byte. The conversion should now be running. Wait the required time interval (Table 7) plus a few ms for good measure, then read the result by initiating a new I2C operation with zero write bytes and two read bytes, three read bytes if you want the checksum. Hold Mode: I think we can get hold to work, but it is a bit more involved. We need to enable clock stretching on the U6 and ensure that the maximum clock stretch time is greater than the SHT21's conversion time. Clock stretch is off by default. Set bit 3 (value = 8) in options to turn it on. The clock stretch timeout is ~333 times the clock period. So if you are running at 120kHz the max stretch time is 2.7ms. In order to read the 12-bit RH measurement we need 29 ms. 333/0.029 = 11482 Hz. To be on the safe side you would want to be below that, so ~10kHz. If everything is set properly all you need to do is write one byte (229) and read 2 (3 for checksum). I recommend using the No-Hold reading method. It is easier to work with and your program won't have to suffer long blocking calls to the LabJack. Also, the LabJack provides an SHT interface function for parts using the sensibus. Like the SHT11.

#3 user1979

user1979
  • Members
  • 62 posts

Posted 03 April 2013 - 05:37 AM

Hi, You were correct, the No hold-Mode method is easier, and works fine now. Thanks a lot for your help, Regards, User PS : send 243 or 245 (and not 229)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users