Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading data from STC31 (Sparkfun CO₂ Sensor)

Solved!
Go to solution

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.

LabVIEW_STC31_error.jpg

LabVIEW_STC31.jpg

 

 

0 Kudos
Message 1 of 4
(2,622 Views)

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.

greetings from the Netherlands
0 Kudos
Message 2 of 4
(2,596 Views)
Solution
Accepted by topic author ZeUs87

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 :

ZeUs87_0-1647443093127.png

ZeUs87_1-1647443134148.png

 

0 Kudos
Message 3 of 4
(2,577 Views)

Good catch

greetings from the Netherlands
0 Kudos
Message 4 of 4
(2,570 Views)