My Gravity SENO220 don't give me the good values
Hello,
I ordered a Gravity SEN0220 CO2 Sensor 0-50000 ppm 2 weeks ago. I tried it but I got a problem, the values don't go further than 5000 ppm.
I use your code to take the values and tried other codes but it's still stuck to 5000 ppm, can someone help me please ?
The code :
/***************************************************
* Infrared CO2 Sensor 0-50000ppm(Wide Range)
* ****************************************************
* 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[9] = {0xFF,0x01,0x86,0x00,0x00,0x00,0x00,0x00,0x79}; //Read the gas density command /Don't change the order
void setup() {
Serial.begin(9600);
while (!Serial) {
}
mySerial.begin(9600);
}
void loop() {
mySerial.write(hexdata,9);
delay(500);
for(int i=0,j=0;i<9;i++)
{
if (mySerial.available()>0)
{
long hi,lo,CO2;
int ch=mySerial.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");
}
}
}
}
The range of the sensor can be adjusted by using serial port commands. See the following figure for detailed serial port configuration and commands to modify the range:
Winster