Pages: [1]   Go Down
Author Topic: (Newb) Measuring current draw using Duemilanove  (Read 1513 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* CurrentMeasure.jpg (24.59 KB, 980x704 - viewed 48 times.)
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: