Hello friends
We are working with ZE08-CH2O.
Sensor module was sourced from
https://www.winsen-sensor.com/products/formaldehyde-detection-module/ze08-ch2o.html
Our connections with the Arduino board as follows
Connected the power pin to 5V
TX pin of ZE08-CH2O to the RX pin of Arduino
please find our code below
we are working on default mode (active upload) using which we are getting data from the sensor after every 1 sec
When we take using URAT mode for a 5ppm solution we are reading as 0.05-0.1
We even tried getting readings from DAC pin on the sensor
for a 5ppm solution, we getting 0.47~v and it increased only up to 0.6~v at 100ppm
We have cross-checked our solution using chemical methods and solution are of proper concentration. However, we are not able to figure why the sensor is giving low values the said concentration
Thanks in advance
#include <arduino.h>
#include <SoftwareSerial.h>
#define MAXLENGTH 9
#define VREF 5.0 //
#//include "Timer.h"
long tenMinutes = 10 * 60 * 1000L; // on time of heater
//Timer t; // Object of the timer class
SoftwareSerial mySerial(10, 11);
byte receivedCommandStack[MAXLENGTH];
byte checkSum(byte array[], byte length);
boolean receivedFlag;
void setup()
{
// put your setup code here, to run once:
mySerial.begin(9600);
Serial.begin(9600);
}
void loop()
{
ze08_PPM();
//analogReadPPM();
}
byte checkSum(byte array[], byte length)
{
byte sum = 0;
for (int i = 1; i < length - 1; i ++)
{
sum += array[i];
}
sum = (~sum) + 1;
return sum;
}
boolean available1() //new data was recevied
{
while (mySerial.available())
{
for (byte index = 0; index < MAXLENGTH - 1; index++)
{
receivedCommandStack[index] = receivedCommandStack[index + 1];
}
receivedCommandStack[MAXLENGTH - 1] = mySerial.read();
byte sumNum = checkSum(receivedCommandStack, MAXLENGTH);
if ( (receivedCommandStack[0] == 0xFF) && (receivedCommandStack[1] == 0x17) &&
(receivedCommandStack[2] == 0x04) && (receivedCommandStack[MAXLENGTH - 1] == sumNum)
) //head bit and sum are all right
{
receivedFlag = 1; //new data received
return receivedFlag;
}
else {
receivedFlag = 0; //data loss or error
return receivedFlag;
}
}
return receivedFlag;
}
float ze08_PPM()
{
if (available1() == 1)
{
receivedFlag = 0;
float ppb = (unsigned int) (receivedCommandStack[4] * 256) + receivedCommandStack[5]; // bit 4: ppm high 8-bit; bit 5: ppm low 8-bit
float ppm = ppb / 1000; //1ppb = 1000ppm
delay (1000);
Serial.print("Formalin ppm == ");
Serial.println(ppm);
return ppm;
}
}
float analogReadPPM()
{
float analogVoltage = analogRead(A0) / 1024.0 * VREF;
float ppm = 3.125 * analogVoltage - 1.25; //linear relationship(0.4V for 0 ppm and 2V for 5ppm)
if(ppm<0) {
ppm=0;
}
else if(ppm>5) {
ppm = 5;
}
delay (1000);
return ppm;
}
ZE08_CH2O.ino (2.08 KB)