npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-contrib-dht-sensor

v1.0.4

Published

Node-red node for node-dht-sensor

Downloads

789

Readme

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.

Installation

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 --unsafe-perm -g node-dht-sensor
  • Install this node
sudo npm install --unsafe-perm -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+)

Note: If you're daft enough to select an earth (ground) pin, this will cause the Pi to freeze.

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

While not having the humidity as part of the payload may seem awkward, it was done with the explicit intention to preserve compatability with the node-red-controb-ds18b20-sensor node.

Problems?

It is possible to run this as an ordinary user rather than root, but it requires that you update the version of the BCM2385 library to version 1.5 or later, and build it according to the instructions. Then you have to uninstall and reinstall the nodes:

sudo npm uninstall --unsafe-perm -g node-red-contrib-dht-sensor
sudo npm uninstall --unsafe-perm -g node-dht-sensor

sudo npm install --unsafe-perm -g node-dht-sensor
sudo npm install --unsafe-perm -g node-red-contrib-dht-sensor

once you do this, you can run it as any user rather than as root.

Notes:

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