Arduino Library For LTC4151

LTC4151 is a high voltage I2C current and voltage monitor. It is capable of monitoring input voltage ranging from 7V to 80V with the onboard 12-bit ADC. It can also measure the high side current and an additional external voltage with the same 12-bit ADC resolution. Besides LTC4151, LTC4151-1 and LTC4151-2 have split SDA (SDAO and SDAI) for interfacing with Opto-Isolators.

The library provided here (you can download it towards the end of the post) can be used to interface LTC4151 with an Arduino easily. Here is a quick example on how to use the library to measure the input voltage, load current and an auxiliary voltage:

#include <Wire.h>
#include <LTC4151.h>

LTC4151 sensor;

void setup()
    sensor.init(LTC4151::L, LTC4151::L);

void loop()
    Serial.print(" ");
    Serial.print(" ");
    Serial.print(" ");

The corresponding circuit setup is shown below. Note that I used an LTC4151-2 here and because I was not using its opto-isolation feature, both SDAI and SDAO pins (pin 11, 12) are tied together and serve as a single SDA pin. The current sensing resistor used is 0.1 Ohm and the auxiliary ADCIn measures the forward voltage drop of a diode. Both address pins are grounded. The SDA/SCL pull up resistors are connected on the Arduino board which is not shown here.


The available functions in this library are listed in details below:

init(byte A0, byte A1)

Initialize LTC4151 with the given I2C address.
A0 and A1 can be H (HIGH, can be tied to input voltage up to 90V directly), L (LOW) and F (FLOAT or unconnected)
and 9 different addresses are possible.

getLoadCurrent(double r), getSnapshotLoadCurrent(double r)

Get the measurement of the load current across the current sensing resistor. The snapshot version of the function makes a one-time measurement.
The input parameter r is the current sensing resistor value (in Ohms) and the returned value is in milliamps.
The full scale voltage drop is 81.92 mV across the current sensing resistor.

getInputVoltage(), getSnapshotInputVoltage()

Get the input voltage. The snapshot version of the function makes a one-time measurement.
The returned value is in Volts.

getADCInVoltage(), getSnapshotADCInVoltage()

Get the ADCIn pin input voltage. The snapshot version of the function makes a one-time measurement.
The returned value is in Volts. Note that input voltage into this pin should not exceed 5V. The full scale voltage is 2.048V.


Get the content of the control register.

setControlRegister(byte ctrlReg)

Set the content of the control register. Typically the control register does not need to be modified by user code as most functionalities have been exposed via the functions provided above.

Detailed application circuits can be found in the datasheet.


LT4151 library for Arduino: LTC4151.tar.gz
LT4151 library on GitHub

Be Sociable, Share!


  1. Matt Lauer says:

    Hi. I am looking at your breadboard pic and trying to wire up my LTC4151S-2 just as you have done. Is the 0.1 Ohm resistor the one going from breadboard row 16 to the + power rail of the breadboard? Or is your 0.1 Ohm resistor the one on the LTC4151 chip from pin 1 to pin 16 (sense+ to sense-)? I look forward to trying this sesnsor on my 48V power project!

  2. Terry says:

    Hi Kwong, What is the maximum current that can be measure with your circuit and 0.1 Ohm? It is 3.2 A with 0.1 Ohm like

  3. Michael says:

    is it possible to send or show me the pinouts on the ardunio
    Kind regards

  4. Ben Hall says:

    Thanks for making this available! Planning to use it as part of a custom alternator controller / battery charge controller where I need to limit current as well as regulate voltage.

    Thanks much,

  5. Peter says:

    Hi, may I ask where from have you sourced the LTC4151S-2 ?

  6. Ben Hall says:

    Duplicated your setup this afternoon. Works great!

    Thanks much,

  7. Jude Pritish Christus says:

    Hi kwong,

    Did you purchase the LTC4151 online? if so could you please share the link. been trying to order this from every possible place so far.


  8. Raigedas says:

    hi, thanks for sharing,
    is it possible to measure current in both directions or in single direction only?

  9. Hey!

    Awesome work with this IC! Got it working on Arduino. I am currently trying to integrate LTC4151 with recent versions of MSP430 especially the value line series, MSP430G2553. Can you guide me on how this can be achieved?

    • In addition to this, I had slight problems in getting the current measurements.. Can I know the rating of the below components you have used in the above circuit diagram?
      1. Between pin 9 i.e SENSE-(is that a resistor ???) and GND.
      2. the components connected to pin 16 i.e ADIN.. I see a diode there but what is the other component?

Leave a Reply to Michael