PMS sensor with Arduino MKR 1010

Hi, I am trying to get PM2.5 and PM10 values from a PMS x003 family sensor with an Arduino MKR 1010. I am trying to use the library PMS.h, but the examples don't work.

I tried the "basic" example, and nothing is showing in the serial monitor.

Sensor Pins Arduino Pins
Vcc - 5V
GND - GND
RX - TX (PIN 14)
TX - RX (PIN 13)

#include "PMS.h"

PMS pms(Serial);
PMS::DATA data;

void setup()
{
  Serial.begin(9600);   // GPIO1, GPIO3 (TX/RX pin on ESP-12E Development Board)
  Serial1.begin(9600);  // GPIO2 (D4 pin on ESP-12E Development Board)
}

void loop()
{
  if (pms.read(data))
  {
    Serial1.print("PM 1.0 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_1_0);

    Serial1.print("PM 2.5 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_2_5);

    Serial1.print("PM 10.0 (ug/m3): ");
    Serial1.println(data.PM_AE_UG_10_0);

    Serial1.println();
  }

  // Do other stuff...
}
``````````````````````````````````````

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.