PM2.5 Sensor not working
We recently purchased a SKU:SEN0177 PM2.5 sensor for a in-door air quality monitor project.
The sensor doesn't work for most of the time. We mainly used it on the Adafruit Huzzah ESP8266 board running Arduino, we also tested on a official Arduino Ethernet. For most of the time, the example program would just return 0 readings form the serial port. I some very rare cases, the sensor will work and return some numbers. We tried to make some possible PM2.5 to fed it and the numbers will get higher if it's working. Do anyone have an idea what's happening?
The sensor doesn't work for most of the time. We mainly used it on the Adafruit Huzzah ESP8266 board running Arduino, we also tested on a official Arduino Ethernet. For most of the time, the example program would just return 0 readings form the serial port. I some very rare cases, the sensor will work and return some numbers. We tried to make some possible PM2.5 to fed it and the numbers will get higher if it's working. Do anyone have an idea what's happening?
2018-06-20 04:17:20 Well it's ESP8266 module based board that I designed myself. connected the GPIO12 and GPIO13 pin and defined them TX RX in the program and tested the module. And it doesn't work. sunhaochen
2018-01-19 15:54:18 What pins were you using? Could you attach a picture of your wiring? robert.chen
2018-01-19 05:59:37 We did tried that, multiple times. Does software pooling requires wiring through other GPIO pins? sunhaochen
2018-01-11 15:39:04 What if you follow the code and wiring according to the wiki, https://www.dfrobot.com/wiki/index.php/ ... KU:SEN0177
Can you get any result? robert.chen
Can you get any result? robert.chen
2018-01-11 12:22:57 I have encountered the same problem with no value get back. I tried the software serial with following code:
Code: Select all
Can any help with the problem? chrislifreelancer #include <SoftwareSerial.h>
SoftwareSerial Serial1(10, 11); // Software RX, TX
char col;
unsigned int PMSa = 0,FMHDSa = 0,TPSa = 0,HDSa = 0,PMSb = 0,FMHDSb = 0,TPSb = 0,HDSb = 0;
unsigned int PMS = 0,FMHDS = 0,TPS = 0,HDS = 0,CR1 = 0,CR2 = 0;
unsigned char buffer_RTT[40]={}; //Serial buffer; Received Data
char tempStr[15];
void setup()
{
Serial.begin(115200);
Serial1.begin(9600);
}
void loop()
{
while(!Serial1.available());
while(Serial1.available()>0) //Data check: weather there is any Data in Serial1
{
for(int i=0;i<40;i++)
{
col =Serial1.read();
buffer_RTT[i]=(char)col;
delay(2);
}
Serial1.flush();
CR1 =(buffer_RTT[38]<<8) + buffer_RTT[39];
CR2 = 0;
for(int i=0;i<38;i++)
CR2 += buffer_RTT[i];
if(CR1 == CR2) //Check
{
PMSa=buffer_RTT[12]; //Read PM2.5 High 8-bit
PMSb=buffer_RTT[13]; //Read PM2.5 Low 8-bit
PMS=(PMSa<<8)+PMSb; //PM2.5 value
FMHDSa=buffer_RTT[28]; //Read Formaldehyde High 8-bit
FMHDSb=buffer_RTT[29]; //Read Formaldehyde Low 8-bit
FMHDS=(FMHDSa<<8)+FMHDSb; //Formaldehyde value
TPSa=buffer_RTT[30]; //Read Temperature High 8-bit
TPSb=buffer_RTT[31]; //Read Temperature Low 8-bit
TPS=(TPSa<<8)+TPSb; //Temperature value
HDSa=buffer_RTT[32]; //Read Humidity High 8-bit
HDSb=buffer_RTT[33]; //Read Humidity Low 8-bit
HDS=(HDSa<<8)+HDSb; //Humidity value
}
else
{
PMS = 0;
FMHDS = 0;
TPS = 0;
HDS = 0;
}
}
Serial.println("-----------------------uart--------------------------");
Serial.print("Temp : ");
sprintf(tempStr,"%d%d.%d",TPS/100,(TPS/10)%10,TPS%10);
Serial.print(tempStr);
Serial.println(" C"); //Serial pring Temperature
Serial.print("RH : ");
sprintf(tempStr,"%d%d.%d",HDS/100,(HDS/10)%10,HDS%10);
Serial.print(tempStr); //Serial print humidity
Serial.println(" %");
Serial.print("HCHO : ");
Serial.print(FMHDS);
Serial.println(" ug/m3"); //Serial print formaldehyde, unit: ug/m³
Serial.print("PM2.5: ");
Serial.print(PMS);
Serial.println(" ug/m3"); //Serial print PM2.5, unit: ug/m³
Serial.println();
}
2017-11-21 16:30:55 The reason you got all zeros for this sensor is you need to pay attention to the serial occupation problem, since the communication between Arduino and PM2.5 sensor is through TX/RX, also Arduino need to communicate with PC, you can't use one serial for both communication, you may need to use software serial to avoid the problem robert.chen
2017-11-12 09:48:56 I'm having similar problems - however I'm getting no readings at all? Smith Brendan