1.0.11 • Published 3 years ago
node-red-contrib-redplc-automationhat v1.0.11
node-red-contrib-redplc-automationhat
Node-Red node for Pimoroni Automation HAT
Node Features
- 3 x 5-24V Digital Inputs
- 3 x Relays (24V @2A)
- 3 x 24V Sinking Outputs
- Brightness adjustable Leds for Inputs, Relays, Outputs and Indicators
- 3 x Indicator Leds POWER, COMMS, WARN
- 3 x 11bit Analog Input (0..25V) conversion time 1ms/channel
- 1 x 11bit Analog Input (0..3.3V) conversion time 1ms
- Output value in mV
- Scaling with factor and offset
Install
For using with Ladder-Logic install redPlc nodes
For using with other nodes, install module nodes
Install with Node-Red Palette Manager or npm command:
cd ~/.node-red
npm install node-red-contrib-redplc-automationhat
Usage
Update is triggered by redPlc cpu node or module-update node This node reads/writes from/to Node-Red global variables This node works only on Raspberry Pi with Raspberry Pi OS Enable I2C with raspi-config
I/O Mapping
Digital Input (Variable I):
Bit | Function |
---|---|
0 | Input 1 |
1 | Input 2 |
2 | Input 3 |
Digital Output (Variable Q):
Bit | Function |
---|---|
0 | Relay 1 |
1 | Relay 2 |
2 | Relay 3 |
3 | Output 1 |
4 | Output 2 |
5 | Output 3 |
6 | LED WARN |
7 | LED COMMS |
8 | LED POWER |
Analog Input (Variable IA):
Input | Array-Index |
---|---|
ADC1 | 0 |
ADC2 | 1 |
ADC3 | 2 |
ADC4 | 3 |
Scaling with Factor and Offset:
Formula:
Factor = (OH - OL) / (IH - IL)
Offset = OL - (IL * Factor)
Output = Input * Factor + Offset
Where:
IL = Input Low (mV), IH = Input High (mV)
OL = Output Low, OH = Output High
Example:
Input: 0mV .. 10000mV, IL = 0, IH = 10000 Output: -20°C .. 60°C, OL = -20, OH = 60 Factor = (60 - (-20)) / (10000 - 0) = 0.008 Offset = (-20) - (0 * 0.008) = -20
Input = 4000mV Output = 4000 * 0.008 + (-20) = 12°C
Donate
If you like my work please support it with donate: