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 bytes Name Content
0 Message header AA
1 Commander No. C0
2 DATA 1 PM2.5 Low byte
3 DATA 2 PM2.5 High byte
4 DATA 3 PM10 Low byte
5 DATA 4 PM10 High byte
6 DATA 5 ID byte 1
7 DATA 6 ID byte 2
8 Checksum Checksum
9 Message tail AB

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.

Subscribe
Notify of
6 Comments
Inline Feedbacks
View all comments
Solitone
7 years ago

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

Markus
7 years ago

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

Nobody
7 years ago

Indents messed up in sample code