PMS5003 sensor always returns 0

Hi,

I purchased a PMS5003 Adafruit PM2.5 sensor and I have it wired up on my Arduino. I followed code straight from Adafruit and wired as instructed. I can connect to the sensor and get the expected fromatted output. However, every output is 0, which it shouldn’t be. I have had this less than a week and there has been no damage to it whatsoever.

Am I entitled to a replacement under warranty or what are my options?

Thanks,
Jack

The best option is to find out why you are only getting zeroes. What model of Arduino are you using, and are you using hardware serial or software serial? Can you provide a link to the site for the tutorial you are following, to be sure that everyone is on the same page. Also, a picture of your setup, showing the wiring (you may have to put it on an image site if your security level does not allow posting images). What is the source of particulate material?

2 Likes

Model: Arduino Uno WiFi Rev2

I can’t even seem to get the all zeroes from yesterday, but it’s not working at all so:

Option 1:

Using software serial and following the instructions from https://cdn-learn.adafruit.com/downloads/pdf/pm25-air-quality-sensor.pdf
Wired:

Code:

/* Test sketch for Adafruit PM2.5 sensor with UART or I2C */
#include "Adafruit_PM25AQI.h"
// If your PM2.5 is UART only, for UNO and others (without hardware serial)
// we must use software serial...
// pin #2 is IN from sensor (TX pin on sensor), leave pin #3 disconnected
// comment these two lines if using hardware serial
#include <SoftwareSerial.h>
SoftwareSerial pmSerial(2, 3);
Adafruit_PM25AQI aqi = Adafruit_PM25AQI();

void setup() {
  // Wait for serial monitor to open
  Serial.begin(115200);

  while (!Serial) delay(10);

  Serial.println("Adafruit PMSA003I Air Quality Sensor");
  // Wait one second for sensor to boot up!
  delay(1000);
  // If using serial, initialize it and set baudrate before starting!
  // Uncomment one of the following
  //Serial1.begin(9600);
  pmSerial.begin(9600);
  // There are 3 options for connectivity!
  //if (! aqi.begin_I2C()) { // connect to the sensor over I2C
  //if (! aqi.begin_UART(&Serial1)) { // connect to the sensor over hardware serial
  if (! aqi.begin_UART(&pmSerial)) { // connect to the sensor over software serial
    Serial.println("Could not find PM 2.5 sensor!");
    while (1) delay(10);
  }
  Serial.println("PM25 found!");
}

void loop() {
  PM25_AQI_Data data;
  if (! aqi.read(&data)) {
    Serial.println("Could not read from AQI");
    delay(500); // try again in a bit!
    return;
  }
  Serial.println("AQI reading success");
  Serial.println();
  Serial.println(F("---------------------------------------"));
  Serial.println(F("Concentration Units (standard)"));
  Serial.println(F("---------------------------------------"));
  Serial.print(F("PM 1.0: ")); Serial.print(data.pm10_standard);
  Serial.print(F("\t\tPM 2.5: ")); Serial.print(data.pm25_standard);
  Serial.print(F("\t\tPM 10: ")); Serial.println(data.pm100_standard);
  Serial.println(F("Concentration Units (environmental)"));
  Serial.println(F("---------------------------------------"));
  Serial.print(F("PM 1.0: ")); Serial.print(data.pm10_env);
  Serial.print(F("\t\tPM 2.5: ")); Serial.print(data.pm25_env);
  Serial.print(F("\t\tPM 10: ")); Serial.println(data.pm100_env);
  Serial.println(F("---------------------------------------"));
  Serial.print(F("Particles > 0.3um / 0.1L air:"));
  Serial.println(data.particles_03um);
  Serial.print(F("Particles > 0.5um / 0.1L air:"));
  Serial.println(data.particles_05um);
  Serial.print(F("Particles > 1.0um / 0.1L air:"));
  Serial.println(data.particles_10um);
  Serial.print(F("Particles > 2.5um / 0.1L air:"));
  Serial.println(data.particles_25um);
  Serial.print(F("Particles > 5.0um / 0.1L air:"));
  Serial.println(data.particles_50um);
  Serial.print(F("Particles > 10 um / 0.1L air:"));
  Serial.println(data.particles_100um);
  Serial.println(F("---------------------------------------"));
  delay(1000);
}

The output of this config is:

Adafruit PMSA003I Air Quality Sensor
PM25 found!
Could not read from AQI
Could not read from AQI

Note:
There is 4.87 V between Vcc and ground and 3.30 V between TXD and ground.

Option 2:

Using software serial and following the guide from Interfacing PMS5003 PM2.5 Air Quality Sensor with Arduino
Wired:

Code:
copy and pasted straight from the how2electronics link, not changed at all.

The output of this config is:

Checksum failure
Checksum failure
Checksum failure

Note:
There is 4.87 V between Vcc and ground and 3.30 V between TXD and ground.

For option 1, check that you are connected to the device at Arduino pin 2. From the image it appears that it might be pin 1. Of course, that would not explain how you can get the '… found!" message if you are using the wrong pin, but perhaps the device checking code is a bit too simplistic. Otherwise I can’t see anything obvious - the code modifications required for that particular setup appear OK.

For option 2, comment out the checksum check

 if (sum != data.checksum) {
    Serial.println("Checksum failure");
    return false;
  }

and see what the results look like. If it’s anything other than all zeros that might give some clues.

I have only used the UNO WiFi Rev 2 in very simple cases, but I am aware that it is very different internally from the UNO. It is not listed under the Arduino AVR boards heading in the the boards list, so it is important to confirm that you have selected it from the Arduino megaAVR boards sub-menu. Even with the correct board selected it is possible that the library is not compatible, so, if possible, it would be worthwhile trying the device with a simple UNO.

How are you powering that proto board. You have not shown this.
In any case no matter if you have powered it externally you still have to connect the Arduino ground to this external negative which you don’t appear to have done.
Try that.
Cheers Bob

2 Likes

Option 1, I checked and the line is to pin 2, not 1.
Option 2, I commented out that section and now it returns correct format, but EVERY value is 0.
And I don’t have a regular uno to test on.

Hi Bob,
The breadboard is powered with this supply I have, which has a lead running to a powerpoint. It is currently outputting 5V:

The arduino is currently powered by a usb 2.0 from my computer to a serial? connection. I intend to remove this later and connect 5V from my power supply to the board’s Vin pin. I also connected it to the external ground (breadboard negative supply column). This fixed the infinite Checksum, so now I’m back to all zero readings:

Output:

Concentration Units (standard)

PM 1.0: 0 PM 2.5: 0 PM 10: 0


Concentration Units (environmental)

PM 1.0: 0 PM 2.5: 0 PM 10: 0


Particles > 0.3um / 0.1L air:0

Particles > 0.5um / 0.1L air:0

Particles > 1.0um / 0.1L air:0

Particles > 2.5um / 0.1L air:0

Particles > 5.0um / 0.1L air:0

Particles > 10.0 um / 0.1L air:0


Hi Jack
I note that you now have a yellow wire connected to Arduino ground. I assume this now goes to proto board negative. That is a start. It has been stressed many times on this forum that ALL grounds MUST be connected. This is basic anyway.
As an aside I personally hate and am definitely not a fan of these single ended common ground communications systems. Much prefer everything in pairs. Has proven to be less trouble. OK I suppose for small systems as with Arduino or similar but in a large system can become a nightmare.

I think you should have a read or re read of the Arduino supply requirements. I could be wrong (and I will leave you to do your own research) but I think the Vin pin expects something north of about 7.5V and is regulated to 5V by the on board regulator. I believe it is connected directly to that DC input connector. Once again do your own check. If you are supplying 5V to the Arduino do it via the 5V pin. This is both 5V in and out. Bypasses the regulator.

One other thing to check. Are the data lines both 5V or 3.3V. I have the Freetronics version of the UNO and it is 5V data. I don’t know what the sensor you are using is but if 3.3V you will need logic level converters to communicate. Once again research.

I am not being critical here (except in a constructive sense) but you would be well advised that in the future do this research before connecting the first wire. Less smoke that way.
Cheers Bob
Edit. Just found this in a data sheet.

Seems to indicate 3.3V. You will need to check for sure. If your Arduino is 5V you will need logic level converters.

1 Like

Hi Jack
There is an article on interfacing this sensor with Arduino that I just found and it seems to be the same as the one you linked.
Interestingly it does not use any logic level converters. It does not seem to mind the 5V Arduino logic but chances are the UNO might not respond to the 3.3V logic coming from the sensor. Worth looking into.
Cheers Bob

I think it might be a sensor issue. Like it has a fan but I’ve never heard it spin. Also, how would a logic converter work here where the sensor outputs data via serial?
Cheers Jack

The fan should be spinning. It is the movement of the particles that enables to detector to identify the particle size. Either the sensor is faulty or there is a problem with power getting to it. If it is simply a faulty fan then that could result in returning only zeroes. .You could check that by actually blowing your particles through it rather than assuming they will be drawn in.

A level converter is not needed - 3.3v devices will output logic levels that are compatible with 5v devices. The reverse is not true, but your communication is one-way only.

Hi Jack

You may not hear it. Some of these small fans are very quiet, you will probably have to sight it or hold a strip of light tissue paper to it and observe. It won’t be a great rush of air but you should see something.
Cheers Bob

Hi Jack,

Since you’ve ruled out ground issues, and comms are being established but no readings are coming back, I’d say it’d be safe to say this is a faulty unit.

Reply to your order email or send us an email (address on our contact page) and we’ll kick off the RMA process.

See you over there,
-James

1 Like