node-red-contrib-dht-sensor 0.0.21

Node-red node for node-dht-sensor

npm install node-red-contrib-dht-sensor

This is a Node Red node to manage connection to a DHT11 or DHT22 sensor on a Raspberry Pi. It allows you to specify the variables that define the connections to the sensor.

This node is added to the Raspberry Pi section.


This node requires that node-dht-sensor is installed and accessible from Node Red. Since this requires accesss to low-level parts of the Raspberry Pi, you must run your flow with superuser access.

Installing this node requires three steps:

  • Install the BCM2835 library from here.
  • Install the node-dht-sensor dependency
    sudo npm install -g node-dht-sensor
  • Install this node
    sudo npm install -g node-red-contrib-dht-sensor

Configuring the node

You can specify the following, as seen in the picture here:

  • The topic of the message - this is passed through so it can be used as an ID for the sensor.
  • The name of the node. This can be a unique value to tag the sensor, useful if you have multiple sensors connected.
  • The sensor type - this can be either DHT11 or DHT22.
  • The pin number scheme. This can be any of
    • the BCM-GPIO scheme
    • the physical sequence number, for revision 1 of the Pi
    • the physical sequence number, for revision 2 of the Pi (and A+ or B+)
    • the wiringpi sequence, for revision 1 of the Pi
    • the wiringpi sequence, for revision 2 of the Pi (and A+ or B+)

Node configuration

Using the node

The node is added to the Raspberry Pi section of the Node-RED pallette, and it can be used in a flow as usual:

Node-RED flow

The message returned includes the temperature as the payload, and the humidity and the device ID as part of the message itself:

Returned message


  • The temperature values is in °C and the humidity values are % relative humidity.
  • If you're using an older release of Raspbian, you will have to run node-RED as root, otherwise you may run into problems with permissions.

Node Info

Version: 0.0.21
Updated 3 months, 2 weeks ago
License: Apache 2.0


11 in the last day
144 in the last week
616 in the last month


  • rpi-dht22


  • node-red
  • sensor
  • dht11
  • dht22


  • bpmurray