RS-WS-N01-8 Modbus Temperature and Humidity sensor

I bought a RS-WS-N01-8 Modbus Temperature and Humidity sensor a few weeks ago and I did the integration to Node Red. There is a Youtube video describing how the sensor works and how to set it up: https://youtu.be/tgLTkWAz5Is

Link for the modbus setup utility to change the station ID and baud (explained in the video): https://drive.google.com/file/d/0Bw1XOPtMPlsNUi1SWEZ4OGdGVUU/view?usp=sharing

Link for the image explaining the use of the above utility: https://drive.google.com/file/d/0Bw1XOPtMPlsNMkFZZ3VnSUJXY0E/view?usp=sharing

To communicate with the sensor you need the Modbus Serial node: http://flows.nodered.org/node/node-red-contrib-serial-modbus

The flow reads the values over Modbus serial, converts the incoming binary buffer and pushes the temperature and humidity to a dashboard UI text field.

[{"id":"8b486fd4.cdc7","type":"debug","z":"2934a51a.93393a","name":"","active":false,"console":"false","complete":"false","x":790,"y":152,"wires":[]},{"id":"bda32a0f.183418","type":"function","z":"2934a51a.93393a","name":"Read buffer","func":"var regs = msg.payload;\nvar humid = (((regs[0] & 0x00FF) << 8) | (regs[1] & 0xFF))/10;\nvar temp = (((regs[2] & 0x00FF) << 8) | (regs[3] & 0xFF))/10;\n\n// msg.payload = \"{ \\\"temp\\\": \"+temp+\", \\\"humid\\\": \"+humid+\"}\";\n\nvar rsws = { temp:0, humid:0 };\nrsws.temp = temp;\nrsws.humid = humid;\n\nmsg.payload = rsws;\n\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":176,"wires":[["8b486fd4.cdc7","605870f1.4c06f","4b7f9241.5f9e3c"]]},{"id":"627b6e68.1285f","type":"modbusSerial in","z":"2934a51a.93393a","port":"a62a637d.eb2a6","slaves":"50","start":"0","count":"2","dtype":"holding","period":"1","topic":"","name":"","x":189,"y":186,"wires":[["bda32a0f.183418","f4550df5.167e8"]]},{"id":"4b7f9241.5f9e3c","type":"ui_text","z":"2934a51a.93393a","group":"a82c54da.58e038","order":1,"width":0,"height":0,"name":"","label":"Temperature","format":"{{msg.payload.temp}} C","layout":"row-spread","x":738,"y":243,"wires":[]},{"id":"605870f1.4c06f","type":"ui_text","z":"2934a51a.93393a","group":"a82c54da.58e038","order":2,"width":0,"height":0,"name":"","label":"Humidity","format":"{{msg.payload.humid}} %","layout":"row-spread","x":731,"y":293,"wires":[]},{"id":"f4550df5.167e8","type":"debug","z":"2934a51a.93393a","name":"","active":false,"console":"false","complete":"false","x":467,"y":117,"wires":[]},{"id":"a62a637d.eb2a6","type":"modbusSerialConfig","z":"","port":"/dev/ttyUSB0","baud":"9600","data":"8","parity":"none","stop":"1","name":""},{"id":"a82c54da.58e038","type":"ui_group","z":"","name":"RS-WS-N08-1","tab":"156af96f.f8fd27","order":5,"disp":true,"width":"6"},{"id":"156af96f.f8fd27","type":"ui_tab","z":"","name":"Home","icon":"home","order":"1"}]

Flow Info

Created 7 years, 11 months ago
Rating: 5 1

Owner

Actions

Rate:

Node Types

Core
  • debug (x2)
  • function (x1)
Other

Tags

  • modbus
  • serial
  • temperature
  • humidity
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option