- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am testing the EVAL_PASCO2_SENSOR2GO in two configurations:
1) I connect the whole kit to the USB port of my PC and I launch the XENSIV software. The software connects to the device on COM4 and reads the CO2 concentration in my room, which is about 620ppm (seems reasonable to me).
2) I have made a custom interface board, which includes a boost converter to provide 12V and a microcontroller (Teensy 3.2) to communicate to the XENSIV™ PAS CO2 sensor directly via I2C. In this case, I talk directly to the sensor board not to the kit. I read the CO2 level using the microcontroller and the Arduino library, which offers .ino example files for single shot measurements of the CO2.
In the second config, I see the sensor is acknowledged via the serial interface and the product ID is read. Also the single-shot measurement example cumpiles smoothly, without errors, but this time the CO2 reading reported are always negative numbers, in the order of "-1240" (I presume ppm).
I wonder if somebody could help in telling me what could be wrong with the second config, as I don't think getting a negative number for CO2 levels makes any physical sense. Regardless of the sign, also a value of 1240 seems way too off from the 620ppm I got in the first configuration.
Any help would be much appreciated.
Cheers
Solved! Go to Solution.
- Labels:
-
CO2 Sensor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Anand,
yes, I confirm 12V is there and spot on. Also, I don't think the heater is damaged as I just connected the sensor to the evalkit and is reading 640ppm of Co2 via the GUI.However, I think we reached a solution.
Thanks to your input, I though to cross-check the pinout of my circuit. While writing down the value of each pin, I realized the GND pin was left floating. There was an unnoticed mistake in my layout which I easily corrected with a bit of solder.
After connecting the proper GND, the sensor now seem to work fine. The output of the one-shot example reads 622ppm which is in line with the 640ppm read by the software application. See output below.
co2 ppm value : 624
co2 ppm value : 622
co2 ppm value : 621
co2 ppm value : 623
co2 ppm value : 623
co2 ppm value : 623
co2 ppm value : 623
co2 ppm value : 622
co2 ppm value : 624
I think we fixed the bug! The mistake was on my board, and I am very sorry for this. I'd like to thank you very much for your help and patience in bearing with me till a solution was found.
Best regards.
Nicolo'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @nicochio ,
The negative value is erroneous. It would come as positive if the data has been correctly mapped. Can you please share the flow of code? Please check if you are using the correct registers for acquiring the CO2 value as well. Please check if you are using the latest version of arduino code https://github.com/Infineon/arduino-pas-co2-sensor/releases and let us know if you are following the same code flow too.
Best Regards,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Deepa,
thanks for coming back to me. The library version is the latest one, namely: arduino-pas-co2-sensor-2.1.0.
The flow of code is just one of the example .ino file, namely the serial-periodic.ino in the examples subfolder of the library. I copy/paste here for you. By the way, there is no register to specify. The example file just runs as it is, without modifications, so I guess that whatever register you refer to, it must be defined somewhere in the .cpp source code of the library.
Here is the code flow (serial.
#include <Arduino.h>
#include <pas-co2-serial-ino.hpp>
/*
* The sensor supports 100KHz and 400KHz.
* You hardware setup and pull-ups value will
* also influence the i2c operation. You can
* change this value to 100000 in case of
* communication issues.
*/
#define I2C_FREQ_HZ 400000
#define PERIODIC_MEAS_INTERVAL_IN_SECONDS 10
/*
* Create CO2 object. Unless otherwise specified,
* using the Wire interface
*/
PASCO2SerialIno cotwo;
int16_t co2ppm;
uint16_t pressureReference = 900;
Error_t err;
void setup()
{
Serial.begin(9600);
delay(500);
Serial.println("serial initialized");
/* Initialize the i2c serial interface used by the sensor */
Wire.begin();
Wire.setClock(I2C_FREQ_HZ);
/* Initialize the sensor */
err = cotwo.begin();
if(XENSIV_PASCO2_OK != err)
{
Serial.print("initialization error: ");
Serial.println(err);
}
/* We can set the reference pressure before starting
* the measure
*/
err = cotwo.setPressRef(pressureReference);
if(XENSIV_PASCO2_OK != err)
{
Serial.print("pressure reference error: ");
Serial.println(err);
}
/*
* Configure the sensor to measureme periodically
* every 10 seconds
*/
err = cotwo.startMeasure(PERIODIC_MEAS_INTERVAL_IN_SECONDS);
if(XENSIV_PASCO2_OK != err)
{
Serial.print("start measure error: ");
Serial.println(err);
}
delay(1000);
}
void loop()
{
/* Wait for the value to be ready. */
delay(PERIODIC_MEAS_INTERVAL_IN_SECONDS*1000);
co2ppm = 0;
err = cotwo.getCO2(co2ppm);
if(XENSIV_PASCO2_OK != err)
{
/* Retry in case of timing synch mismatch */
if(XENSIV_PASCO2_ERR_COMM == err)
{
delay(600);
err = cotwo.getCO2(co2ppm);
if(XENSIV_PASCO2_OK != err)
{
Serial.print("get co2 error: ");
Serial.println(err);
}
}
}
Serial.print("co2 ppm value : ");
Serial.println(co2ppm);
/*
* Assuming we have some mechanism to obtain a
* pressure reference (i.e. a pressure sensor),
* we could compensate again by setting the new reference.
* Here we just keep the initial value.
*/
err = cotwo.setPressRef(pressureReference);
if(XENSIV_PASCO2_OK != err)
{
Serial.print("pressure reference error: ");
Serial.println(err);
}
}
This is what I receive on the Serial Monitor interface of Arduino:
Serial initialized
co2 ppm value : -1411
co2 ppm value : -1376
co2 ppm value : -1391
co2 ppm value : -1391
co2 ppm value : -1382
co2 ppm value : -1387
co2 ppm value : -1385
co2 ppm value : -1386
co2 ppm value : -1388
co2 ppm value : -1385
co2 ppm value : -1386
co2 ppm value : -1382
co2 ppm value : -1374
co2 ppm value : -1371
co2 ppm value : -1368
co2 ppm value : -1362
co2 ppm value : -1361
co2 ppm value : -1356
co2 ppm value : -1354
co2 ppm value : -1354
co2 ppm value : -1352
co2 ppm value : -1352
co2 ppm value : -1350
co2 ppm value : -1350
co2 ppm value : -1346
co2 ppm value : -1343
get co2 error: 1
co2 ppm value : 0
pressure reference error: 1
co2 ppm value : -1336
co2 ppm value : -1337
co2 ppm value : -1334
co2 ppm value : -1331
co2 ppm value : -1329
co2 ppm value : -1328
co2 ppm value : -1328
co2 ppm value : -1329
co2 ppm value : -1330
co2 ppm value : -1330
...
As you can see, after a series of about 20 - 30 measurements, the code reports an error with the pressure level. But the reference pressure is set in the setup to a value of 900... I did not touch it, but maybe this is the source of the error?
Any help would be highly appreciated!
Cheers
nicolo'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @nicochio ,
We are looking into your code. Please do check if your source voltage is 12V. If you have access to multimeter do confirm that or try with another 12V source.
Best regards,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
yes, I confirm I have 12.00V spot on. Just measured with my voltmeter.
Cheers
n.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @nicochio
Can you please run the serial-oneshot.ino examples once confirm me the status.
and also please run serial-device-id.ino and let me know the version of mini evaluation kit you are using.
Regards,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
thanks for coming back oto me.
This is the output of the serial-oneshot.ino test:
serial initialized
co2 ppm value : -1093
co2 ppm value : -1088
co2 ppm value : -1099
co2 ppm value : -1099
co2 ppm value : -1098
co2 ppm value : -1092
co2 ppm value : -1090
co2 ppm value : -1089
co2 ppm value : -1089
co2 ppm value : -1088
This is the output of the serial-device-id.ino file:
serial initialized
product id : 2
revision id : 10
As you see, pressure reading is negative. On the other hand, it seems to me it'sreading the ID just fine, as 2.1.0 is the version of the software library I have installed. Hence, I don't think there is an error in the communication...
Any help would be appreciated. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @nicochio
Usually the negative values will appear when 12 V supply is not available but in your setup it is confirmed that 12 V is available. My guess is that , there are chances that the heater got damaged during integration of your setup. I suggest you to connect the same sensor with evalkit and read the sensor data via GUI once and observe what is the co2 value gui is reading.
Regards,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Anand,
yes, I confirm 12V is there and spot on. Also, I don't think the heater is damaged as I just connected the sensor to the evalkit and is reading 640ppm of Co2 via the GUI.However, I think we reached a solution.
Thanks to your input, I though to cross-check the pinout of my circuit. While writing down the value of each pin, I realized the GND pin was left floating. There was an unnoticed mistake in my layout which I easily corrected with a bit of solder.
After connecting the proper GND, the sensor now seem to work fine. The output of the one-shot example reads 622ppm which is in line with the 640ppm read by the software application. See output below.
co2 ppm value : 624
co2 ppm value : 622
co2 ppm value : 621
co2 ppm value : 623
co2 ppm value : 623
co2 ppm value : 623
co2 ppm value : 623
co2 ppm value : 622
co2 ppm value : 624
I think we fixed the bug! The mistake was on my board, and I am very sorry for this. I'd like to thank you very much for your help and patience in bearing with me till a solution was found.
Best regards.
Nicolo'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @nicochio ,
Good to hear that the problem got solved. Please let us know if any further support required.
Happy to help you.
Regards,
Anand