FAQ

Hello , any news of the Back Order ? I'm waiting since one month. Thank you .

userHead JaneYu 2017-02-20 18:06:33 16 Views104 Replies

Hello , any news of the Back Order ? I'm waiting since one month. Thank you .

2023-01-15 03:47:33

Hey, so whenever the sensor preheats its self, it then auto selects https://uploads.disquscdn.c... the sensor isn't working. does the sensor have to auto Cal itself for 24 hours consistently, or is it something in my code?

<int analogpin="A0;" void="" setup()="" {="" serial.begin(9600);="" }="" void="" loop()="" {="" int="" adcval="analogRead(analogPin);" float="" adcval1="adcVal*(5.0/1024.0);" float="" voltage="adcVal1*(1.6/5.0);" if(voltage="=" 0)="" {="" serial.println("a="" problem="" has="" occurred="" with="" the="" sensor.");="" }="" else="" if(voltage="" <="" 0.4)="" {="" serial.println("pre-heating="" the="" sensor...");="" }="" else="" {="" float="" voltagediference="voltage-0.4;" float="" concentration="(voltageDiference*5000.0)/1.6;" serial.print("voltage:");="" serial.print(voltage);="" serial.println("v");="" serial.print(concentration);="" serial.println("quot;ppm");="" }="" delay(2000);="" }="">

userHeadPic JaneYu
JaneYu wrote:

Could you tell us what is your mainboard?
This sensor need the 5V power even if you are using the ESP32(3.3V mainboard)

2023-03-09 16:44:01
1 Replies
2023-01-03 19:48:37

hi, is there any reference to use this sensor with esp32? bcs the code example couldn't work in esp32 (no output shown).

userHeadPic JaneYu
2022-12-05 15:13:25

hello, do you have tutorial on how to use Gravity: UART Infrared CO2 Sensor (0-50000ppm). is it similar to Gravity: Infrared CO2 Sensor For Arduino?

userHeadPic JaneYu
JaneYu wrote:

Hi, The communication mode and measurement range of the two sensors are different. It is recommended that you check the wiki of each product for detailed product descriptions.

2023-01-03 14:08:40
1 Replies
2022-11-30 04:03:18

For anyone interested here will be a working sketch for firebeetle V2 with the Gravity: PWM Infrared Carbon Dioxide Sensor
the previous ones were for the analog sensor

#define sensorIn 25 // Sensor PWM interface

unsigned long pwm_high_start_ticks = 0, pwm_high_end_ticks = 0;
double pwm_high_val = 0, pwm_low_val = 0;
volatile uint8_t flag = 0;


void interrupt_rising() {
pwm_high_start_ticks = micros(); // store the current micros() value
if (2 == flag) {
flag = 4;
pwm_low_val = pwm_high_start_ticks - pwm_high_end_ticks;
} else {
flag = 1;
}

attachInterrupt(digitalPinToInterrupt(sensorIn), interrupt_falling, FALLING);
}

void interrupt_falling() {
pwm_high_end_ticks = micros(); // store the current micros() value
if (1 == flag) {

flag = 2;
pwm_high_val = pwm_high_end_ticks - pwm_high_start_ticks;
}

attachInterrupt(digitalPinToInterrupt(sensorIn), interrupt_rising, RISING);
}

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(sensorIn, INPUT);
attachInterrupt(digitalPinToInterrupt(sensorIn), interrupt_rising, RISING);
}

void loop() {
if (flag == 4) {
flag = 1;
double pwm_high_val_ms = (pwm_high_val * 1000) / (pwm_low_val + pwm_high_val);

if (pwm_high_val_ms < 0.01) {
Serial.println("Fault");
} else if (pwm_high_val_ms < 80.00) {
Serial.println("preheating");
} else if (pwm_high_val_ms < 998.00) {
double concentration = (pwm_high_val_ms - 2) * 5;
// Print pwm_high_val_ms
Serial.print("pwm_high_val_ms:");
Serial.print(pwm_high_val_ms);
Serial.println("ms");
//Print CO2 concentration
Serial.print(concentration);
Serial.println("ppm");
} else {
Serial.println("Beyond the maximum range :398~4980ppm");
}
Serial.println();
}
}

userHeadPic JaneYu
JaneYu wrote:

can we use this code in ESP32?

2023-01-03 19:41:47
1 Replies
2022-11-16 14:20:08

I don’t know. A problem has occurated with sensor is massage from arduino IDE - meaning - There was a problem with the sensor. I made a measurement and on the output signal against GND droping voltage from 2V to 0V every second.

userHeadPic JaneYu
2022-11-11 00:57:41

I have sensor version 2. After testing several codes. Sensor still blinking. after testing the code from QA - a problem has occurated with sensor. I think it's broken.

userHeadPic JaneYu
2022-11-10 03:35:14

Hi my sensor blink every second. What is mean??? It is preheating? Because it's been blinking for several hours.

userHeadPic JaneYu
2022-09-09 10:09:24

Hi, If you are using the V1 version, please use analog communication, please refer to A2 in the link below for the specific example code:
https://www.dfrobot.com/for...

userHeadPic JaneYu
2022-09-07 23:08:13

How much time it takes to preheating?
It shows value for few seconds then it again goes to preheating mode,what can I do any solution?
pls help🙏

userHeadPic JaneYu
JaneYu wrote:

Hi, This sensor generally needs to warm up for three minutes, and the sensor needs to be calibrated before the first use.
Before that, you need to confirm your sensor version, if it is V1 version, please refer to the link below:https://www.dfrobot.com/for...

2022-09-09 10:11:23
1 Replies
2022-03-16 12:52:37

0V and 3.5V are output alternately in a 1-second cycle. The duty ratio is around 80%.
How can I get normal output?

userHeadPic JaneYu
2021-09-27 16:09:44

Hi support. Can you please tell my why the serial option returns a garbage value ~34000ppm after a few hours of working normally?

userHeadPic JaneYu
2021-09-14 07:51:30

Inspired by your post, I got the sensor working with the RX/TX pins.

Also added ability to calibrate and enable/disable auto calibration via the RX/TX pins. I'm not sure the method in your video for doing this works as the command needs sent from the Arduino and the checksum value needs to be calcuated.

The code below for anyone who might benefit. It uses a simple state machine rather than delaying, so you can do other stuff without issue.

Simply change "startState = REQUESTREAD" to for example "stateState = REQUESTDISABLEAUTO" to disable the auto calibration (or hook up an external trigger like a button)


/***************************************************
* Infrared CO2 Sensor 0-50000ppm(Wide Range)
* **********************************a******************
* The follow example is used to detect CO2 concentration.

* @author lg.gang([email protected])
* @version V1.0
* @date 2016-6-6

* GNU Lesser General Public License.
* See <http: www.gnu.org="" licenses=""/> for details.
* All above must be included in any redistribution
* ****************************************************/
#include <softwareserial.h>
//SoftwareSerial mySerial(10, 11); // RX, TX
unsigned char hexdata_request[9] = {0xFF,0x01,0x86,0x00,0x00,0x00,0x00,0x00,0x79}; //Read the gas density command /Don't change the order
unsigned char hexdata_calibrate[9] = {0xFF,0x01,0x87,0x00,0x00,0x00,0x00,0x00,0x78}; // Zero/Calibrate 400ppm
unsigned char hexdata_autocaldisable[9] = {0xFF,0x01,0x79,0x00,0x00,0x00,0x00,0x00}; //Read the gas density command /Don't change the order
unsigned char hexdata_autocalenable[9] = {0xFF,0x01,0x79,0xA0,0x00,0x00,0x00,0x00}; //Read the gas density command /Don't change the order

void setup() {

Serial.begin(9600);
while (!Serial) {

}
Serial2.begin(9600);
hexdata_request[8] = getCheckSum(hexdata_request);
hexdata_calibrate[8] = getCheckSum(hexdata_calibrate);
hexdata_autocaldisable[8] = getCheckSum(hexdata_autocaldisable);
hexdata_autocalenable[8] = getCheckSum(hexdata_autocalenable);
}

void loop() {
co2statemachine();
}


enum CO2STATEMACHINE
{
DELAY,
COMMANDWAIT,
PARSEREAD,
PARSERESPONSE,
REQUESTREAD,
REQUESTENABLEAUTO,
REQUESTDISABLEAUTO,
REQUESTCALIBRATE
};

CO2STATEMACHINE startState = REQUESTREAD;
CO2STATEMACHINE currentState = startState;
CO2STATEMACHINE nextState = REQUESTREAD;
long startWait = millis();
long readWait = 50;
long readDelay = 2000;
int waitAttempts = 0;

void co2statemachine()
{
switch(currentState)
{
case DELAY:
if(millis() - startWait > readDelay)
{
currentState = REQUESTREAD;
}
break;
case COMMANDWAIT:
if(millis() - startWait > readWait)
{
if(waitAttempts > 10)
{
currentState = REQUESTREAD;
}
else
{
currentState = nextState;
}
}
break;
case REQUESTREAD:
Serial2.write(hexdata_request,9);
currentState = COMMANDWAIT;
nextState = PARSEREAD;
startWait = millis();
waitAttempts = 0;
break;
case PARSEREAD:
if(Serial2.available()>0)
{
for(int i=0;i<9;i++)
{
if (Serial2.available()>0)
{
long hi,lo,CO2;
int ch=Serial2.read();

if(i==2){ hi=ch; } //High concentration
if(i==3){ lo=ch; } //Low concentration
if(i==8)
{
CO2=hi*256+lo; //CO2 concentration
Serial.print("CO2 concentration: ");
Serial.print(CO2);
Serial.println("ppm");
}

}
}

currentState = DELAY;
startWait = millis();
}
else
{
currentState = COMMANDWAIT;
startWait = millis();
waitAttempts++;
}
break;
case PARSERESPONSE:
if(Serial2.available())
{
Serial.print(Serial2.read());
}
currentState = REQUESTREAD;
break;
case REQUESTCALIBRATE:
Serial2.write(hexdata_calibrate,9);
Serial.print("Calibrated to 400ppm");
Serial.println();
currentState = COMMANDWAIT;
nextState = PARSERESPONSE;
startWait = millis();
break;
case REQUESTENABLEAUTO:
Serial2.write(hexdata_autocalenable,9);
Serial.print("Auto calibraton enabled");
Serial.println();
currentState = COMMANDWAIT;
nextState = PARSERESPONSE;
startWait = millis();
break;
case REQUESTDISABLEAUTO:
Serial2.write(hexdata_autocaldisable,9);
Serial.print("Auto calibraton disabled");
Serial.println();
currentState = COMMANDWAIT;
nextState = PARSERESPONSE;
startWait = millis();
break;

}


}

unsigned char getCheckSum(unsigned char *packet)
{
unsigned char i, checksum=0;
for( i = 1; i < 8; i++)
{
checksum += packet[i];
}
Serial.print("Checksum: ");
Serial.print(checksum, HEX);
Serial.println();
checksum = 0xFF - checksum;
checksum += 1;
return checksum;
}

userHeadPic JaneYu
2021-09-05 23:53:10

Hello. We are planning to use this instrument on a weather balloon to measure CO2 in the stratosphere. Our primary concern is keeping the instrument within its operating temperature. We were wondering if it is more important to keep the body of the instrument above 0 deg C or more important to keep the sample air above 0 deg C?

For heating efficiency, we would like to try keeping the majority of the instrument sealed inside an insulated chamber with a heating element (and temperature sensor to regulate the heat level), and just have the filter exposed to the outside air. The outside air will likely drop down below -45 C above 20km, but the air pressure will also be low (below 30 hpa). Thank you for any guidance you can offer.

https://uploads.disquscdn.c...

userHeadPic JaneYu
2021-04-06 15:34:47

Hi,
If I want to use the UART interface to read data from the sensor, do i need to send a command to the sensor first? Is there a command table anywhere for this sensor?
Is there a tutorial on how to use the serial interface with this sensor

userHeadPic JaneYu
2021-01-09 12:40:25

Hello, I'm having some issues with the sensor, it gives too low of a reading. After I calibrated it (by grounding pins 8 and 20), it says that the ppm is in the range 250-350 when I measure outdoors. I expect the reading outdoors to be about 400-440ppm. (I live near the Space Needle, which is continuously measuring CO2, and is in the range 400-440 https://www.pmel.noaa.gov/c... )

I have copy pasted the code from here: https://wiki.dfrobot.com/Gr...

I tried running it for 24 hours and it still has low readings.

I bought 2 sensors, and they both have the same issue, so I don't think it's due to a defective sensor. I've also measured in different locations, and they also have low readings.

What can I do to get correct readings?

userHeadPic JaneYu
2020-10-15 17:16:58

Hi! After reading the comments below, I still have a doubt. I want to disable the automatic calibration function. For manual calibration, I put the pins 8 and 20 to GND for 7 seconds. Now, will this action also disable the automatic calibration or is it necessary to use the serial to disable it? I am asking this because I would need to avoid the use of the RX/TX pins on the Arduino, that are connected to other sensors.

Thank you!

userHeadPic JaneYu
2020-04-18 05:03:57

Hello, I purchased:
- DFRduino UNO, DFRobot
- Gravity: IO Expansion Shield for Arduino V7.1
- Gravity: Infrared CO2 Sensor

I was following the tutorial at the wiki page.

The first results reported via analog were from 800ppm-1800ppm and I left the sensor running once per second outside for 36 hours when it began reporting correct numbers, 380-420ppm.

Now I have switched to monitor via serial for more accurate readings, as discussed below. Everything seems to work ok for 1 minute. However, after exactly 60 seconds, the ppm reading goes up about 200:

57: CO2 concentration: 410ppm
58: CO2 concentration: 410ppm
59: CO2 concentration: 410ppm
60: CO2 concentration: 605ppm
61: CO2 concentration: 605ppm
62: CO2 concentration: 605ppm

Why is c02 concentration changing after 60 seconds?

userHeadPic JaneYu
2020-03-03 11:22:37

Ahhh alright so these sensors do not have ABC function. Got it! Thanks for the reply. Would you have any idea as to why the sensors are unstable? I thought it was because of their ABC function. Are these sensors not as effective in environments with constant CO2 saturation? I am trying to maintain elevated CO2 concentrations inside a greenhouse setting, but the sensors keep becoming noisy, and their readings do not match another set of sensors which have been tested to work. Another issue is that when I took voltage measurements after over-saturating, and then cutting off the CO2 supply respectively, the voltages go up to 2.0 V. This should correspond to 2000 ppm iirc (which we set as max), and this is expected, but then the voltage fails to drop down to 500 mv (450 ish ppm range, before CO2 saturation) after CO2 is cut off. They instead remain much higher and stay high with increasing noise until I calibrate them. Is there any way to trouble-shoot this issue? If you need more clarity or details, please let me know.

userHeadPic JaneYu
2019-11-18 09:59:57

Hi Mason
Apologies for the delay in reply.
Maybe you need to warm it up for more than ten minutes before you start uploading the program.

userHeadPic JaneYu
2019-11-12 06:11:08

Hello DF Robot team,

I am using the sensor and keeping it in a monitored chamber where the concentration of C02 can be varied. When I keep the sensor in the chamber and read its value it shows me a reading of 423ppm. It increases when we introduce C02 in the chamber and it works fine but for some reason when we completely eliminate the C02 from the chamber , the sensor concentration value decreases but it does not go below 423ppm.
Can you please advise me of how to accurately use the sensor so that it shows values between 0 - 5000ppm. Please note Im using 5v supply from Arduino uno to run the sensors and I am using the same script you described in the example to get the values from the sensor.
Thank you!

userHeadPic JaneYu