Monitoring air quality with a Nova PM2.5/PM10 Sensor and Python

It is a major problem in almost all large German cities, that fine particulate matter is frequently exceeding  its maximum permissible value of 50 μg/m3. In a special issue of the Make Magazine (IoT special 01/2017), I read an article about the Nova PM SDS011 sensor, which is using the principle of laser scattering to measure the concentration of particulate matter between 0.3 to 10 μm in the air. The sensor is cheap (about 20 Euro) and easy to use, since it communicates via serial connection.

For placing the sensor into an enclosure,  it is equipped with a nozzle that allows to connect a hose of max. 1 m length. The UART communication protocol requires a bit rate of 9600 baud, with 8 data bit, no parity and one stop bit.

Number of bytesNameContent
0Message headerAA
1Commander No.C0
2DATA 1PM2.5 Low byte
3DATA 2PM2.5 High byte
4DATA 3PM10 Low byte
5DATA 4PM10 High byte
6DATA 5ID byte 1
7DATA 6ID byte 2
8ChecksumChecksum
9Message tailAB

The Make Magazine published a shell script for data acquisition.  However, I find it more more convenient reading the sensor data with Python. The script below opens a serial connection and converts the high- and low bytes for PM2.5 and PM10 as described in the sensor’s data sheet.

PM 2.5: 4.PM 2.5: 4.3 μg/m^3 PM 10: 5.7 μg/m^3 CRC=OK

In addition my Python script allows to operate the sensor in discontinuous mode, which is not documented in the data sheet.

6
Leave a Reply

3 Comment threads
3 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
  Subscribe  
Notify of
Solitone

What is the device ID (2 bytes)? Is it unique for each and every SDS sensor?

Markus

Hello, could you please add a link to your script. Many thanks.

Nobody

Indents messed up in sample code