Problme reading serial output of pms5003 dust sensor

having some problems reading the serial output from a pms5003 dust sensor. i always find the two start characters for the output, but then either the checksum fails, or if it passes, the numbers are typically zeros, or very near to. i have tried using a nano v3 with softwareserial, and a pro micro with a physical serial port and had the same results. i am powering everything with external power and using the appropriate line level converter. voltages all check out.

the fact that i do read the start periodically characters makes me believe my wiring is ok. manual can be found here:

Code:

/*
   PMS5003 Pinout
   Pin 1 from inside. Pin 8 on the outside. 8-pin connector (1.25mm raster).
   Pin Function      Description                     Remarks
   1   VCC           Supply voltage 5V              4.5 – 5.5V
   2   GND           Ground
   3   SET           HIGH or SUSPENDED – work mode
                     LOW – sleep mode               3.3V logic
   4   RXD           UART/TTL data recieve          3.3V logic
   5   TXD           UART/TTL data transmit         3.3V logic
   6   Reset         LOW to reset                   3.3V logic
   7   NC            Not connected
   8   NC            Not connected

PMS5003 transport protocol-Active Mode
Default baud rate:9600bps Check bit:None Stop bit:1 bit
32 Bytes
Start character 1 0x42 (Fixed)
Start character 2 0x4d (Fixed)
Frame length high 8 bits Frame length=2x13+2(data+check bytes)
Frame length low 8 bits
Data1 high 8 bits …… Data1 refers to PM1.0 concentration unit μ g/m3(CF=1,standard particle)*
Data1 low 8 bits ……
Data2 high 8 bits …… Data2 refers to PM2.5 concentration unit μ g/m3(CF=1,standard particle)
Data2 low 8 bits ……
Data3 high 8 bits …… Data3 refers to PM10 concentration unit μ g/m3(CF=1,standard particle)
Data3 low 8 bits ……
Data4 high 8 bits …… Data4 refers to PM1.0 concentration unit μ g/m3(under atmospheric environment)
Data4 low 8 bits ……
Data5 high 8 bits …… Data 5 refers to PM2.5 concentration unit μ g/m3(under atmospheric environment)
Data5 low 8 bits ……
Data6 high 8 bits …… Data 6 refers to PM10 concentration unit (under atmospheric environment) μ g/m3 
Data6 low 8 bits ……

*/

// Pins setup
const int SLEEP_PIN = 6; // this pin is for setting the sensor to sleep while it is not taking the data.

#define LENG 31   //0x42 + 31 bytes equal to 32 bytes
unsigned char buf[LENG];  //serial read buffer

int PM01Value = 0;        //define PM1.0 value of the air detector module
int PM2_5Value = 0;       //define PM2.5 value of the air detector module
int PM10Value = 0;       //define PM10 value of the air detector module

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  //mySerial.setTimeout(1500);
  pinMode(SLEEP_PIN, OUTPUT); // Setup Pin as output pin
  digitalWrite(SLEEP_PIN, HIGH); // Let the sensor start working as default
  Serial.println("Setup Complete!");
}

void loop()
{
  if (mySerial.find(0x42)) {  //start to read when detect 0x42
    mySerial.readBytes(buf, LENG);
    Serial.println("Reading Sensor...");
    if (buf[0] == 0x4d) {
      if (checkValue(buf, LENG)) {
        /*PM01Value = (buf[9] << 8) + buf[10];
        PM2_5Value = (buf[11] << 8) + buf[12];
        PM10Value = (buf[13] << 8) + buf[14];*/
        PM01Value = (buf[3] << 8) + buf[4];
        PM2_5Value = (buf[5] << 8) + buf[6];
        PM10Value = (buf[7] << 8) + buf[8];
        for (int i = 3; i <= 14; i++) {
          Serial.print(i); Serial.print(": "); Serial.println(buf[i], HEX);
        }
        Serial.print("PM   1: ");
        Serial.print(PM01Value);
        Serial.println("  ug/m3");

        Serial.print("PM 2.5: ");
        Serial.print(PM2_5Value);
        Serial.println("  ug/m3");

        Serial.print("PM  10: ");
        Serial.print(PM10Value);
        Serial.println("  ug/m3");
      }
      else Serial.println("Read check failed");
    }
    else Serial.println("Init char not found");
    Serial.println();
    delay (3000);
  }

}
char checkValue(unsigned char *thebuf, char leng)
{
  char receiveflag = 0;
  int receiveSum = 0;

  for (int i = 0; i < (leng - 2); i++) {
    receiveSum = receiveSum + thebuf[i];
  }
  receiveSum = receiveSum + 0x42;

  if (receiveSum == ((thebuf[leng - 2] << 8) + thebuf[leng - 1])) //check the serial data
  {
    receiveSum = 0;
    receiveflag = 1;
  }
  return receiveflag;
}

Some typical Serial Output

Reading Sensor...
Read check failed

Reading Sensor...
3: 0
4: 0
5: 0
6: 1
7: 0
8: 1
9: 0
10: 0
11: 0
12: 1
13: 0
14: 1
PM   1: 0  ug/m3
PM 2.5: 1  ug/m3
PM  10: 1  ug/m3

Reading Sensor...
Init char not found

Any thoughts?

Are you able to hook it up to a PC and check the data through a terminal program?

MK1888:
Are you able to hook it up to a PC and check the data through a terminal program?

i do actually, i hadn't though of doing that though. I'll give it a try!

MK1888:
Are you able to hook it up to a PC and check the data through a terminal program?

same result, the start characters come through (42 and 4D), then mostly just a bunch of zeros. the first two characters after the start are for the checksum, then the next 6 are for dust readings, two for each particle size. pretty sure my room isn't dust free!

here is a sample:

42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 00 0E 00 02 00 00 
00 00 00 00 93 00 01 78 42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 
00 2A 00 0E 00 02 00 00 00 00 00 00 93 00 01 78 42 4D 00 1C 00 00 00 00 
00 00 00 00 00 00 00 00 00 2A 00 0E 00 02 00 00 00 00 00 00 93 00 01 78 
42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 00 0E 00 02 00 00 
00 00 00 00 93 00 01 78 42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 
00 2A 00 0E 00 02 00 00 00 00 00 00 93 00 01 78 42 4D 00 1C 00 00 00 00 
00 00 00 00 00 00 00 00 00 2A 00 0E 00 02 00 00 00 00 00 00 93 00 01 78 
42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 2A 00 0E 00 02 00 00

Are you waiting long enough after powerup? It might need a few minutes to acquire data. Also, try a different location (different room, or even outside) to see if the numbers change.

Failing that, if you can't get it to work properly by itself this might require an email to the manufacturer.

waited long enough for it to give reading, the manual says it only needs 30 seconds and it was at least 5 minutes when i grabbed the sample data. i haven't wandered around the house, im plugged into my tower and the was (for 5v power). standard dust levels for an average house are much higher than that though and give how dusty my tower is when i clean it every so often, i definitely have dust!

bump it up!!

i have a new sensor and getting some reasonable numbers. values sit at pretty much 0, but the sensor responds to a lighter so it seems to work. but now I have a new problem, the arduino (and i tried two of them), a nano using software serial, and a pro mini using a physical serial port. the problem is that the arduino wont read the whole frame (although using realterm with a usb/serial port adapter works perfect, so its not the sensor. given the excess of checksum errors, i set out to replicate the real term output to debug my comms issue, here is the code:

char readchar;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial1.begin(9600);
  pinMode(6, OUTPUT); // Setup Pin as output pin
  digitalWrite(6, HIGH); // Let the sensor start working as default
  Serial.println("Setup Complete!");
}

void loop() {
  // put your main code here, to run repeatedly:
  readchar = Serial1.read();
  if (readchar == 0x42) Serial.println(); //init char for frame
  if (readchar != -1) Serial.print(readchar, HEX);
  Serial.print(" ");

  delay(10);
}

and here is sample of the output (there are actually two init chars, but I'm only checking for one, hence why 42 sometimes stands by itself, and not an issue):

42 4D 0 1C 0 2 0 3 0 3 0 2 0 3 0 3 1 7A 0 7A 0 12 0 4 0 0 0 0 FFFFFF91 2 2 59                                                            
42 4D 0 1C 0 1 0 3 0 3 0 1 0 3 0 3 1 7A 0 78 0 14 0 6 0 0 0 0 FFFFFF91 2 2 59                                                    
42 4D 0 1C 0 1 0 3 0 3 0 1 0 3 0 3 1 7A 0 78 0 14 0 6 0 0 0 0 FFFFFF91 2 2 59                                                    
42 4D 0 1C 0 1 0 3 0 3 0 1 0 3 0 3 1 7A 0 78 0 14 0 6 0 0 0 0 FFFFFF91 2 2 59                                                           
42 4D 0 1C 0 1 0 3 0 3 0 1 0 3 0 3 1 68 0 6F 0 18 0 6 0 0 0 0 FFFFFF91 2 2 
42                                                    
42 4D 0 1C 0 1 0 3 0 3 0 1 0 3 0 3 1 68 0 6F 0 18 0 6 0 0 0 0 FFFFFF91 2 2 
42                                                    
42 4D 0 1C 0 1 0 3 0 3 0 1 0 3 0 3 1 68 0 6F 0 18 0 6 0 0 0 0 FFFFFF91 2 2 
42                                                           
42 4D 0 1C 0 2 0 4 0 4 0 2 0 4 0 4 1 FFFFFFAA 0 FFFFFF81 0 1C 0 6 0 0 0 0 FFFFFF91 2 2 FFFFFFA0                                                    
42 4D 0 1C 0 2 0 4 0 4 0 2 0 4 0 4 1 FFFFFFAA 0 FFFFFF81 0 1C 0 6 0 0 0 0 FFFFFF91 2 2 FFFFFFA0                                                    
42 4D 0 1C 0 2 0 4 0 4 0 2 0 4 0 4 1 FFFFFFAA 0 FFFFFF81 0 1C 0 6 0 0 0 0 FFFFFF91 2 2 FFFFFFA0                                                           
42 4D 0 1C 0 2 0 4 0 4 0 2 0 4 0 4 1 FFFFFFA1 0 7E 0 1C 0 6 0 0 0 0 FFFFFF91 2 2 FFFFFF94                                                    
42 4D 0 1C 0 2 0 4 0 4 0 2 0 4 0 4 1 FFFFFFA1 0 7E 0 1C 0 6 0 0 0 0 FFFFFF91 2 2 FFFFFF94                                                     
42 4D 0 1C 0 2 0 4 0 4 0 2 0 4 0 4 1 FFFFFFA1 0 7E 0 1C 0 6 0 0 0 0 FFFFFF91 2 2 FFFFFF94                                                           
42 4D 0 1C 0 1 0 4 0 5 0 1 0 4 0 5 1 FFFFFFAD 0 FFFFFF80 0 1C 0 8 0 2 0 0 FFFFFF91 2 2 FFFFFFA6

sample code from realterm with the sensor connected via a usb/serial adapter is as follows:

42 4D 00 1C 00 01 00 01 00 02 00 01 00 01 00 02 01 23 00 54 00 08 00 01 00 01 00 01 93 00 01 C9 
42 4D 00 1C 00 01 00 01 00 02 00 01 00 01 00 02 01 23 00 54 00 08 00 01 00 01 00 01 93 00 01 C9 
42 4D 00 1C 00 00 00 00 00 01 00 00 00 00 00 01 01 23 00 54 00 07 00 01 00 01 00 01 93 00 01 C2 
42 4D 00 1C 00 00 00 00 00 01 00 00 00 00 00 01 01 23 00 54 00 07 00 01 00 01 00 01 93 00 01 C2 
42 4D 00 1C 00 00 00 00 00 01 00 00 00 00 00 01 01 23 00 54 00 07 00 01 00 01 00 01 93 00 01 C2 
42 4D 00 1C 00 00 00 00 00 01 00 00 00 00 00 01 01 23 00 54 00 06 00 01 00 01 00 01 93 00 01 C1 
42 4D 00 1C 00 00 00 00 00 01 00 00 00 00 00 01 01 23 00 54 00 06 00 01 00 01 00 01 93 00 01 C1 
42 4D 00 1C 00 00 00 00 00 01 00 00 00 00 00 01 01 23 00 54 00 06 00 01 00 01 00 01 93 00 01 C1 
42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 01 17 00 4F 00 04 00 01 00 00 00 00 93 00 01 AA 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 17 00 4F 00 04 00 01 00 00 00 00 93 00 01 B0 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 17 00 4F 00 04 00 01 00 00 00 00 93 00 01 B0 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 32 00 56 00 05 00 01 00 00 00 00 93 00 01 D3 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 32 00 56 00 05 00 01 00 00 00 00 93 00 01 D3 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 32 00 56 00 05 00 01 00 00 00 00 93 00 01 D3 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 44 00 5B 00 04 00 01 00 00 00 00 93 00 01 E9 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 44 00 5B 00 04 00 01 00 00 00 00 93 00 01 E9 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 44 00 5B 00 04 00 01 00 00 00 00 93 00 01 E9 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 5F 00 64 00 04 00 01 00 00 00 00 93 00 02 0D 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 5F 00 64 00 04 00 01 00 00 00 00 93 00 02 0D 
42 4D 00 1C 00 01 00 01 00 01 00 01 00 01 00 01 01 5F 00 64 00 04 00 01 00 00 00 00 93 00 02 0D 
42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 01 6E 00 66 00 04 00 01 00 00 00 00 93 00 02 18 
42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 01 6E 00 66 00 04 00 01 00 00 00 00 93 00 02 18 
42 4D 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 01 6E 00 66 00 04 00 01 00 00 00 00 93 00 02 18

without delay and checking for -1 in the code, i get piles of FFFFFFFF in the output, and even with those, I'm still getting output with 6 Fs on the front, which appears to be the issue. I don't quite understand whats happening, it took a bit to get down to where I am, where it seems I'm reading too fast and getting garbage.

Thoughts?

one step closer, figured i should be using byte instead of char. added some checksum code and it works every time, for whatever reason i get get it in the main code for the sensor

byte readchar;
int recieveSum = 0;
int checkSum = 0;
int counter = 0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial1.begin(9600);
  pinMode(6, OUTPUT); // Setup Pin as output pin
  digitalWrite(6, HIGH); // Let the sensor start working as default
  Serial.println("Setup Complete!");
}

void loop() {
  // put your main code here, to run repeatedly:
  readchar = Serial1.read();
  if (readchar == 0x42) {
    Serial.println();
    recieveSum = 0;
    counter = 0;
  }
  if (readchar != 0xFF) Serial.print(readchar, HEX); //0xff occurs between frames and doesn't impact sums
  //Serial.print(readchar, HEX);
  if (counter < 30) recieveSum = recieveSum + readchar;
  if (counter == 30) checkSum = readchar;
  if (counter == 31) {
    checkSum = (checkSum << 8) + readchar;
    Serial.print(" CheckSum: "); Serial.print(recieveSum); Serial.print(" "); Serial.print(checkSum);
  }
  counter++;
  Serial.print(" ");
  delay(10);
}
2 4D 0 1C 0 0 0 0 0 2 0 0 0 0 0 2 1 9B 0 78 0 8 0 2 0 2 0 2 91 2 2 64 CheckSum: 612 612                                                    
42 4D 0 1C 0 1 0 1 0 3 0 1 0 1 0 3 1 9B 0 78 0 8 0 2 0 2 0 2 91 2 2 6A CheckSum: 618 618                                                    
42 4D 0 1C 0 1 0 1 0 3 0 1 0 1 0 3 1 9B 0 78 0 8 0 2 0 2 0 2 91 2 2 6A CheckSum: 618 618                                                          
42 4D 0 1C 0 1 0 1 0 3 0 1 0 1 0 3 1 74 0 6B 0 6 0 2 0 2 0 2 91 2 2 34 CheckSum: 564 564                                                    
42 4D 0 1C 0 1 0 1 0 3 0 1 0 1 0 3 1 74 0 6B 0 6 0 2 0 2 0 2 91 2 2 34 CheckSum: 564 564                                                    
42 4D 0 1C 0 1 0 1 0 3 0 1 0 1 0 3 1 74 0 6B 0 6 0 2 0 2 0 2 91 2 2 34 CheckSum: 564 564                                                           
42 4D 0 1C 0 1 0 1 0 3 0 1 0 1 0 3 1 74 0 67 0 6 0 2 0 2 0 2 91 2 2 30 CheckSum: 560 560                                                    
42 4D 0 1C 0 1 0 1 0 3 0 1 0 1 0 3 1 74 0 67 0 6 0 2 0 2 0 2 91 2 2 30 CheckSum: 560 560                                                    
42 4D 0 1C 0 1 0 1 0 3 0 1 0 1 0 3 1 74 0 67 0 6 0 2 0 2 0 2 91 2 2 30 CheckSum: 560 560                                                           
42 4D 0 1C 0 1 0 1 0 1 0 1 0 1 0 1 1 7A 0 67 0 6 0 0 0 0 0 0 91 2 2 2C CheckSum: 556 556                                                    
42 4D 0 1C 0 1 0 1 0 1 0 1 0 1 0 1 1 7A 0 67 0 6 0 0 0 0 0 0 91 2 2 2C CheckSum: 556 556                                                    
42 4D 0 1C 0 1 0 1 0 1 0 1 0 1 0 1 1 7A 0 67 0 6 0 0 0 0 0 0 91 2 2 2C CheckSum: 556 556                                                          
42 4D 0 1C 0 0 0 1 0 1 0 0 0 1 0 1 1 74 0 67 0 8 0 2 0 0 0 0 91 2 2 28 CheckSum: 552 552                                                    
42 4D 0 1C 0 0 0 1 0 1 0 0 0 1 0 1 1 74 0 67 0 8 0 2 0 0 0 0 91 2 2 28 CheckSum: 552 552                                                    
42 4D 0 1C 0 0 0 1 0 1 0 0 0 1 0 1 1 74 0 67 0 8 0 2 0 0 0 0 91 2 2 28 CheckSum: 552 552                                                           
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 5C 0 60 0 8 0 2 0 0 0 0 91 2 2 F CheckSum: 527 527                                                    
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 5C 0 60 0 8 0 2 0 0 0 0 91 2 2 F CheckSum: 527 527                                                    
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 5C 0 60 0 8 0 2 0 0 0 0 91 2 2 F CheckSum: 527 527                                                           
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 5C 0 60 0 8 0 2 0 0 0 0 91 2 2 F CheckSum: 527 527                                                    
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 5C 0 60 0 8 0 2 0 0 0 0 91 2 2 F CheckSum: 527 527                                                    
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 5C 0 60 0 8 0 2 0 0 0 0 91 2 2 F CheckSum: 527 527                                                           
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 68 0 64 0 8 0 2 0 0 0 0 91 2 2 1F CheckSum: 543 543                                                   
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 68 0 64 0 8 0 2 0 0 0 0 91 2 2 1F CheckSum: 543 543                                                    
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 68 0 64 0 8 0 2 0 0 0 0 91 2 2 1F CheckSum: 543 543                                                           
42 4D 0 1C 0 1 0 2 0 2 0 1 0 2 0 2 1 68 0 64 0 A 0 2 0 0 0 0 91 2 2 21 CheckSum: 545 545

well, a bit closer yet…

replaced the delay with while not serial.available which is working well, I still frequently don’t read the full frame (almost always takes two tries), but when I do, the checksum now always work. my test in the post above works fine though. i need to add some timeouts to the read loop, but i want to get it reading right first.

// Pins setup
const int SLEEP_PIN = 6; // this pin is for setting the sensor to sleep while it is not taking the data.

byte buf[26];  //serial read buffer
byte readchar;
int recieveSum = 0;
int checkSum = 0;
int counter = 0;
int counterbuf = 0;

int PM01Value = 0;        //define PM1.0 value of the air detector module
int PM2_5Value = 0;       //define PM2.5 value of the air detector module
int PM10Value = 0;       //define PM10 value of the air detector module

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
  Serial1.setTimeout(1500);
  pinMode(SLEEP_PIN, OUTPUT); // Setup Pin as output pin
  digitalWrite(SLEEP_PIN, HIGH); // Let the sensor start working as default
  Serial.println("Setup Complete!");
}

void loop()
{
  Serial.println("Reading Sensor...");
  while (1) {

    while (!Serial1.available()) { /* Do nothing. Just wait until we have a byte */ }
    readchar = Serial1.read();
    if (readchar == 0x42) { //start reading char if first frame
      Serial.println();
      recieveSum = 0;
      counter = 0;
      counterbuf = 0;
    }
    //if (readchar != 0xFF) Serial.print(readchar, HEX); // FF bytes are between frames, doesn't impact sums
    Serial.print(readchar, HEX);
    if (counter < 30) {
      recieveSum = recieveSum + readchar;
      if (counter > 3) { //first two bytes are for init, 3rd and 4th are for frame size, not needed for data
        buf[counterbuf] = readchar;
        counterbuf++;
      }
    }
    if (counter == 30) checkSum = readchar; //last two bytes of frame are for checksum
    if (counter == 31) {
      checkSum = (checkSum << 8) + readchar;
      Serial.print(" CheckSum: "); Serial.print(recieveSum); Serial.print(" "); Serial.println(checkSum);
      if (checkSum == recieveSum) break;
    }
    counter++;
    Serial.print(" ");
    //delay(5); //cant read to fast, or get garbage
  }

  Serial.println();

  PM01Value = (buf[6] << 8) + buf[7];
  PM2_5Value = (buf[8] << 8) + buf[9];
  PM10Value = (buf[10] << 8) + buf[11];

  Serial.print("PM   1: ");
  Serial.print(PM01Value);
  Serial.println("  ug/m3");

  Serial.print("PM 2.5: ");
  Serial.print(PM2_5Value);
  Serial.println("  ug/m3");

  Serial.print("PM  10: ");
  Serial.print(PM10Value);
  Serial.println("  ug/m3");

  Serial.println();

  delay (3000);
}

output

Reading Sensor...

42 4D 0 
42 4D 0 1C 0 0 0 1 0 1 0 0 0 1 0 1 1 3B 0 63 0 C 0 2 0 0 0 0 91 2 1 EF CheckSum: 495 495

PM   1: 0  ug/m3
PM 2.5: 1  ug/m3
PM  10: 1  ug/m3

Reading Sensor...

42 4D 0 1C 0 0 0 1 0 1 0 0 0 1 0 1 1 3B 0 63 0 C 0 2 0 0 0 0 
42 4D 0 1C 0 0 0 1 0 1 0 0 0 1 0 1 1 4A 0 68 0 C 0 2 0 0 0 0 91 2 2 3 CheckSum: 515 515

PM   1: 0  ug/m3
PM 2.5: 1  ug/m3
PM  10: 1  ug/m3

Reading Sensor...

42 4D 0 
42 4D 0 1C 0 0 0 1 0 1 0 0 0 1 0 1 1 44 0 66 0 C 0 2 0 0 0 0 91 2 1 FB CheckSum: 507 507

PM   1: 0  ug/m3
PM 2.5: 1  ug/m3
PM  10: 1  ug/m3

Follow the guide here. This might solve your problem:

mamtazalam:
Follow the guide here. This might solve your problem:

https://www.how2electronics.com/interfacing-pms5003-pm2-5-air-quality-sensor-with-arduino/

thanks! i did get my code working, but this looks much more efficient and likely better on memory too!