How to connect PMS5003 breakout board w/ Arduino UNO?

Hello!

I am attempting to connect the PMS5003 air particle sensor with an Arduino UNO using the breakout board. https://shop.pimoroni.com/products/particulate-matter-sensor-breakout

Problem is: I’m not sure how to connect it?

I connected the TX and RX pins to the 0(RX) and 1(TX) pins of the UNO (TX to RX, and RX to TX) but nothing is show up in the Serial monitor.

I have connected the 5V and GND.

Pls help!
Jason

I’m “guessing” you also have to do something with the EN enable pin.

Hi alphanumeric:

I tried to put the EN pin into GPIO 6, then I did:

pinMode(6,OUTPUT);
digitalWrite(6,HIGH);

in the setup() as a way to initialize the unit, but I’m not reading anything from the Serial monitor.

I have the TX and RX pins of the breakout board connected to the Arduino’s 3 and 4 (RX and TX for Software Serial).

Try pulling that EN pin low.

Found this on the product page

  • 5V to 5V
  • GND to ground
  • TX to BCM 14
  • RX to BCM 15
  • RESET to BCM 27
  • EN to BCM 22
    And this all.py file on it’s github page, link at bottom.
#!/usr/bin/env python

from pms5003 import PMS5003

print("""all.py - Continously print all data values.
Press Ctrl+C to exit!
""")


# Configure the PMS5003 for Enviro+
pms5003 = PMS5003(
    device='/dev/ttyAMA0',
    baudrate=9600,
    pin_enable=22,
    pin_reset=27
)

try:
    while True:
        data = pms5003.read()
        print(data)

except KeyboardInterrupt:
    pass

I saw that also.
Unfortunately that’s the pin connection for a Raspberry Pi, not an Arduino UNO.

Right now I’ve connected them to UNO pins 2,3 using <SoftwareSerial.h> and I’m using a PMS library (https://github.com/fu-hsi/pms) but I still haven’t managed to read anything from the PMS5003.

Also: I did try to digitalWrite(7, LOW) the EN pin, and nothing. Thanks for the suggestion.

My current code, using PMS library:

#include <PMS.h>
#include <SoftwareSerial.h>

SoftwareSerial Serial1(2,3);

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)

  pinMode(7,OUTPUT);
  digitalWrite(7,LOW);

}

void loop() {
  
  if (pms.read(data))  {
    
    Serial.print("reading 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...
}

Sure, but it shows you how the pins need set up for a functioning system.

Reading things back, the datasheet says that the fan needs 5V but the IO lines are 3v3 and should be level shifted. The Uno has 5V IO if I remember right. It’s possible that the PMS5003 doesn’t appreciate that.

Hey Shoe:

On level shifting: I assume that’s what the pimoroni breakout board does? Otherwise I’m not sure it would make sense, since it was designed to interface a 3.3V device with tiny wires with a 5V device with larger wires.

On pins, you write:

it shows you how the pins need set up for a functioning system

From what I’ve googled, BCM 14 and 15 basically correspond to UART pins on a Raspberry Pi. Using Arduino <SoftwareSerial.h>, I am basically turning Arduino pins 2,3 into UART pins. So I suppose that part is covered theoretically, but still, nothing is working.

My current code:

#include "PMS.h"
#include <SoftwareSerial.h>

SoftwareSerial pmsSerial(2, 3);

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

void setup()
{
  Serial.begin(115200);   
  pmsSerial.begin(9600);  
}

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

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

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

    Serial.println();
  }

  // Do other stuff...
}

My current setup:
Sensor TX → Arduino PIN 2
Sensor RX → Arduino PIN 3
5V to 5V, GND to GND
Reset and EN pin not plugged in

Level shifting is done when you have different logic levels between two devices.
The Raspberry Pi uses 3.3V logic. 3.3V is a high or logic 1. Ground is a logic 0
The Arduino Uno uses 5V logic, 5V is a high or logic 1, Ground is a logic 0.
If you feed 5V logic into a Pi it will damage it.
Feeding 3.3V logic levels into something looking for 5V can have it not work correctly.
You may have to use something like this between the breakout and the UNO.

Hey Alphanumeric:

I just did the level shifting because it’s a fair point. But still no results.

Breakout Board TX->LV1->HV1->Uno 2 (software serial RX)
Breakout Board RX->LV1->HV1->Uno 3 (software serial TX)
LV attached to 3.3V
HV attached to 5V
All GND together

Looking at the board the only component it has is a capacitor between 5V and GND, so no level shifting. Most of the more modern Arduino or Arduino-compatible boards run on 3v3 IO, with a VUSB pin which would be 5V.

The datasheet shows that the default baudrate is 9600.

Hey Shoe: thanks for all these replies.

The datasheet shows that the default baudrate is 9600.

The Serial.begin(115200) baudrate is for the Serial Monitor.
It’s the pmsSerial.begin(9600) the interfaces with the PMS5003

Looking at the board the only component it has is a capacitor between 5V and GND, so no level shifting

Understood.

Hah, sorry, not sure how I missed that.

Unfortunately I can’t think of anything else besides 5V on the IO lines may have damaged it.

Grounds connected on both sides of the level shifter?
And the ground on the UNO wired to the ground on the breakout?
Ops never mind, I missed the all grounds together in your other post.

Yeah, my MKR1000 is 3.3V logic, and my UNO’s are 5V logic. I make it a point to try and remember that, especially if there is a Raspberry Pi in the mix.

You have probably long since solved this problem. The TX on this breakout board connects to TX and the RX connects to RX!!! The designer probably wanted to make it simple for people like me.

I got your problem on an RPi Zero 2 WH but the reason for that was that I had installed the Enviro+ board and its software on this Pi. When I performed the Pimoroni instructions on another Pi that didn’t have the Enviroplus software on it, it worked fine.