node-red-contrib-redplc-rpi-ads1x15 v1.0.11
node-red-contrib-redplc-rpi-ads1x15
Node-Red node for ads1015/ads1115 analog to digital converter
Node Features
- Supports ads1015/ads1115 analog to digital converter
- Each input can be selected Single-Ended, Differential or Disabled
- ads1015 12bit conversion time 1ms/channel
- ads1115 16bit conversion time 10ms/channel
- Four selectable I2C addresses
- Output value is in mV
- Input range +/- 6.144V, 4.096V, 2.048V, 1.024V, 0.512V or 0.256V
- 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-rpi-ads1x15
Usage
This node writes to Node-Red global variables Update is triggered by redPlc cpu node or module-update node This node works only on Raspberry Pi with Raspberry Pi OS Enable I2C with raspi-config Consult datasheet for absolute maximum ratings
Analog Input (Variable IA):
Single-Ended Mode: |Input|Array-Index |:----|:---:| |IA0-GND|0| |IA1-GND|1| |IA2-GND|2| |IA3-GND|3|
Two Differential Inputs Mode: |Input|Array-Index |:---|:---:| |AI0-AI1|0| |AI1-AI3|1| |AI2-AI3|2| |AI0-AI3|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: