node-red-contrib-ds18b20-sensor 1.3.6

Node-red node to connect DS18B20 sensors

npm install node-red-contrib-ds18b20-sensor

This is a Node Red node to manage connection to DS18B20 sensors on a Raspberry Pi, searching all available directories. For each sensor found, it returns the msg object where the topic is set to the sensor ID and the payload is set to the temperature. If the node's topic is set to a device ID, or a device ID is passed into the node as msg.topic, this is used to return a single reading for the specified sensor. If the Array checkbox is checked or msg.array is set to true, the value(s) are returned as an array in msg.payload. The current timestamp is always set as msg.timestamp.

A simple flow is to click on an input node to inject an empty message to the sensor node and capture the output in a debug node:

Node-RED flow

Clicking on the input node causes the values from all available temperature sensors to be returned as a series of messages:

Message list

If the Array checkbox is checked this will cause the return of data as an array, i.e. the function of this checkbox is to force a single value into an array:

Edit dialog

If you provide an empty topic value, this indicates that you want the data associated with all devices returned. If the array checkbox is selected, they are in a single message as an array in the payload:

[ { "family": "28", "id": "71EEFA050000", "file": "28-000005faee71", "temp": 15.062 }, { "family": "28", "id": "8D85FB050000", "file": "28-000005fb858d", "temp": 16.75 }, { "family": "28", "id": "BD27FB050000", "file": "28-000005fb27bd", "temp": 85 }, { "family": "28", "id": "1BE4FA050000", "file": "28-000005fae41b", "temp": 15.812 }, { "family": "28", "id": "678C8B060000", "file": "28-0000068b8c67", "temp": 16.937 } ]

However, if the checkbox is not checked, the values are returned as a series of individual messages, one per sensor, where the payload is set to the temperature value. In this case, the topic contains the ID of the sensor:

{ "_msgid":"dd456bcd.22ba98", "topic":"71EEFA050000", "payload":30.875, "timestamp":1490739050565, "file":"28-000005faee71", "dir":"w1_bus_master1", "family":"28" }

In both cases, the timestamp of the reading is set in the message.

Now, if the input node is clicked again, this time the data are returned as an array:

Message array

By default, this node targets DS18B20 sensors, but you can also use it to capture data from other similar sensors. This reads the list of all available sensors using the Dallas One-Wire Protocol, and retrieves the temperature from those sensors that provide a temperature value.

The node is added to the Raspberry Pi section.

Node Info

Version: 1.3.6
Updated 6 years, 1 month ago
License: Apache 2.0
Rating: 4.8 4

Actions

Rate:

Downloads

43 in the last week

Nodes

  • rpi-ds18b20

Keywords

  • node-red
  • iot
  • device
  • devices
  • raspberry
  • raspi
  • rpi
  • pi
  • temperature
  • dallas
  • one-wire
  • sensor
  • temperature
  • DS1822
  • DS18S20
  • DS18B20

Maintainers