03-11-2022 08:55 AM
I am trying to read CO2 concentration data from a Sparkfun Co2 sensor (SPX-18385) that uses Sensiron STC31 sensor.
I have used I2C protocol before for reading humidity data from SHT 85 sensors using LabVIEW and NI USB-8451 hardware.
However, I am not able to make this STC31 sensor work with my NI USB-8451. I know that the sensor works as II was able to use the available Arduino code with Arduino Uno hardware to get CO2 concentration and temperature data.
It seems my implementation is not correct and I get an error 301740. As per my understanding the spakfun board already has included pullup resistors. Moreover, the sensor works when I directly (no pullups) attach it wo an Arduino Uno and use the provided Arduino code. Please help.
I have attached my VI and screenshot. I am also attaching the sensor data sheet where the I2C commands are provided.
Solved! Go to Solution.
03-12-2022 04:40 PM
Hi
I did check an example for I2C read and that starts quite differently.
Maybe is your start, initialise etc. not what the system expects.
I did a lot of I2c but always used the structure the example shows.
I also don't see a big mistake in your approach except that it is not working.
I looked at this example: C:\Program Files (x86)\National Instruments\LabVIEW 2021\examples\ni845x\845xEx.llb\General I2C Write.vi
I used 2021 but in case you have another version just fill in the correct year.
03-16-2022 10:05 AM
Thanks for your input. I have figured out the issue. It is not because of improper initialization but because of the way I was sending command and argument pairs to I2C write blocks. For no arguments, it is straightforward, it was just an issue with implementing the arguments.
Please check the snapshots below :
03-16-2022 12:50 PM