BRIGADOON

Backyard Meteorological Instrumentation

Raspberry Pi 4 Set Up

Particle Air Quality Sensor

The PMS5003 is particle concentration sensor that is used to determine the number of suspended particles in the air. It is powered by a +5V power supply (for its fan), but uses +3.3V logic signals. The sensor uses a TTL serial connection (TXD, RXD) and an On/Off control line to turn off the fan, reducing power consumption and increasing fan life. Initial development will be done with a short connection between the PMS5003, but later development will lengthen those lines to at least 3 metres. If required, line driver hardware will be included to ensure that there is adequate drive to cover the required line lengths.

The program is built under the Qt Development Environment to allow the use of the Qt Remote Objects for data communication. The program is built under Qt 5.15 as this is the version of Qt that can be install on the Raspberry Pi using
apt-get.
Program Entry

(1) initialises the I/O pins. In this case, it is to set the control pin for the PMS5003 activation;

(2) opens the serial port controller; This program uses the standard serial port;

(3) initialises the Qt Remote Objects. This program uses the Remote Objects to pass the readings to the database and control program;

(4) initialises the PMS5003 sensor. The serial port is used to send the initial setup commands to and read measurements from the Particle Air Quality sensor;

(5) starts the Sensor Start timer. The program calculates how long it will be (in milli-seconds) until forty (40) seconds after the next minute. At that time it calls the Sensor Start routine.

(6) Enter the Qt event loop. Entering the event loop essentially puts this program to sleep until the timers trigger.

Sensor Start

(1) Triggered at forty (40) seconds past each minute.

(2) Starts the Sensor Read timer so that it triggers on the minute (20 seconds of sensor air flow).

(3) Enables the PMS5003 so that the fan spins up to get a fresh sample of the atmosphere.
Sensor Read

(1) Starts the Sensor Start Timer to trigger 40 seconds past the minute.

(2) Read the PMS5003 using the serial port.

(3) Disable the PMS5003 to stop the fan.

(4) Transfer the Readings using Qt Remote Objects.

Since the program (and the PMS5003) sleeps between readings, the processor resource load, supply current and fan wear are reduced.

Licenced under Creative Commons Attribution Share Alike 4.0 International or better by Mark Little (2022 - 2023)