PMS5003 - Enabling to Enviro+

Hi, I need an idiot’s guide in plain English pls. I’m using an Enviro+ and a Pi Zero WH (with Raspbian Buster updated and upgraded) and have got the Enviro+ working perfectly with the python examples. Now I want to use the PMS5003 particulate matter box with it. I’ve got it connected up but when I tried to do the raspi-config to enable the connection I haven’t had any success. Do some versions of Raspbian need sudo and others not? I managed to enable i2c and SPI from the ‘Preferences’ menu but as for the other bits which need doing in the LX Terminal I seem stuck. I think it’s because I don’t understand the commands. Also, I’ve seen 2 slightly different sets of commands for enabling this UART connector. Can you explain what I need to do very precisely please.

There are two different config menus which can be confusing.
running sudo raspi-config from terminal or command line gets you the older original.
I “think” its Interfacing options > SPI enable?
From the desktop its Preferences > Raspberry Pi Configuration > Interfaces.
I “think” its SPI you turn on?

Post a link to the guide(s) your following and I may be able to offer some better info.
I have also noticed, if I do a startx from the terminal to get the desktop gui, I get some weird errors when I try to do things. I usually go into raspi-config and toggle it to boot to the GUI and reboot.

1 Like

Thx @alphanumeric . I’ll get back to you when I’m home.

On this page:
it says: Note that if you’re using this sensor with Raspberry Pi, then you’ll need to make a couple of changes to its configuration. Type sudo raspi-config in the terminal and then under “Interfacing options” and “Serial” disable the login shell and enable the serial port hardware . Edit your /boot/config.txt file and add the lines enable_uart=1 and dtoverlay=pi3-miniuart-bt to the bottom of the file.

On this page in github:
It says:
And if you’re using a PMS5003 sensor you will need to:

  • Enable serial: raspi-config nonint set_config_var enable_uart 1 /boot/config.txt
  • Disable serial terminal: sudo raspi-config nonint do_serial 1
  • Add dtoverlay=pi3-miniuart-bt to your /boot/config.txt

And install additional dependencies:

sudo apt install python-numpy python-smbus python-pil python-setuptools

Ok, that first link is as near as I can tell for using the PMS5003 on a Raspberry Pi by itself, no Enviro+ between it and the Pi.
And the second link is the manual install instructions for the Enviro+ and the PMS5003 if you have one.

You should be able to set it “all” up by running
curl -sSL | bash
It states on the PMS5003 product page “Our Enviro plus installation script will do all of this configuration for you”.

Thank you @alphanumeric . I was being cautious because I don’t want to run it headless yet and I thought this command might do that as well. I guess this only does the set-up and not the headless bit.

Headless just means running without a monitor keyboard and mouse attached. The Pi will still boot up with no monitor etc connected. You will have to set it to run your python file automatically on boot up.
I use crontab for that. From the terminal run
sudo crontab -e
then add
@reboot python3 /home/pi/ &
Ctrl x, y, enter to save it.
/home/pi is where my file is located, change that to the path to where your file is located.
And substitute the name of your file for yourfile
The only extra bits you may need to do is configure it for remote connection via Putty etc. If you want to connect from another device over your network. I can’t remeber if thats enabled by default in Raspbian or not?
If you have installed Buster with Desktop, you can go into Raspberry Pi Configuration and set it to boot to command line instead of the Desktop GUI. It will save some resources that way.

Hi alphanumeric, Yes, I’ve done some headless projects before: a scrolling badge on a pi zero and a bag with LEDs on the front with a pi zero so I’m okay with that - but thanks for telling me what you use, to run a project headless, as there seem to be a few different methods.
I ran the curl that you said, I should use, previously and got an error msg in red, "Apt failed to update ‘indexes’. " Is it likely it’s going to work anyway or do I need to try again? Grandchildren came so I’ve not had time to try.

I’ve had the same thing happen now and then with the one line installer. When that happens I go to the second method. In your case that would be as follows.

  • git clone
  • cd enviroplus-python
  • sudo ./

You could wait and see if everything works before doing this though. Doing it won’t (shouldn’t) hurt anything you’ve done so far. I’ve done one after the other and it fixed the python etc errors I was getting.

Thanks alphanumeric. I’ll try my set-up with the all-in-one installer, that I’ve done already, first and see what works - then I’ll use the ‘separate commands’ method later, if necessary.


Everything working having used the one-line installer and not taken any notice of the error msg. I’ve learnt so much, from you, doing this so thanks again for your help!

Now to learn what the data all means so I can really understand air quality.

Thats good to hear, glad to help,enjoy your new tech. =)

1 Like