Question: PMS7003 with Arduino MEGA2560

vinushi1995 is asking a question about air-quality
Follow this topic

by vinushi1995 | July 21, 2019 04:12 | #20210


Hello, a first timer here. Thanks in Advance for anyone kind enough to offer me advice.

i have been trying to make an air quality monitor using the Aircasting app. To measure particulate matter i got the PMS7003 Sensor. Does anyone know a proper wiring diagram and a code that works with arduino? I've been trying some codes but have been encountering problems in most of them. This is the latest code i've been using and it seems to be giving values in 100s which is very high

include

SoftwareSerial mySerial(10,11); // Arudino Uno port RX, TX

void setup() {
// for debuging
Serial.begin(115200);

// Use software serial
mySerial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
static int CheckFirst=0;
static int pm_add[3][5]={0,};
static int pm_old[3]={0,};
int chksum=0,res=0;;
unsigned char pms[32]={0,};


if(mySerial.available()>=32)
{

for(int j=0; j<32 ; j++){
pms[j]=mySerial.read();
if(j<30)
chksum+=pms[j];
}

if(pms[30] != (unsigned char)(chksum>>8)
|| pms[31]!= (unsigned char)(chksum) ){


}
if(pms[0]!=0x42 || pms[1]!=0x4d )


Serial.print("Dust raw data debugging : ");
Serial.print("1.0ug/m3:");
Serial.print(pms[10]);
Serial.print(pms[11]);
Serial.print(" ");
Serial.print("2.5ug/m3:");
Serial.print(pms[12]);
Serial.print(pms[13]);
Serial.print(" ");
Serial.print("10ug/m3:");
Serial.print(pms[14]);
Serial.println(pms[15]);
}


delay(2000);}

<br>



3 Comments

Good to see your project. 1. In the code the TX , RX pins mention Board associated as Arduino UNO but you are using Mega. Kindly check the pin connections. RX pin of Board as to be TX pin of PM sensor and same for TX as well.

  1. Links where you can find detailed information 👍 https://publiclab.org/notes/cfastie/11-28-2018/nano-particle-monitoring
  2. This link is from Adafruit. Check for the board and PM sensor variant and modify accordingly. https://learn.adafruit.com/pm25-air-quality-sensor?view=all

Hope this helps.

Is this a question? Click here to post it to the Questions page.

@silentsairam Thank you so much for the advice! I sure will look into it. 😃


Hi @vinushi1995..did you get your project working? I am having a similar problem with the PMS7003. I am using similar code to yours. It does appear to work with the PMS5003 which is similar but a bit larger footprint. But when I use the 7003 with the same code I also am getting values that are 10x-20x larger than expected. Not sure what is causing this as it is claimed that the two sensors are electrically identical and use the same data protocol. Appreciate any thoughts/suggestions from forum members.

Is this a question? Click here to post it to the Questions page.


Reply to this comment...


Log in to comment