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-pcf8574-lcd

v0.1.0

Published

Interface to PCF8574 I2C driver for LCD

Downloads

68

Readme

This node-red node is used to communicate with an HD44780 style LCD panel through the PCF8574 I2C interface.

Examples of this hardware setup can be found at the following URL's :

Table of Contents

Dependencies

This node depends on the following libraries :

  • i2c-bus (https://www.npmjs.com/package/i2c-bus)
  • sleep (https://www.npmjs.com/package/sleep)

It is also necessary to make sure that I2C is enabled on your Raspberry Pi. This can be done in raspi-config :

sudo raspi-config
    Interfacing Options > I2C > Enable

Installation

This node can be installed through the Palette Manager in node-red.

It can also be installed by running the following command in your node-red directory (usually ~/.node-red) :

npm install node-red-contrib-pcf8574-lcd

Properties

The node has the following properties :

  • Variant
    • PCF8574 or PCF8574AT. The default value is PCF8574. Care should be taken to correctly identify the I2C chip on your device. The different variants do not have the same I2C addresses and it will not work if the incorrect variant is chosen.
  • Size
    • Only 20x4 is supported at this time. Support for other display sizes can be considered on request.
  • Name
    • The chosen name for the node.

Usage

This node will accept the following fields as input (all fields are optional):

msg.payload

This field takes a JSON object which defines the details of how each line should be displayed on the LCD. The JSON object is expected to be an array. Each element in the array represents a line on the display. In other words, the first element corresponds to the first line, and so on. Amount of elements in the array is determined by the type of display.

If an empty element is passed in the array, the corresponding line on the display will not be modified.

Each element in the array consists of the following parameters :

  • "clear" (optional) - Set this to true if the line should be cleared before the text is displayed. If not specified, the line will not be cleared.
  • "text" - Set this to the text string that should be displayed.
  • "alignment" (optional) - This determines the alignment on the line of the text to be displayed. Valid options are "center" or "right". If not specified, text will be left aligned.

As an example, if you want to display a text string on line 1 that is center aligned and also clear the line first, and also display a text string on line 4 that is right aligned without clearing the line :

"payload": [
    {
        "clear": true,
        "text": "Line 1 Text",
        "alignment": "center"
    },
    {},
    {},
    {
        "clear": false,
        "text": "Line 4 Text",
        "alignment": "right"
    }
]

The msg.payload field is not required if the intent is only to perform an action specified by msg.action.

msg.action

This is a string field where an action can be specified that should be performed prior to anything being written to the display.

Accepted action strings are :

  • "clearscreen" - This will clear the whole LCD display
  • "on" - Turn the display on
  • "off" - Turn the display off

Examples

Clear the screen and display text on line 2

"msg": {
    "action": "clearscreen",
    "payload": [
        {},
        {
            "text": "Example text"
        }
    ]
}

Turn off the display

"msg": {
    "action": "off"
}

Clear line 3

"msg": {
    "payload": [
        {},
        {},
        {
            "clear": true
        }
    ]
}