I am unable to get any reading from a PMS5003 connected to an ESP32.
In trying to debug this problem, I have a very minimal setup. Only the PMS5003 is connected to the ESP32, and using the following the code.
#include <Arduino.h>
#define PMS_DEBUG
#include <PMSerial.h>
SerialPM pms(PMSx003,Serial2)
void setup() {
Serial.begin(9600);
Serial2.begin(9600);
pms.init();
}
void loop() {
pms.read();
Serial.println(pms.pm25);
Serial.println(pms.status);
}
pms25
always returns 0
. When the PMS5003 is properly connected to the ESP32, status
always returns "Wrong message start".
Why would the device be sending the wrong start code, and what steps can I take to debug this?
I have tried connecting to different serial pins, including following the ESP32 software serial example provided by the PMSerial library. In all cases, it simply looks as though the PMS5003 sensor is not transmitting anything - indeed no fans are switching on and there is no sign of life at all from the device. However, I am very much a beginner, and don't know enough to tell whether this is a problem with the device, the library or something I have done.
What is the best way to debug an issue like this?