Monday, May 11, 2015

Reading a Current Shunt with an Arduino

Current shunts are very popular with the Ham Radio, boating, electric vehicle and solar / wind off grid folks, as they allow them to monitor solar and wind power production, power consumption of devices, and the estimated amp hours left in the battery bank, sort of like a "gas gauge" for your batteries.

See our complete Off Grid Power Monitoring System at

Previous ADS1115 Arduino / Raspberry Pi post!

Unlike the solid state hall effect types, current shunts drop a small voltage across a calibrated resistor, indicating the amps being passed through the shunt. This allows shunts to report massive amounts of current, in excess of a 1000 amps, depending on the design of the shunt.

Common shunts are rated at 50mv, 75mv, and 100mv output at maximum current (do not exceed 66% of name plate current). The Arduino has a few issues with these shunts. Since the maximum output is just 100 millivolts compared to the Arduino's range of 0-5v, it's like trying to read a 5 inch ruler from 10 miles away (worse with the 50mv and 75mv versions). The second issue is the Arduino has a 10 bit analog to digital converter (ADC), so a 100amp / 100mv shunt would have a 4.88 mv per step resolution, or about 5 amps per step (a total of 1024 steps).

We can solve this with a higher bit ADC with an onboard amplifier. We chose a 16 bit ADC that has over 64000 steps (+/- 32768), and up to 16x amplification. This matches a 100mv shunt very well.

The ADC we chose is the adafruit ADS1115. It has 4 single ended channels, or two differential channels. We chose to use differential mode, to eliminate electrical interference (the third issue) in the monitoring circuit, giving us very stable results. This means we can use two shunts per ADS1115. The ADS1115 can have 4 different user selectable I2C addresses, so with only 2 data lines (SCL & SDA), you can monitor up to 8 shunts.


Connections are very simple. Adafruit gives a very comprehensive tutorial on connecting and using this sensor for a variety of different purposes, and you can read about it (and download the library) at For our purposes, this is what we needed:

VDD - Arduino +5v
GND to Arduino GND
SCL to Arduino A5
SDA to Arduino A4
ADDR to Arduino GND (one of 4 possible address combinations, see adafruit tutorial for the the others)
A0 to Current Shunt
A1 to Current Shunt


Although we are using a 100a / 100mv shunt, if you are using a 75mv or 50mv shunt, we added two additional lines in the code you can uncomment depending on which shunt you are using.

#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */

void setup(void)
  ads.setGain(GAIN_SIXTEEN);    // 16x gain  +/- 0.256V  1 bit = 0.125mV  0.0078125mV

void loop(void)
  int16_t results;
  results = ads.readADC_Differential_0_1();  
  Serial.print("Amps: "); 
  float amps = ((float)results * 256.0) / 32768.0;//100mv shunt
  //amps = amps * 1.333; //uncomment for 75mv shunt
  //amps = amps * 2; //uncomment for 50mv shunt


Order a complete current sensor board with 100a / 100mv shunt for only $65

Related Posts Plugin for WordPress, Blogger...