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-sht31

v0.0.1

Published

Node for SHT31 sensors for SBCs gpios

Downloads

32

Readme

node-red-contrib-sht31

A node-red custom node wrapper for the nodejs sht31-sensor by @belveder79 . This library uses the outstanding package i2c-bus that enable the communication with I2C devices in most common Linux SBCs. Raspberry Pi, C.H.I.P., BeagleBone, Orange Pi, or Intel Edison are supported by this package.

The package provide a single custom node Sht31 that can be used directly in your flow.

Installation

Under your node-red (typically $HOME/.node-red) working directory.

npm install node-red-contrib-sht31

Node palette can be used as well to install the node.

After restarting node-red the "Sht31" node should be available in "input" category.

Prerequisites

Wire your sensor the I2C/TWI of the SBCs. Only four wires are needed. two for power (VCC 3.3V & GND) and two for actual I2C transmission (SLC & SDA).

I2C interface need to be enabled in in your linux distribution.

Caveat: Check your permissions to the /dev/i2c-xx devices. The user running node-red need access to writing and reading. Refer to i2c-bus to find how to grant access to your user to the /dev/i2c-xx device files

Usage

Configuration & deployment

After installation place your Sht31 node in any of your flow and configure the following parameters:

  1. Name: Select the name of your sensor for easy identification.
  2. Bus ID: Select the I2C bus to which the sensor is connected. Depending on your wiring and SBC can be different.
  3. I2C address: I2C address (7-bit) hexdecimal address(0x##). SHT31 sensor has fixed 0x44 or 0x45. You can check your sensor id by using i2c-tools typing i2cdetect -y <busnum>
  4. Topic: Topic field set on the output message. If this field is empty, topic will not be included in the output msg. By configuring the node this way input msg topic will be reused.

After configuration and deployment the node will init the sensor. A word of warning! Since the SHT31 does not expose anything like product id at this point in time, the init function does nothing but returning a fake ID. So you don't really know if the sensor is actually there or not. If it gives you no answer, it might not be there, although it shows up as "initialized".

Reading Sensor Data

As in other node-red nodes the actual measurement of sensor data require that an input msg arrive to the node. The input called Trigger will start the reading of sensor data will send the data in the node's output. The input msg is reused so any property on the input msg (with the exception of payload and topic if set) will be redirected without modification to the output.

The output will have the following format:

msg = {
  _msgid: <node-red msg_id>,
  topic: <defined topic>,
  payload: {
    model: "SHT31",
    temperature_C: <float in celsius>,
    humidity: <float in %>
  }
}

Disclaimer

A lot of code snippets, inspiration and even this README was largely taken from the BME280 contrib module implementation from @ludiazv (actually almost everything). The node was only tested on a RockPro64 board and a custom SHT31 sensor implementation from AR4 GmbH.

Change log

  • 0.0.1 First version