Go Down

### Topic: (Newb) Measuring current draw using Duemilanove (Read 2355 times)previous topic - next topic

#### Joolz

##### May 21, 2012, 02:55 am
Hi all,

I want to measure the current flowing through some servos using my arduino adc. I was thinking of simply  measuring the voltage through  a shunt resistor, however I'm a little apprehensive since the servos can draw  up to 1 amp.  Can you guys recommend any setup or another IC to ensure precision and safety of the microcontroller? Thanks.

#### MarkT

#1
##### May 21, 2012, 12:08 pm

Hi all,

I want to measure the current flowing through some servos using my arduino adc. I was thinking of simply  measuring the voltage through  a shunt resistor, however I'm a little apprehensive since the servos can draw  up to 1 amp.  Can you guys recommend any setup or another IC to ensure precision and safety of the microcontroller? Thanks.

Lets assume it draws 1A max.  We don't want to waste much voltage in the measuring circuit for two reasons - excess heat production and interference with the servo operation.  So lets say 0.2V is the most we should generate across the shunt.  0.2V at 1.0A is a 0.2 ohm resistor (OK a standard value will be 0.22 ohm).  The power generated in this at 1A is 0.22 watts which is OK.  At 2A this would be 0.88W which is less OK - a 0.1 ohm shunt would then be advisable.

If you place the shunt on the low side of the servo then its OK to have the servo voltage higher than 5V, say from a 6V battery pack - the Arduino pins only see 0 to 0.22V which is safe for them.  You must have common grounds of course.

There are several nice chips that do all the tricky work of converting the small differential voltage across a shunt into an analog value that is easy to measure with the Arduino's ADC.  You could consider just doing it direct though (0.22 V is about 45 counts on the ADC, a resolution of 22mA as a current measuring device.

One precaution to take is to take a differential reading so that resistance in the wiring/connectors doesn't get added into the shunt's effective value.  So each end of the shunt goes to an analog pin and you read both, then take the difference.  However this isn't totally fool-proof as you can't take those two anaogRead's at exactly the same time.

If you're not interested in high accuracy you may be able to get away with a single 0.22 or 0.1 ohm resistor as a shunt read directly from an analog pin.  There will be some noise on the readings, a more reliable way would be to use chips like the INA21x series (analog output) or INA226 (I2C bus).

Yet another approach is a hall-effect current sensor chip like the ACS711, ACS712, ACS715 series - no shunt required, but these do best for quite large currents (5A or more).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### Joolz

#2
##### May 21, 2012, 05:33 pm
Mark, thanks for the quick response. Attached jpg is the setup using the INA21x you recommend, as I understand it.Would it work?.Although not specified, the servo, ic & arduino board all share a common ground.

#### MarkT

#3
##### May 22, 2012, 04:25 pm
Well if you give the INA ground and power too.  Some of these newer chips are only available as surface mount BTW, so you may have to look out for a breakout board.

The crude method with direct analog reading will be cheaper and simpler - try it first before spending money perhaps?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up

Please enter a valid email to subscribe