PMS5003 -- how to use?


I got my hands on one of these PMS5003 air quality devices that many people seem to be using a lot these days in projects.

I have a Raspberry Pi and a Pi Zero (also an Arduino Uno). I have a bunch of wires (and a breadboard and resistors etc). Also soldering kit. But I’m very unsure how to connect the PMS5003 to my devices. I’m worried that I’ll send power where it shouldn’t go and damage the device.

This is my first time doing an electronics project of this kind. Not really sure where to start. It seems there are a bunch of Python repositories on Github that will make interacting with the sensor not too difficult to manage, but how to get the connection to the device in the first place?

Any advice anyone might have would be greatly appreciated.


You need the pinout for that connector in the picture, for one thing. Or, maybe you have to open it up and harvest the bits you need to wire it up to a Pi? Do you have any links to where somebody else used it?


I’m pretty sure you already know this, but just in case. The Pi’s uses 3V logic level signals. They are not 5V logic tolerant. If you send 5v where it wants 3.3v bad things will happen, you will damage your Pi. There are logic level converters / shifters if the need arises.


Only just noticed your “many people” link. It looks like its 3.3v so it should be safe to use on a Pi. I think I’d use a Pi Zero for first time setup. If you make a mistake your only out ~ 10 bucks, instead of 35 or more. The link you posted shows how to wire it up. Just take your time.
One way to do it would be to solder tack some jumper wires to the connector. Then plug the other end into a solderless bread board. Male to male jumpers would work too.

Male to female jumpers would also work. Plug the male end onto the Pi’s GPIO pins. Then solder tack the male pins to the connector on the unit.


Thanks. I looked at the page more thoroughly and I think I understand what I need to do. I cut off the white block on the end. I stripped the ends of the wires. Now I have this:

Then I have these jumper cables:

so what I’m going to do is solder the ends of the plantower wires to the male end of the jumper cables. There don’t seem to be too many instances where people are doing this judging by youtube videos, so I’m not sure if this is what I’m actually supposed to be doing…

But it seems like this would work?


If you take a pin or a needle, and lift the little tab on the shell that’s on the male pins. it will slide off. If your careful you can do it without damaging the shells. If you don’t remove them they will likely melt when you solder the wires on. ;)
Do you have any heat shrink tubing? If yes, after you remove the shells from the male ends of the jumpers, slid a piece over the wire before you solder it. Then slide it back and shrink it over your bare wire solder point. Otherwise I would tape over your solder point so they can’t short out with each other.
If you twirl the bare ends of the wires so all the strands are in a tight spiral, it will make it easy to tin them with solder. I’d tin them first, then solder on the male end of the jumpers.
If you already know all this just ignore my rambling. Its hard to know sometimes what people know and don’t know about soldering etc. ;)


This is all really helpful! I don’t have any heat shrink tubing, but that seems like it would have been useful. I will remove the ends of the pins.

The one thing I didn’t understand was your terminology. You make a distinction between ‘tinning’ the wires vs soldering. What is the difference?

This is what I understand from what you wrote:

I should take off the Dupont thingys by using a pin/needle. Then I’ll have the male end of the wires exposed.
I should then intertwine the two ends and twist together.
Then I should put a bit of solder across the joined wires (? tinning?). Then I should do that again using a bit more solder?



Tinning is just touching your soldering iron to the bare end of the wire, and adding a little solder to it. The solder flows covering the wire with a thin layer. It makes it easier to solder two wires together. Or solder the wire to something else. I usually tin both ends of what ever I’m soldering together. If you put enough solder on the end, all you’ll need to do is re melt it to tack your wires together. You don’t need gobs of solder just enough to cover the wire nicely. It can be tricky trying to hold and iron, your solder, and what your soldering. ;)


I would also keep the bare ends of the striped wires as short as possible. An 1/8 or 1/4 of an inch of bare wire at the end should be all you need to solder your jumper wires too. It will make covering them with tape after easier.


Ok. So, wires are soldered together. I connected everything as per the diagram here. I cloned the program/repository mentioned in the notes. I run the file as suggested and I get nothing.

I tried changing line 91 as the Hackstr guide suggests, but that does nothing. I ran this as well:

I’m not sure if that’s the right thing to be checking? But it seems like there are no inputs on the GPIO / serial pins?

Any tips on how to move forward? I can either persevere with this code? Or try a different bit of code? Or try to write my own code? Not sure how I’d do any of these…


What pins / interface on the Pi are you using for communication? i2c are pins 3 & 5. Serial (UART) is pins 8 & 10.


i2c detect will only detect i2c devices (addresses). As far as I know that won’t show serial devices, that’s a different interface. I think you need to go into Raspberry Pi configuration and enable SPI? I think?


I’ve plugged it in as per the drawing in the Hackstr article. I’ve followed this exactly.


That’s the UART connection. Did you do the “enabling serial” part of the tutorial?

Pin 8 is TX Data and Pin 10 is RX data.


I did the enabling serial part of the tutorial.

Is there a manual way to read what’s being read from the serial input? I.e. from pin 8 and 10?


The thing I don’t understand is that this refers to /dev/ttyS0 etc etc. I don’t have those in my file system. Which I guess implies that the serial connection hasn’t been made?


Finally! Got it to work.

I redid everything from scratch. Fresh Pi. Enabled the serial port and disabled the serial console as he states. Also replaced the ttyAMA0 for ttyS0 as he suggested.

And now it works! Also ttyS0 shows up in /dev/ as it should.

No idea what I changed or did differently this time round, though happy it works for now.

Some readings from my moderately-polluted city!

The middle one is the PM2.5 which is moderate according to this scale.


Thank you for your help!


Glad you got it sorted. I got side tracked with family weekend type stuff. =)
That serial com stuff can have you scratching your head. One thing that is so so easy to do is make a typo while doing this stuff. Put a o instead of an 0 etc. The Pi has two serial interfaces, one for its use and one for your use. Something like that and they swapped them around when they added the wifi chip to the Pi. Something like that. Anyway good going getting it running. Now comes the fun part, coding up your python etc to make use of your data and display it in a way the average joe can understand. .


Exactly! I’m on it! I’m curious to see how the values change over time etc.