node-red-contrib-sds011-dust-sensor 1.0.2
Node-RED node to enable a communication with the SDS011 sensor which is connected via UART/serial connection.
node-red-contrib-sds011-dust-sensor
This is a Node Red node to manage connection to the SDS011 sensor on a Raspberry Pi. It is based on https://github.com/ikhayainkomishi/node-red-contrib-sds011 and documentation resp. Nodes help text was updated to make it easier to use.
All sensors supported modes like constant measurement mode and measuring in certain intervals.
This node works on all devices with a serial port.
Wiring
Make sure you specify correct serial port. The default is /dev/serial0
which is used on Raspberry Pi. Remember to wire Tx <--> Rx correctly.
Example flow
[{"id":"eb5a9a0ee23343b8","type":"debug","z":"07a60d8631c0f63a","name":"PM2.5","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":690,"y":280,"wires":[]},{"id":"2979b5dbc9dbfda2","type":"debug","z":"07a60d8631c0f63a","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"PM10","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":360,"wires":[]},{"id":"bbbeccc04ceea771","type":"debug","z":"07a60d8631c0f63a","name":"Information","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":400,"wires":[]},{"id":"c59ab9e840a6a50e","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"getDataReportingMode","payloadType":"str","x":180,"y":220,"wires":[["328b4982c64b6fba"]]},{"id":"5913e184c0cffef4","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"setQuery","payloadType":"str","x":140,"y":140,"wires":[["328b4982c64b6fba"]]},{"id":"1569677476a70759","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"getWorkingPeriod","payloadType":"str","x":170,"y":360,"wires":[["328b4982c64b6fba"]]},{"id":"2aec866e49e0287f","type":"inject","z":"07a60d8631c0f63a","name":"setWorkingPeriod","props":[{"p":"payload.command","v":"setWorkingPeriod","vt":"str"},{"p":"topic","vt":"str"},{"p":"payload.parameter","v":"3","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":170,"y":320,"wires":[["328b4982c64b6fba"]]},{"id":"d8f39586ac506c0b","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"setActive","payloadType":"str","x":140,"y":100,"wires":[["328b4982c64b6fba"]]},{"id":"747b962c971b3926","type":"join","z":"07a60d8631c0f63a","name":"Combine values to one message","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":780,"y":320,"wires":[["4ce0d2e2ae1bb5d6"]]},{"id":"4ce0d2e2ae1bb5d6","type":"debug","z":"07a60d8631c0f63a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1050,"y":320,"wires":[]},{"id":"bb0ccfe321e895c8","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"checkFirmwareVersion","payloadType":"str","x":180,"y":20,"wires":[["328b4982c64b6fba"]]},{"id":"1a1da8968e1dc9b3","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"setContinuousMode","payloadType":"str","x":170,"y":400,"wires":[["328b4982c64b6fba"]]},{"id":"198f0c88bfe74e85","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"queryData","payloadType":"str","x":140,"y":180,"wires":[["328b4982c64b6fba"]]},{"id":"ee79e0ae524b8506","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"getStatus","payloadType":"str","x":140,"y":480,"wires":[["328b4982c64b6fba"]]},{"id":"fca4bbc1b0ccfc82","type":"inject","z":"07a60d8631c0f63a","name":"setStatus(sleep)","props":[{"p":"payload.command","v":"setStatus","vt":"str"},{"p":"topic","vt":"str"},{"p":"payload.parameter","v":"sleep","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":520,"wires":[["328b4982c64b6fba"]]},{"id":"32db5be0c0474c5f","type":"inject","z":"07a60d8631c0f63a","name":"setStatus(work)","props":[{"p":"payload.command","v":"setStatus","vt":"str"},{"p":"topic","vt":"str"},{"p":"payload.parameter","v":"work","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":560,"wires":[["328b4982c64b6fba"]]},{"id":"62f16fce3947aeb0","type":"inject","z":"07a60d8631c0f63a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"work","payloadType":"str","x":130,"y":600,"wires":[["328b4982c64b6fba"]]},{"id":"c29d9fa4543f7546","type":"inject","z":"07a60d8631c0f63a","name":"sleep","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"work","payloadType":"str","x":130,"y":640,"wires":[["328b4982c64b6fba"]]},{"id":"328b4982c64b6fba","type":"SDS011","z":"07a60d8631c0f63a","name":"SDS011","port":"/dev/serial0","x":460,"y":360,"wires":[["eb5a9a0ee23343b8","747b962c971b3926"],["2979b5dbc9dbfda2","747b962c971b3926"],["bbbeccc04ceea771"]]}]
License
GPLv3