PMSx003

From Let's Control It
Jump to: navigation, search

Work in Progress

ATTENTION:
This Plugin is still under testing! If you want to use it you have to use a "TESTING" Binary!

Introduction

The Plantower PMSx003 modules are laser based particle sensors.
Particles are measured by blowing air through the enclosure with a laser inside.
By measuring diffusion of the laser beam, the amount of particles is counted.
Measurement information is transmitted over a serial interface.
In opposition to the GP2Y10 this sensors have an own microprocessor that does reading and
differing into the PM1.0, PM2.5 and PM10 sizes. The values can be read directly from the serial
interface.

Hardware

The following modules have different construction and dimensions but share the same serial interface and protocol:

  • PMS3003

TBD

  • PMS5003

PMS5003 2.jpg

PMSx003 Pin1 Text.jpg

  • PMS7003

Pms7003-front-view.png

Precautions

The PMSx003 run on 5V. All inputs and outputs are TTL 3.3V compatible so no level converter is needed.

The external circuitry is small, it needs just two resistors and a capacitor.

Pins:

VCC   - 5V (for fan and internal logic)
GND   - Ground (Note that chassis/case are ground also)
RX/TX - 3V3 UART 9600 8N1
SET   - Standby function, when pulled down the module does not send information over serial and goes into a low power state.
RESET - Reset the module, similar to power-up, it takes ~30 seconds before data is received

Hardware

The PMSx003 sensor is easy to connect. Just connect it as shown in the schematic:

The resistors are "pull-up" resistors to give a defined "high" level of 3.3V. The capacitor covers the high current consumption of the laser pulses avoiding influence to the power supply of the circuit.

PMSx003 Schematics.jpg

 Beware: Pin numbers shown in schematics refer to PMS5003
 PMS	Pin PMS5003	Pin PMS7003	ESP
 VCC	1		1,2		5V
 GND	2		3,4		GND
 Set	3		10		D0(GPIO16) + Resistor to 3.3V
 Tx	4		9		D7(GPIO12)
 Rx	5		7		D6(GPIO13)
 Reset	6		5		D5(GPIO14) + Resistor to 3.3V
 Spare	7,8		6,8		not connected

This setup uses "software serial" emulating a serial port on the ESP8266. It is possible to use the hardware serial for this purpose.

PMS	Pin PMS5003	Pin pMS7003		ESP
Tx	4		9			RX(GPIO3)
Rx	5		7			TX(GPIO1)

The firmware plugin will detect automatically if soft- or hardware serial is used.

 Please take care when using hardware serial:
 - Flash your firmware first before connecting!
 - Disable the serial port under Tools --> Advanced before connecting!
 Then set the GPIO pins in the Setting according to the table.
 This setting is usefull if you are short on free GPIO's or using an ESP-01.

ESP Easy

The ESP Easy plugin uses the (default) active mode of the module. This says the sensor
transmits data over the UART automatically towards the ESP. The update frequency of data depends
on the changes in measurement data. (i.e. when there are no changes, no data is transmitted).

Set up the ESPEasy task according to the screenshot.
If you chose other GPIO's adapt settings accordingly.

PMSx003 Settings.jpg

  • 1st GPIO -> RX pin (IO3 for HW serial)
  • 2nd GPIO -> TX pin (IO1 for HW serial)
  • 3rd GPIO -> Reset (Optional)
  • Acquisition delay -> Determines how often data is send to controllers

Submit your settings and go back to the task list.
It should show some values already (refresh after a minute if values are zero).

Both hardware and software serial are supported. The RX/TX pins can be selected in the device configuration page.
When a reset pin is configured, the module is reset when ESPEasy is started. TX is not functionally used, but a TX pin
should be configured because the software/hardware serial libraries require it. A free/dummy TX IO can be selected.

Output

The output of the plugin consists of 3 values:

  • PM1.0 - Concentration of particles 1um/m3
  • PM2.5 - Concentration of particles 2.5um/m3
  • PM10 - Concentration of particles 10um/m3

Lifetime Helper

The laser diode inside the PMSx003 has a lifetime of about 8000 h, nearly one year.
With the actual plugin the sensor is powered permanently so we have to take some care about this.

The D0 (GPIO16) is connected to the "SET" input of the PMSx003. if it is pulled low the sensor sleeps.
Some rules can be used to set the sensor up to sleep mostof the time:

on System#Boot do
  gpio,16,0
  timerSet,1,20
endon
On Rules#Timer=1 do
  LongPulse,16,1,5
  timerSet,1,20
endon

These rules use a "System#Boot" event to set GPIO16 to low (0) and start a 20 sec timer.
The "Rules#Timer=1" event is triggered by this timer an sends a 5 seconds "high" pulse to the sensor waking it up.
The timer then is is re-initialized so this works in a loop.
Set the delay inside the dustsensor task to 30 seconds for this. The ESPEasy plugin gets the data and stores it
when the sensor gets active.

Troubleshooting

If you don't see any values in the task list this failure usually results of cabling faults. Check all cablings according to the schematics. If you are testing on a breadboard, the breadboard contacts might be worn out or you got some faulty cables. A digital multimeter will help with this situations.

References: