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

Trying to communicate with HYT-271 Sensor using I2C and U6 module


  • Please log in to reply
12 replies to this topic

#1 user1979

user1979
  • Members
  • 62 posts

Posted 29 October 2012 - 06:07 AM

Hi,

I am trying to communicate with a Temp/Humidity sensor using I2C with a U6 module and Labview. I have tried working around the U3 I2C EEPROM example setting the pins connections to 2 and 3, the adress to 40 and the delay to 60ms. I have left all the other parameters by default. There must be some other things to change but I don't know what.

I haven't found any ohter help than this post where code from another langage is working :

http://www.myamicus....y-sensor-HYT271

I have tried both with and without a 4.7Kohms resistance between Vs and FIO2 and between Vs and FIO3

Would you know what parameters need to be changed in my program?

Any help would be great,

Thanks.

User1979

Attached Thumbnails

  • Forum.PNG

Attached Files



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 29 October 2012 - 08:15 AM

The best way to start with I2C is to look at the datasheet for your chip and find one simple register where you can read a known value. Some register that you know has a specific value at power-up, and so you can then do a simple read of that one register. Then if that does not work you have a simpler spot to start troubleshooting.

#3 user1979

user1979
  • Members
  • 62 posts

Posted 05 November 2012 - 07:48 AM

To understand more about how to use I2C with a Labjack U6 module I have connected a Sensirion SHT15 Temperature/Humidity sensor to the U6 module (power connected to DAC0 set to 3.3V) and used the "U3 Single EI-1050 Example" (U3 Single EI-1050 Example.png), and everything is working fine.

Since the connection were ok, I then tried to make up a program using your application note http://labjack.com/s...t/app-notes/i2c without changing anything to the U6-Sensor connexion, but I can't make it work. I must be doing something wrong, or several things.

According to the data sheet, the device adress is 1000000, so I have set the parameter adress to 128 (=10000000) as explained in the app.note
The temperature measurement command is 11100011 so I have set the value 227 in the Wright Array.

Would you know what is missing or wrong?

Thanks a lot.

User1979


PS :although the U3 Single EI-1050 Example works fine, my final purpose is to understand how to use the basic functions that are in the application notre so that I can communicate withother sensors using I2C)

Attached Thumbnails

  • U3_Single_EI_1050_Example.PNG
  • Example_not_working.PNG

Attached Files



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 05 November 2012 - 09:40 AM

The Sensirion SHTx sensors use a custom protocol. Similar to, but not exactly the same as I2C. I suggest that instead you use a 24C01C EEPROM to learn about I2C, as that is used in the LabVIEW example "U3 I2C EEPROM.vi". You can buy a cheap 24C01C and hook it up yourself, or buy an LJTick-DAC from us as it has that EEPROM on it.

We also have app notes for the HMC6352 and MLX90614, but they use Python/C not LabVIEW.

#5 user1979

user1979
  • Members
  • 62 posts

Posted 07 November 2012 - 02:52 AM

I have followed your advice and ordered a 24C01C EEPROM to get familiar with I2C communication.

In the meantime, would you mind confirming theses 2 points? :

1) The data sheet says to send a MR( Measurement Request) command to tell the sensor to make a measurement, and then to send a DF (Data Fetch) command in order to get the value of the measurement.

Is the "U3 I2C EEPROM" example structure sufficient, that is to say only use a Write function (which would be for the MR) and a Read function (which would be for tje DF) or should the structure be :
Write function (which would be for the MR), Write function (which would be for the DF), and a Read function (to read the value) ?

2) The default adress of the sensor is 0X28
I am planning
=>to set the "LJ_chI2C_ADDRESS" to the decimal value 40 [28 (hex) = 101000 (bin) = 40 (dec)]
=>to set the first value of the "U8 array write" of the "LJUD_ eGetS" to the decimal value 80 [which is 1010000 (bin)]; The rest of the array is empty
=>Depending on your answer in 1) :
either setting the first value of the "write array" of the combined Write&Read part of the "U3 I2C EEPROM" example, to the decimal value 81 [which is 1010001 (bin)]. Rest of the array empty.
or setting the first value of "U8 array write" of the "LJUD_ eGetS" of the second Write function to the decimal value 81 [which is 1010001 (bin)]. Rest of the array empty.

This would clear up a lot of things for me.

Thanks a lot.

User

Attached Thumbnails

  • Forum.PNG


#6 user1979

user1979
  • Members
  • 62 posts

Posted 07 November 2012 - 04:04 AM

Concerning the adress I meant :

The default adress of the sensor is 0X28
I am planning
=>to set the "LJ_chI2C_ADDRESS" to the decimal value 80

because : 28 (hex) = 101000 (bin) = 40 (dec) and when shifting the bits to the left the bin value becomes : 1010000 which is 80 in decimal

#7 user1979

user1979
  • Members
  • 62 posts

Posted 07 November 2012 - 07:59 AM

I forgot to add the following figure showing the Data Fetch procedure

Attached Thumbnails

  • Forum_2.PNG


#8 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 07 November 2012 - 08:50 AM

1) At first glance the structure of the "UE9 I2C 24C16A EEPROM" example looks like it will work. 2) I'm a little bit confused by your question, but I think I can still help a bit. Set the address to 0x50 = (0x28 << 1). I am guessing that 0x81 is the start measurement command. In which case you would set the first element of the data array to 0x81. Then send that. After the sensor is done (80ms?) begin a new I2C transaction and read the 2 or 3 bytes to get HR and T.

#9 user1979

user1979
  • Members
  • 62 posts

Posted 12 November 2012 - 08:04 AM

Hi, 1) My question was concerning the "U3 I2C EEPROM" and not the "UE9 I2C 24C16A EEPROM". Are you saying I should use the "UE9 I2C 24C16A EEPROM" example? 2) I have attached a print screen of the parameters I have set in the "U3 I2C EEPROM" (program.png) I am perhaps not very far from the solution but things aren't clear enough for me .. : a) As you can see on the signal (signal first part.png) I am first sending 80 bin followed by ACK. According to the Data sheet (MR part) I should be sending a STOP after the ACK. Looking at the signal I think the STOP is missing, what do you think? If so, how can I add a STOP after the ACK? b)I then send the Data Fetch Command which is, as far as understand the data sheet : 81 bin Would you mind telling me if this seems ok with you for the first part of my program? PS : As you can see in the program.png I am setting the commands and adresses in BIN, is this correct? Sensor address : 0x28 Thanks a lot, User

Attached Thumbnails

  • Program.PNG
  • Signal_first_part.JPG
  • Data_sheet.JPG


#10 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 13 November 2012 - 06:06 AM

1) Both examples have the same structure: Address, Write some data give the chip some time to process, address, write some, read some. The diagram looks like it should work, but there are a couple setting that don't look like will work. 2) The first thing I notice is that your signals are not clean. Try using stronger pullup resistors (smaller resistance value). It's strange that the byte are repeated so close together. Not sure what to make of that. From It looks like to start the measurement cycle, just send the address, no data bytes. So for the first I2C transaction the number to RX and TX should be set to zero. For the second transaction set the number to TX to zero and the number to RX to 3. At the moment the address is being sent as both the address and a data byte.

#11 user1979

user1979
  • Members
  • 62 posts

Posted 16 November 2012 - 05:47 AM

Hi, Thansk for your answer. I have changed the 10 kOhms resistances to 4.7 kOhms resistances but I don't see much change in the signal (see attached file). I am sorry for this basic question but I don't understand where to access the RX and TX values you adviced me to change in my program ? Thanks a lot, User

Attached Thumbnails

  • Part_1.JPG
  • Part_2.JPG


#12 user1979

user1979
  • Members
  • 62 posts

Posted 16 November 2012 - 06:30 AM

PS : my question concerns the prpgam I am using (the one I have made a print screen of in my previous post)

#13 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 16 November 2012 - 08:52 PM

First of all, verify the radix of all LabView numbers. You can right-click view radix. I looks like the address is set to 80 which is 0x50, so that looks good. At the first EGetS block the attached array is what will be transmitted after the address. It contains 80, probably in decimal, Do you intend to send 0x50 right after the address?


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users