Arduino: measuring current: use a current shunt monitor
Measuring current with an Arduino or any other microcontroller is not as simple as measuring voltages directly with the Arduinos/microcontrollers ADC.
In most cases a designer would use a current shunt amplifier/monitor.
At first I started with the MAX9634F current shunt amplifier (CSA) in my design. The company Touchstone Semiconductor offers a pin and specification equivalent alternative to the Maxim part, the TSM9634T. Touchstone also offers an improved version of this amplifier, the TS1100. It has a much lower offset voltage then the MAX9634F/TSM9634T.
Datasheets
https://www.analog.com/media/en/technical-documentation/data-sheets/max9634.pdf https://web.archive.org/web/20130505120418/http://touchstonesemi.com:80/products/tsm9634 https://web.archive.org/web/20140101091436/http://touchstonesemi.com/products/ts1100
Schematic
This design uses a current shunt monitor (e.g. TS1100-25) with a gain of 25. The output voltage is:
V_out=I_load x R_sense x R_out/R1,
with R_sense = 0.08 Ohm R_out = 10k Ohm R1 = 400 Ohm
Arduino Code
Here is a sample code, that you can use in your Arduino.
void setup() {
}
void loop() {
current = analogRead(ADCpin1);//*5000/1024;
//calc current: Vout=2V equals 1A current = current*5000; current = current/1024; current = current/2;
delay(1000); }
Wiring Diagram
This is how you connect the CSA to the Arduino and the load. I measure also the voltage at the load, via the Arduino Analog Pin A0.
[Missing image: /assets/2013/06/csa_overview.jpg "current shunt amplifier - wiring diagram"]