From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
08-07-2020 03:57 PM
Hi,
I am trying to connect SHT85 via I2C using USB-8541 and LabVIEW.
Is there a sample program to get raw data from the SHT85 sensor?
Thanks,
Nilesh
Solved! Go to Solution.
08-07-2020 04:38 PM
I don't know of one, but some of the built in examples that come with the USB-8451 driver might get you pretty close.
For more information, you might review these:
Understanding the I2C Two Wire Bus Interface with NI LabVIEW - NI
Using I2C with LabVIEW and the USB-8451 - National Instruments (This one mentions the USB-8451 driver examples)
Also, I found this:
Adapting code from U3/U6 to T7 | LabJack
I haven't reviewed it thoroughly, but in the replies at the end, it links to examples by LabJack that mention using the SHT85 with I2C.
However, I do not have experience using I2C with LabVIEW, so if someone more experienced with I2C, the SHT85, or the USB-8451 reads this, I hope they will respond. 😅
-joeorbob
08-10-2020 06:25 AM - edited 08-10-2020 06:26 AM
Here's something to get you started. I already spent more time on this than I should have. Code in LabVIEW 2019.
08-10-2020 08:05 AM
Thank you both of you.
It helped me a lot.
Also, I did something similar. See the attached file. The output is raw data.
Thanks,
Nilesh
08-10-2020 09:22 AM - edited 08-10-2020 09:23 AM
@nilux wrote:
Thank you both of you.
It helped me a lot.
Also, I did something similar. See the attached file. The output is raw data.
Thanks,
Nilesh
1. No need to do anything with the DIO Active Port. a) There is only 1 port. b) You are not using it for this application. The voltage level may need to be set depending on your supply voltage for the device.
2. You need to set the pull-up to be active unless you are supplying your own pull-up.
3. You do not need to use the I2C Write to write the address. That is taken take of by the driver. I forgot this part in my quick example using the property node like you did.
4. Speaking of the address, I don't think you are setting it to the proper value. a) You have a coercion dot there, meaning you are using the wrong representation. It should be a U16 to make the driver happy (it can handle larger address ranges, but defaults to using the 7-bit). b) Right-click on the constant and enable Visible Items->Radix. You will see a little letter show up in the constant. This shows in what format the value is shown in. If it is a 'd', that means you are inputting decimal values. But everything in the manual is in hex. So you need to click on that icon and choose "hex". Retype the "44". NOTE: If you are ever using a format other than decimal, you really should have the radix visible so you can immediately tell. I have seen way too many errors from mixing hex and decimal formats.
5. Depending on your repeatability, the device may take between 2.5 - 15.5ms. This is an EXTREMELY long time. So you do not want to use the Write-Read function. You will want to do your write, wait for a set amount of time, and then do the I2C Read for 6 bytes.
6. Since you are doing the "one-shot", you do not need to send the "Fetch Data". So just use I2C Read.
Here is an update to my example adding the address.
08-10-2020 09:58 AM
Thank you for your suggestions.
Yes, your suggestions works and I don't need to write fetch command.
One write and read can get me raw data.
1. DIO port: I am going to use it for future work. I am going to use the I2C multiplexer to connect multiple SHT85.
2. I am using external pullups resistors.
3. Repeatability is going to be in minutes.
4. "Fetch Data". Let's say I want to read data every 10 min, Do I need to use fetch data or just loopback?
Thanks,
Nilesh
08-10-2020 10:20 AM
@nilux wrote:
3. Repeatability is going to be in minutes.
4. "Fetch Data". Let's say I want to read data every 10 min, Do I need to use fetch data or just loopback?
I was stating "repeatability" as stated in the data sheet. The repeatability can be "Low", "Medium", or "High" and they increase in measurement time. So you should definitely use the one-stop measurement command, wait, and then read the measurement.
08-10-2020 10:36 AM
Yes, Correct.