node-red-contrib-iiot-rpi-ads1115 2.0.5

A Node-Red node for ads1115 analog to digital converter

npm install node-red-contrib-iiot-rpi-ads1115

platform platform NPM version NPM Donate

A Node-Red node for 16bit ads1115 analog to digital converter

image info

Example ads1115 hat from joy-it

image info

Example ads1115 module


Install with Node-Red Palette Manager or npm command:

cd ~/.node-red
npm install node-red-contrib-iiot-rpi-ads1115


  • iiot-ads1115: Sends adc inputs as number array.
  • iiot-ads1115-m: Sends adc inputs as number on each multiple outputs.


  • Read is triggered on cycle.
  • To prevents locks only one node is allowed per i2c address.
  • Input voltage more than VCC can damage adc input.
  • The output values are mV or adc raw data.
  • This node works on Raspberry Pi with 32bit or 64bit OS.
  • Enable I2C with raspi-config.
I2C Address ADDR Pin
48H GND or open

Array Index

Input Array-Index
A0 0
A1 1
A2 2
A3 3



This example reads current and voltage from the analog to digital converter.
Input A0 is current with Input-Range 0..2048mV in array msg.payload[0].
Input A1 is voltage with Input-Range 0..2048mV in array msg.payload[1].
Input A2 and A3 are disabled.
Raw values are scaled to engineering values.
Power is calculated.
The toFix function cuts decimals after point.
Each engineering value is send to output.
In Node-Red Dashboard, these are displayed in a gauge.

image info

JavaScript Code in Function Node:

// Rounds number to fix decimal after point.
function toFix(value, decimals) {
    return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);

// scale raw data to engineering value
function scale(raw_value, input_min, input_max, output_min, output_max)
    var factor = (output_max - output_min) / (input_max - input_min);
    var offset = output_min - (input_min * factor);
    return (raw_value * factor) + offset;

var current = scale(msg.payload[0], 0, 2048, 0, 5);  // scale currtent 0..5A
var voltage = scale(msg.payload[1], 0, 2048, 0, 50); // scale voltage 0..50V
var power = current * voltage; // calculate power

return [
    { payload: toFix(current, 1) }, // output 1
    { payload: toFix(voltage, 1) }, // output 2
    { payload: toFix(power, 2) }    // output 3  

Node Info

Version: 2.0.5
Updated 5 months ago
License: Apache-2.0
Rating: 5.0 1




14 in the last week


  • iiot-ads1115
  • iiot-ads1115-m


  • node-red
  • raspberry pi
  • rpi
  • ads1115
  • iot
  • iiot
  • analog
  • adc