@redplc/node-red-rpi-gpio

2.0.7 • Public • Published

@redplc/node-red-rpi-gpio

platform platform platform

Node-RED nodes for Raspberry Pi GPIO using with redPlc nodes.

Nodes

  • rpi-gpio-in: Reads GPIO inputs and store in boolean array.
  • rpi-gpio-out: Sets GPIO outputs from boolean array.
  • rpi-gpio-pwm: Sets GPIO pwm duty cycles from number array.
  • rpi-gpio-cnt: Counts GPIO inputs pulse and store in number array.

Usage

  • Install redPlc nodes.
  • Use redPlc s-inject node for trigger update.
  • Connect to first output on s-inject node.
  • Daisy chain nodes in series.
  • For logical operations use redPlc nodes.
  • Data is exchanged with global context variable arrays.
  • Array index is equal gpio number for easy handling.
  • Select different gpio pins for input, output and pwm.
  • For open inputs select pull down/up resistors.
  • This node works on Raspberry Pi with 32bit or 64bit OS.
  • Check with raspi-config for alternate functions on GPIO.

Array Index Mapping

Index Funct. Pin Pin Funct. Index
3V3 1 2 5V
2 GPIO02 3 4 5V
3 GPIO03 5 6 GND
4 GPIO04 7 8 GPIO14 14
GND 9 10 GPIO15 15
17 GPIO17 11 12 GPIO18 18
27 GPIO27 13 14 GND
22 GPIO22 15 16 GPIO23 23
3V3 17 18 GPIO24 24
10 GPIO10 19 20 GND
9 GPIO09 21 22 GPIO25 25
11 GPIO11 23 24 GPIO08 8
GND 25 26 GPIO07 7
27 28
5 GPIO05 29 30 GND
6 GPIO06 31 32 GPIO12 12
13 GPIO13 33 34 GND
19 GPIO19 35 36 GPIO16 15
26 GPIO26 37 38 GPIO20 20
GND 39 40 GPIO21 21

Examples

Example 1

This example is a self holding circuit used for push buttons.
Led turns on, if switch GPIO21 is closed.
Led turns off, if switch GPIO20 is closed.

  • Connect LED with resistor (~220 Ohms) to GPIO26 and ground pin.
  • Connect switches to GPIO20 and GPIO21 and ground pin.
  • Select GPIO20 and GPIO21 as pullup inputs.
  • Select GPIO26 as output.

Example 2

This example sets led brightness to 25%, 50% or 100% with switches.

  • Connect LED with resistor (~220 Ohms) to GPIO26 and ground pin.
  • Connect switches to GPIO16, GPIO20 and GPIO21 and ground pin.
  • Select GPIO16, GPIO20 and GPIO21 as pullup inputs.
  • Select GPIO26 as pwm.

Package Sidebar

Install

npm i @redplc/node-red-rpi-gpio

Weekly Downloads

67

Version

2.0.7

License

Apache-2.0

Unpacked Size

236 kB

Total Files

18

Last publish

Collaborators

  • redplc