Skip to content

Shunt - Battery Monitor

Short: A shunt is a device that creates a low-resistance path for electric current. We are measuring the voltage drop of the current and then recalculate the current. Measured over time we can track the state of charge from the battery.


We are using an ADS1115 to measure the voltage drop and the battery voltage. The ADS1115 is 16bit ADC with an adjustable gain. The chip is connected via i2c-bus on adress 0x4a. We are using two of them, the second one on adress 0x48 is used for the waterlevel sensors. INSERT LINK HERE

Our shunt PCB is OpenSource, you can find it below. A 4pin Rj11 connection transfers the voltage from the shunt to the board.

The current is measured in differential mode (gain16 +/-0.256V) between channel 0-1.
The voltage is measured in differential mode (gain2 +/-2.048V) between channel 2-3.

Channel 0 and 1 are directly connected to the shunt main connection points. Channel 2 and 3 are connected to a voltage divider of 50k/4,7k. This voltagedivider scales the 12v input to a measurable voltage value.

Schematic Download ZIP


To read the values a python3 script and bottle webserver is served to get the data into node-red. Main reason for this is that we can use all cpu cores with it, while Node-Red itself uses only one core for now. The measuring is time critical so we had to care about the cpu usage. Of course you can call this data from other programs too. the script is located at ~/pekaway/ads_py/ (interpreter python3)

GET requests on localhost:8080

-> gives {watthours, factorI, amps, volts, MaxWatthours}

-> set SOC in watthours of the battery

-> gives level1 -> level4 ADC values

-> gives a random number to proof is the ads thread running

-> set the battery capacity in watthours

-> set the shunt factor value 100a/75mv 200a/75mv 300a/75mv


Every 2m the battery SOC is stored in a sqlite3 database (~/home/pi/pythonsqlite.db). These values hold the state of the battery and are loaded from the database after a reboot.

Back to top