open-index/open-npm huggingface dataset:
npm package: @redplc/node-red-gpio
Description: Node-RED nodes for Raspberry Pi gpio using with redPlc nodes
Author: Derya Y.
Latest version: 2.0.1

# @redplc/node-red-gpio

[![platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org)
[![platform](https://img.shields.io/badge/platform-redPlc-ffa500)](https://flows.nodered.org/node/@redplc/node-red-redplc/)
[![platform](https://img.shields.io/badge/platform-Raspberry--Pi-ff69b4)](https://www.raspberrypi.com/)

Node-RED nodes for Raspberry Pi GPIO using with [redPlc](https://www.npmjs.com/package/@redplc/node-red-redplc/) nodes.<br>

<a href="https://www.buymeacoffee.com/iiot2ka" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-red.png" height="41" width="174"></a><br>

## Installation
Install with Node-Red Palette Manager or npm command:
```
cd ~/.node-red
npm install @redplc/node-red-gpio
```

Report any issues [here](https://github.com/redplc/redplc/issues) with name *@redplc/node-red-gpio*.

## Detail
- This node uses the gpio character devices interface (V2) from the Linux operating system
- The interface to hardware is implemented in C++ as add-on module
- This library works on Raspberry Pi with 32bit or 64bit OS
- Works on Raspberry Pi 3, 4, 5
- Not yet tested on the Raspberry Pi 2


## Nodes
- **gpio-in**: Reads GPIO inputs and store in boolean array.
- **gpio-out**: Sets GPIO outputs from boolean array.

## Usage
- Install [redPlc](https://www.npmjs.com/package/@redplc/node-red-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 and output.
- For open inputs select pull down/up resistors.
- 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|

## Example
The example shows the logic behind redPlc.<br>
Please install this and @redplc/node-red-redplc Node.<br>
Connect switches to GPIO21, GPIO20 and GPIO16 with common to ground.<br>
LEDs with series resistors can be connected to the outputs GPIO12, GPIO13, GPIO19 and GPIO26.<br>
Please note the maximum output current of the GPIO pins.<br>
npm package: @redplc/node-red-redplc
Description: Node-Red nodes for the realization of Software-Plc with Ladder-Logic
Author: Ocean
Latest version: 2.0.1

# @redplc/node-red-redplc

[![platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org)
[![platform](https://img.shields.io/badge/platform-redPlc-ffa500)](https://flows.nodered.org/node/@redplc/node-red-redplc/)

redPlc Node-Red nodes for the realization of Software-PLC with Ladder-Logic according to IEC 61131-3.

<a href="https://www.buymeacoffee.com/iiot2ka" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-red.png" height="41" width="174"></a><br>
Thanks for the coffee !! 😁

Report any issues [here](https://github.com/redplc/redplc/issues)

## Nodes
- **contact**: Ladder Logic Contact.
- **coil**: Ladder Logic Coil.
- **function**: Ladder Logic Digital Function.
- **counter**: Ladder Logic Counter Coil.
- **timer**: Ladder Logic Timer Coil.
- **flipflop**: Ladder Logic FlipFlop.
- **move**: Ladder Logic Move.
- **math**: Ladder Logic Calculation.
- **scale**: Ladder Logic Scale.
- **compare**: Ladder Logic Compare.
- **M memory**: Digital (M) Memory Variable.
- **MA memory**: Analog (MA) Memory Variable.
- **s-inject**: Sequential Inject.
- **onstart**: Execute On Start.
- **firstscan**: Execute On First Scan.
- **rail**: Ladder Logic Rail.
- **import**: Import Data from other nodes.
- **export**: Export Data to other nodes.


## Detail

redPlc nodes implements Software PLC functionality in Node-Red.<br>
The control logic is realized as [ladder logic](https://en.wikipedia.org/wiki/Ladder_logic) (LD) according standard IEC 61131-3.<br>
Variables are stored in Node-Red global context memory as arrays:

|Variable|Function|Array Of|Created by|
|---|---|---|---|
|**I**|Digital Input|Boolean|Digital Input Modules|
|**Q**|Digital Output|Boolean|Digital Output Modules|
|**M**|Digital Memory|Boolean|Memory Node|
|**C**|Counter|Boolean/Number|Counter Node|
|**T**|Timer|Boolean/Number|Timer Node|
|**FF**|Flip-Flop|Boolean|Flip-Flop Node|
|**IA**|Analog Input|Number|Analog Input Modules|
|**QA**|Analog Output|Number|Analog Output Modules|
|**MA**|Analog Memory|Number|Memory Node|

More info and examples:
https://github.com/redplc/redplc/
npm package: @redplc/node-red-rpi-ads1115
Description: Node-RED node for ads1115 16bit adc using with redPlc nodes.
Author: Derya Y.
Latest version: 2.0.8

# @redplc/node-red-rpi-ads1115

[![platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org)
[![platform](https://img.shields.io/badge/platform-redPlc-ffa500)](https://flows.nodered.org/node/@redplc/node-red-redplc/)
[![platform](https://img.shields.io/badge/platform-Raspberry--Pi-ff69b4)](https://www.raspberrypi.com/)

Node-RED node for [ads1115](https://www.ti.com/product/ADS1115) 16bit adc using with [redPlc](https://www.npmjs.com/package/@redplc/node-red-redplc/) nodes

## ads1115 analog to digital converter
- 16bit Conversion Resolution.
- Four Analog Inputs.
- Each input can be selected Single-Ended, Differential or Disabled.
- Internal Voltage Reference.
- Internal Oscillator.
- Programmable Data Rate 8 SPS to 860 SPS.
- The PGA offers input ranges from ±256 mV to ±6.144 V.
- I2C Interface with Four Pin-Selectable Addresses.

## Usage
- Install [redPlc](https://www.npmjs.com/package/@redplc/node-red-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 input number for easy handling.
- This node works on Raspberry Pi with 32bit or 64bit OS.
- Input voltage more than VCC can damage adc input.
- The output value is mV or adc raw data.
- Works also on Raspberry Pi 5
- Enable I2C with raspi-config.
- In this case i2c-1 is enabled.
- If you use i2c-0 port add<br>
  **dtparam=i2c_vc=on**<br>
  to /boot/config.txt,<br>
  then Pin27=SDA, Pin28=SCK.<br>
- For other ports add this to /boot/config.txt.

## Array Index Mapping

|Input|Array-Index|
|:----|:---:|
|A0|0|
|A1|1|
|A2|2|
|A3|3|

## Address Pin Connection To

|I2C Address|ADDR Pin|
|:----|:---|
|48H|GND or open|
|49H|VCC|
|4AH|SDA|
|4BH|SCL|


## Example
This example gets voltage and current from ADC and displays on Dashboard.<br>
The module node ads1115 is set for input A0 and A1 to Input-Range 2048mV.<br>
Other adc inputs are disabled.<br>
2048mV is equal 50V on input A0 and 5A on input A1.<br>
In rung **01** the adc values are scaled to voltage and current<br>
and stores in analog variable MA0.0 and MA0.1.<br>
Input scale MIN is **0** and **MAX** is 2048.<br>
Output scale MIN is **0** and **MAX** is 50 (V) for voltage (input A0).<br>
Output scale MIN is **0** and **MAX** is 5 (A) for current (input A1).<br>
The redPlc export nodes reads the analog variables and sends to Dashboard gauge.
npm package: @redplc/node-red-rpi-ds18b20
Description: Node-RED node for ds18b20 temp. sensor using with redPlc nodes.
Author: Ocean
Latest version: 2.0.4

# @redplc/node-red-rpi-ds18b20

[![platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org)
[![platform](https://img.shields.io/badge/platform-redPlc-ffa500)](https://flows.nodered.org/node/@redplc/node-red-redplc/)
[![platform](https://img.shields.io/badge/platform-Raspberry--Pi-ff69b4)](https://www.raspberrypi.com/)

Node-RED node for [ds18b20](https://www.analog.com/en/products/ds18b20.html#product-overview) temperature sensor using with [redPlc](https://www.npmjs.com/package/@redplc/node-red-redplc/) nodes

## ds18b20 digital temperature sensor
- 9..12bit resolution.
- Conversion time 93.75..750ms.
- Measure range -55°C .. +125°C.
- On range -10°C .. +85°C is accuracy ±0,5°C.
- 1-Wire connection.
- Power supply 3..5.5V external or over bus (parasite power).
- Each sensor has a 64-Bit ID.

## Usage
- Install [redPlc](https://www.npmjs.com/package/@redplc/node-red-redplc/) nodes.
- Use redPlc s-inject node for trigger update.
- Connect to first output on s-inject node.
- For logical operations use redPlc nodes. 
- Data is exchanged with global context variable arrays.
- Array index depends on the order of the sensors.
- If you add/remove sensors, array index can be change.
- This node works on Raspberry Pi with 32bit or 64bit OS.
- The temperature values are in °C or °F.
- To prevents locks only one node is allowed.
- Enable 1-wire with raspi-config.
- Default 1-wire pin on Raspberry pi is GPIO4. 

## Delay with reading multiple ds18b20 digital temperature sensor
The ds18b20 digital temperature sensor needs to read temperature:<br>
9-bit resolution -> 93.75ms.<br>
10-bit resolution -> 187.5ms.<br>
11-bit resolution -> 375ms.<br>
12-bit resolution -> 750ms. (default factory set)<br>
Because the accuracy is ±0.5°C in the range from -10°C to +85°C,<br>
I recommend operating the sensor with 9-bit resolution.<br>
Please note that the times apply to one sensor.<br>
This means 10x750ms (7.5s) for 10 sensors with 12bit resolution.<br>
There is a way to read multiple sensors more quickly.<br>
The 1-Wire drivers from RPi Linux are not used for this,<br>
but the sensors are addressed with their 1-Wire protocol.<br>
In the further version I will implement this 1-Wire protocol.<br>

## Set Sensor Resolution
You can change the sensor resolution with tool in subfolder **setSensor**.<br>
File **readme.txt** describes how the tool is used.<br>
npm package: @redplc/node-red-time
Description: Node-RED nodes for get System-Time or NTP-Time using with redPlc nodes
Author: Derya Y.
Latest version: 2.0.3

# @redplc/node-red-time
[![platform](https://img.shields.io/badge/platform-Node--RED-red)](https://nodered.org)
[![platform](https://img.shields.io/badge/platform-redPlc-ffa500)](https://flows.nodered.org/node/@redplc/node-red-redplc/)

<a href="https://www.buymeacoffee.com/iiot2ka" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-red.png" height="41" width="174"></a><br>
If you like my work and find it helpful, please support me with a small donation.

Node-RED nodes for get System-Time or [NTP-Time](https://en.wikipedia.org/wiki/Network_Time_Protocol) using with [redPlc](https://www.npmjs.com/package/@redplc/node-red-redplc/) nodes.<br>

## Nodes
- **sys-time**: Reads System-Time and store in number array.
- **ntp-time**: Reads NTP-Time and store in number array.
- **calc-time**: Calculates time difference or convert time.

## Usage
- Install [redPlc](https://www.npmjs.com/package/@redplc/node-red-redplc/) nodes.
- For logical operations use redPlc nodes. 
- Data is exchanged with global context variable arrays.
- The variable is updated cyclically.
- A very quick query of the NTP server can lead to blocking of the ip.

### Time/Date Elements Array-Index
|Element|Value|Index|
|---|---|---|
|Seconds|0 .. 59|0|
|Minutes|0 .. 59|1|
|Hours|0 .. 12/23|2|
|AM/PM|0=AM, 1=PM|3|
|Weekday|0 .. 7, 0=Sunday|4|
|Day|1 .. 31|5|
|Month|1 .. 12|6|
|Year|YYYY|7|
|since epoc|ms|8|

## Example
This example switches on a consumer (e.g. lamp) on days of the week<br> 
and between hour range.<br>
The redPlc module **sys-time** reads the system time and saves it in the variable IA99.<br>
The day of the week is stored in index 4 (0 = sunday, 1 = monday ..) and the hours in index 2.<br>
The days of the week are queried with the compare node.<br>
After that, the start and end hours are queried with the compare nodes in series.<br>
If all queries are fulfilled, the Raspberry Pi output is switched on.<br>
Select in module node **rpi-gio-out** GPIO26 as output.<br>