High DC Current Sensing with a Raspberry Pi and Python
Do you want to measure high DC current (and 0–26V) using a raspberry pi or similar, inexpensively? 10 amps? 100 amps? Maybe 500A? Enough of the cheesy salesman talk.
My solution is to ‘hack’ an INA219 current sensor by removing (desoldering) the 0.1 Ohm resistor and ‘replacing’ it with a high-current shunt. Don’t worry, it’s not very difficult.
The INA219 current sensor is a ‘shunt’ itself, which works by measuring the (minute) voltage drop across the 0.1 Ohm resistor built onto the board. It then uses this to calculate the current flowing through the resistor using Ohm’s Law (V = IR | V = Voltage (V), I = Current (A) and R = Resistance (Ω)). So, if you need to measure higher current than the 3.2A that the unmodified INA219 sensor can handle (like I did), we can leverage the high precision voltage sensor across the 0.1 Ohm resistor and connect a high-current shunt (resistor) instead. The best thing is that we can make these modifications and still use the available software libraries as they were intended.
What this guide will do:
- Demonstrate the hardware modification to the INA219 sensor (desoldering a surface mount resistor)
- Calculate the new constants required for use of the modified sensor in a program
- Provide demonstration code in python to get you up and running