SDS011 and DHT sensors usage for PI or Windows

Basic flow to command SDS011 and DHT nodes to get results on a chart.

SDS011-node.js needs a little fix available on GitHub fork for commands with parameter otherwise commands like "setWorkingPeriod()" won't work.

An unconfigured USB UART node providing search box is used to find correct serial port.

Let node unconfigured or erase it to avoid conflicts.

SDS011 with USB2SERIAL adapter works also on windows.

[{"id":"5c18a42d.a3e25c","type":"tab","label":"SDS011 and DHT sensors","disabled":false,"info":""},{"id":"cef1c0a9.f01a","type":"ui_chart","z":"5c18a42d.a3e25c","name":"","group":"cb2979b9.33e008","order":1,"width":"12","height":"7","label":"2.5 / 10 μm en μg/m3","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"30","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":900,"y":380,"wires":[[],[]]},{"id":"34567e6d.bf1972","type":"rpi-dht22","z":"5c18a42d.a3e25c","name":"","topic":"rpi-dht22","dht":"22","pintype":"2","pin":"12","x":280,"y":480,"wires":[["7f989a2f.5819b4","5a2927ed.819d98"]]},{"id":"7f989a2f.5819b4","type":"debug","z":"5c18a42d.a3e25c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":530,"y":520,"wires":[]},{"id":"ee1a2db9.a948e","type":"inject","z":"5c18a42d.a3e25c","name":"","topic":"","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":480,"wires":[["34567e6d.bf1972"]]},{"id":"dc840cc5.c30f1","type":"ui_chart","z":"5c18a42d.a3e25c","name":"","group":"cb2979b9.33e008","order":3,"width":"12","height":"7","label":"RH%","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"90","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":850,"y":460,"wires":[[],[]]},{"id":"6ed8b9ea.ca5108","type":"debug","z":"5c18a42d.a3e25c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":850,"y":540,"wires":[]},{"id":"1ee83983.9bb4f6","type":"debug","z":"5c18a42d.a3e25c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":850,"y":500,"wires":[]},{"id":"5a2927ed.819d98","type":"function","z":"5c18a42d.a3e25c","name":"1:°C 2:RH","func":"var msg1 = { payload:msg.payload  };\nvar msg2 = { payload:msg.humidity };\nreturn [msg1, msg2];","outputs":2,"noerr":0,"x":540,"y":480,"wires":[["1ee83983.9bb4f6","4e240123.350de"],["dc840cc5.c30f1","6ed8b9ea.ca5108"]]},{"id":"35583449.dabd9c","type":"ui_button","z":"5c18a42d.a3e25c","name":"","group":"cb2979b9.33e008","order":5,"width":"0","height":"0","passthru":true,"label":"Clear chart climat","color":"","bgcolor":"","icon":"","payload":"[]","payloadType":"json","topic":"","x":570,"y":420,"wires":[["dc840cc5.c30f1","4e240123.350de"]]},{"id":"6f87ef5d.084fd","type":"inject","z":"5c18a42d.a3e25c","name":"Clear","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":420,"wires":[["35583449.dabd9c"]]},{"id":"f45835c5.aa4278","type":"ui_button","z":"5c18a42d.a3e25c","name":"","group":"cb2979b9.33e008","order":2,"width":"0","height":"0","passthru":true,"label":"Clear chart particles","color":"","bgcolor":"","icon":"","payload":"[]","payloadType":"json","topic":"","x":580,"y":380,"wires":[["cef1c0a9.f01a"]]},{"id":"fa1c1c68.5a379","type":"inject","z":"5c18a42d.a3e25c","name":"Clear","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":380,"wires":[["f45835c5.aa4278"]]},{"id":"4e240123.350de","type":"ui_chart","z":"5c18a42d.a3e25c","name":"","group":"cb2979b9.33e008","order":4,"width":"0","height":"0","label":"°C","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"5","ymax":"30","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":850,"y":420,"wires":[[],[]]},{"id":"36090ee3.bcc0f2","type":"comment","z":"5c18a42d.a3e25c","name":"port ?","info":"use this USB UART node to find your serial port\n/dev/ttyAMA0 is GPIO serial port\n/dev/ttyUSB0 can be your USB2serial port","x":530,"y":100,"wires":[]},{"id":"c75dd496.287c08","type":"inject","z":"5c18a42d.a3e25c","name":"","topic":"","payload":"checkFirmwareVersion","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":40,"wires":[["22135086.15d5"]]},{"id":"ae275ddd.cba72","type":"debug","z":"5c18a42d.a3e25c","name":"PM2.5","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":850,"y":40,"wires":[]},{"id":"6648bd0b.ec6674","type":"debug","z":"5c18a42d.a3e25c","name":"PM10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":850,"y":80,"wires":[]},{"id":"cc331e2b.fd829","type":"debug","z":"5c18a42d.a3e25c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":850,"y":120,"wires":[]},{"id":"11eb976e.e43fb9","type":"inject","z":"5c18a42d.a3e25c","name":"","topic":"","payload":"getDataReportingMode","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":80,"wires":[["22135086.15d5"]]},{"id":"40498064.19fcc","type":"inject","z":"5c18a42d.a3e25c","name":"","topic":"","payload":"getStatus","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":120,"wires":[["22135086.15d5"]]},{"id":"9fcdd717.eb6248","type":"inject","z":"5c18a42d.a3e25c","name":"","topic":"","payload":"getWorkingPeriod","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":240,"wires":[["22135086.15d5"]]},{"id":"d56f9b12.f140f8","type":"inject","z":"5c18a42d.a3e25c","name":"","topic":"","payload":"setContinuousMode","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":280,"wires":[["22135086.15d5"]]},{"id":"ba41cef5.1e41d","type":"inject","z":"5c18a42d.a3e25c","name":"","topic":"","payload":"sleep","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":160,"wires":[["22135086.15d5"]]},{"id":"bd13a86.f39ed58","type":"inject","z":"5c18a42d.a3e25c","name":"","topic":"","payload":"work","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":200.00001525878906,"wires":[["22135086.15d5"]]},{"id":"79f41e49.e7764","type":"inject","z":"5c18a42d.a3e25c","name":" ","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":320,"wires":[["8e92c1bb.8a225"]]},{"id":"8e92c1bb.8a225","type":"change","z":"5c18a42d.a3e25c","name":"setWorkingPeriod","rules":[{"t":"set","p":"command","pt":"msg","to":"setWorkingPeriod","tot":"str"},{"t":"set","p":"parameter","pt":"msg","to":"5","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":320,"wires":[["22135086.15d5"]]},{"id":"22135086.15d5","type":"rpi-sds011","z":"5c18a42d.a3e25c","name":"SDS0110","port":"/dev/ttyUSB0","x":540,"y":40,"wires":[["ae275ddd.cba72","cef1c0a9.f01a"],["6648bd0b.ec6674","cef1c0a9.f01a"],["cc331e2b.fd829"]]},{"id":"7865a666.fc45c8","type":"serial in","z":"5c18a42d.a3e25c","name":"USB UART RX","serial":"","x":560,"y":140,"wires":[[]]},{"id":"cb2979b9.33e008","type":"ui_group","z":"","name":"Atmo","tab":"c9e6c9fd.a67ec8","disp":true,"width":"12","collapse":false},{"id":"c9e6c9fd.a67ec8","type":"ui_tab","z":"","name":"Home Rpi21","icon":"dashboard"}]

Flow Info

Created 5 years, 11 months ago
Rating: 5 1

Owner

Actions

Rate:

Node Types

Core
  • change (x1)
  • comment (x1)
  • debug (x6)
  • function (x1)
  • inject (x11)
Other
  • rpi-dht22 (x1)
  • rpi-sds011 (x1)
  • serial in (x1)
  • tab (x1)
  • ui_button (x2)
  • ui_chart (x3)
  • ui_group (x1)
  • ui_tab (x1)

Tags

  • SDS011
  • DHT22
  • DHT11
  • particles
  • smog
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option