Hi! I am trying to build a small dust detection project with Arduino Nano 33 IoT and the PMS7003 Sensor. The problem is that the sensor is not sending any data to Arduino (Uart serial receiving small random numbers, that are just some noise probaby, cause when there's nothing plugged in, the results are the same).
Here is my build:
Here is the code:
#include "PMS.h"
#include <Arduino.h>
#include "wiring_private.h"
Uart mySerial (&sercom0, 5, 6, SERCOM_RX_PAD_1, UART_TX_PAD_0);
void SERCOM0_Handler()
{
mySerial.IrqHandler();
}
PMS pms(mySerial);
PMS::DATA data2;
void setup() {
mySerial.begin(9600);
delay(2000);
pinPeripheral(5, PIO_SERCOM_ALT);
pinPeripheral(6, PIO_SERCOM_ALT);
Serial.begin(9600);
delay(2000);
Serial.print("Testing the dust sensor");
delay(2000);
pms.activeMode();
pms.wakeUp();
}
void loop() {
pms.requestRead();
Serial.print("PM 1 level : ");
Serial.println(data2.PM_AE_UG_1_0);
Serial.print("PM 2,5 level: ");
Serial.println(data2.PM_AE_UG_2_5);
Serial.print("PM 10 level : ");
Serial.println(data2.PM_AE_UG_10_0);
Serial.print("READ : ");
Serial.println(mySerial.read());
delay(2000);
}
And the results I am getting:
20:17:41.469 -> PM 1 level : 0
20:17:41.469 -> PM 2,5 level: 0
20:17:41.469 -> PM 10 level : 0
20:17:41.469 -> READ : 0
20:17:43.479 -> PM 1 level : 0
20:17:43.479 -> PM 2,5 level: 0
20:17:43.479 -> PM 10 level : 0
20:17:43.479 -> READ : 151
20:17:45.483 -> PM 1 level : 0
20:17:45.483 -> PM 2,5 level: 0
20:17:45.483 -> PM 10 level : 0
20:17:45.483 -> READ : 0