Parts

SDS011 laser dust sensor

A laser dust sensor with its own fan that reports PM2.5 and PM10 over a serial line, once a second.

The Nova Fitness SDS011 talks 9600 baud, 8N1, 3.3 V logic, and sends a ten byte frame on its own. Aliases: SDS011, SDS-011, SDS018, SDS021, Nova Fitness, inovafitness, dust sensor, PM2.5 sensor, particulate matter, air quality sensor.

Pins

Pin Name What it does
1 NC Not connected.
2 PM25 PM2.5 as PWM ("1um" on the silkscreen). Not driven here.
3 5V Supply, 4.7 V to 5.3 V. The fan needs 5 V.
4 PM10 PM10 as PWM ("2.5um" on the silkscreen). Not driven here.
5 GND Ground.
6 RX Commands in, 3.3 V logic.
7 TX Frames out, 3.3 V logic.

The data frame

Ten bytes: AA C0, PM2.5 low and high byte, PM10 low and high byte, the two byte device ID, a check that is the low eight bits of the sum of the six data bytes, and AB. The readings are in tenths: AA C0 D4 04 3A 0A A1 60 1D AB is PM2.5 0x04D4 = 123.6 and PM10 0x0A3A = 261.8 micrograms per cubic meter.

Commands

Nineteen bytes: AA B4, thirteen data bytes, the device ID (FF FF for any sensor), a check that is the low eight bits of the sum of bytes 2 to 16, and AB. The first data byte picks the command; every one but the query is answered AA C5 with the same first byte.

Command First data bytes What happens
Reporting mode 02 01 00 / 02 01 01 Active (a frame a second) or query mode. Kept through a power cut.
Query data 04 Answered with one data frame.
Set device ID 05, new ID in data bytes 12 and 13 Kept through a power cut.
Sleep / work 06 01 00 / 06 01 01 Fan and laser off or on. Lost at a power cut.
Firmware version 07 Answered with year, month and day.
Working period 08 01 n 0 continuous, or every n minutes (1 to 30): 30 s of work, then sleep.

With 00 in place of 01 as the second data byte, a command asks for the setting instead of changing it. A command for another device ID, or with a wrong check or tail, is ignored.

Properties

Property What it is
pm25, pm10 The dust the sensor reports, 0 to 999.9 micrograms per cubic meter.

The two sliders on the part set them while it runs. PM10 includes PM2.5, so a PM10 set under the PM2.5 is raised to match.

Libraries

SdsDustSensor.h (the "Nova Fitness Sds dust sensors library" by Paweł Kołodziejczyk, the one the ESP32 and ESP8266 tutorials use): SdsDustSensor sds(rxPin, txPin) or sds(Serial1), sds.begin(), then PmResult pm = sds.readPm() and pm.pm25, pm.pm10 when pm.isOk(). setQueryReportingMode() with queryPm(), sleep(), wakeup() and setCustomWorkingPeriod(n) send the commands above. Or read the frames from Serial yourself: wait for AA C0, take eight more bytes and check the sum.

What the model gets right

The frame and command layouts, the checks, the answers, the device ID filter, the once a second reporting, the query and sleep modes, the working period and which settings outlive a power cut are the Nova Fitness protocol's (V1.3). The device ID starts as the manual's example, A1 60, and the firmware version is the manual's example, 15-7-10.

What it does not model

There is no fan and no air inside, so the 30 seconds the manual asks for after waking before the data is stable do not apply: the first frame, a second after power on or wake, carries the sliders. The readings are exact, with none of the sensor's 15 percent or 10 microgram error. The PWM pins are not driven, as the specification gives their 1004 ms cycle but no formula. In a working period the frame comes at the end of the 30 seconds of work; the manual says only that the sensor reports the latest data.

Common mistakes

Powering it from 3.3 V: it needs 5 V, and under 4.7 V it says nothing. Crossing the serial pins the wrong way: the sensor's TX goes to your RX pin. Querying it faster than every 3 seconds in query mode, which the manual advises against. Leaving it running all day: the laser lasts about 8000 hours, so use a working period or sleep between readings.

See it in action

SDS011 dust monitor reads the frames with the SdsDustSensor library and prints PM2.5 and PM10. Open it at /templates.