I'm building a hexapod robot using simple servos and I was wondering how feasible it was to measure the current flow to each servo (5-6V DC to a maximum of 0.25-1A (I haven't found the spec for the servo's stall current yet)) using, say, an ATMega168. What kind of circuit would I need to build in series with each of the servo's power lines to give me a useful readout? I assume I'd get a voltage drop across this circuit, what's it likely to be? etc.
3 Answers
Honestly, People often use a simple sense resistor.
You place an in series very low resistance resistor(<1 ohm often) and you measure voltage drop. This allows you to monitor motor current.
There are many many motor control algorithms if you want to control the motor yourself, otherwise, if you are measuring for just knowing current draw, you just need to make sure you sample often enough to get an accurate measurement, or use a circuit with a lowpass filter effect(make sure you buffer the voltage).

- 13,362
- 8
- 60
- 85
-
2OK, I've tried this and it works OK (with a simple test with my multimeter) and is simple to do and doesn't take much in the way of additional components or board space which is good. My plan is to route the current sensor signal from each of the servos into one of the CD74HCT138E active low muxes and read them during the 50Hz PWM refresh cycle; so I read the feedback about the current draw for the servo as I generate the PWM for it... – Len Holgate Dec 06 '09 at 21:46
-
3Please remember that multimeters have a built in lowpass. You may find that your microcontroller receives less valuable numbers without implementation of a simple lowpass RC filter. – Kortuk Dec 06 '09 at 22:55
-
That's good to know. – Len Holgate Dec 07 '09 at 07:39
Sense resistor is good. Usually they're placed on the high side of the circuit, so that the supply voltage return can be shared between source and load, and usually you size the sense resistor so it's small enough not to affect the circuit, but large compared to voltage errors (typical op-amp input offsets are in the neighborhood of 0.5-5mV). This makes it a little harder to amplify and translate to a "ground"-referenced signal. Take a look at these current sense monitor ICs from Zetex (now part of Diodes Inc) -- I had to design a current sense circuit a few months ago and these looked like the best fit (project got changed so I never had a chance to use it).
For layout, make sure you use a pseudo-Kelvin connection -- connect the current sense signal lines directly to the pads of the resistors (preferably the inner edges of the pads) and don't use those sense traces for anything else except the amplification circuit. (A true Kelvin connection would be the same thing except it would require a 4-terminal resistor with 2 load terminals and 2 sense terminals -- this isn't usually necessary unless you get into really accurate or low-resistance circuits.)

- 13,950
- 3
- 41
- 68
-
3I would like to note, there are op-amps designed for many different things, I had friends build something like this and it was not working because their op-amp offset was around 100mV and it was not a rail-rail op-amp. Otherwise, excellent design. I never consciously think about how to connect the sense lines, but I have always connected them to the resistor pads, dumb luck or something someone told me long ago, who knows. – Kortuk Dec 06 '09 at 00:43
-
1Kelvin connection layout: http://imgur.com/gVrH1 . Source: http://focus.ti.com/lit/ml/slua366/slua366.pdf – Vineeth Dec 06 '09 at 19:16
-
I think this is probably a little more complex (and I expect accurate) than I need. Since I have a minimum of 18 servos that I want to measure I guess the component count and cost will be prohibitive... – Len Holgate Dec 06 '09 at 21:48
-
2I believe jason is giving an industry acceptable answer, until you want to sell the device, you are probably more than fine. I would suggest understanding his approach though, as the knowledge of what he was doing is far more valuable than the implementation. – Kortuk Dec 06 '09 at 22:54
-
do you need to measure each one's current? anyway some of those zetex parts were around 50c each, i think – Jason S Dec 07 '09 at 01:37
-
1Speaking as someone who works with many tinkerers, it is a size issue normally and not a cost one. Complexity and size go up, bugs go up exponentially, especially bread-boarded. – Kortuk Dec 07 '09 at 04:14
-
Kortuk, thanks, yes, I may well go this route if the other way doesn't work out for me. – Len Holgate Dec 07 '09 at 07:42
-
Jason, yes, I'm using the current measurement to tell me how much stress the servo is under. The idea being that I can use this as a simple feedback mechanism. I saw that the Zetex parts were pretty cheap, it was when I looked for something similar in a DIP package that I might have a chance of soldering that the prices went up. That said, if they came packaged in 8s in a single DIP then that might work better. I may end up playing with both approaches. Thanks for the info. – Len Holgate Dec 07 '09 at 07:45
-
Digikey does sell those SMT adapters (little circuit boards with SIP pins), if you're worried about quick prototyping. If you're laying out a circuit board I wouldn't worry about SOT23's; I'm pretty clumsy and I can deal with them fine. (TSSOPs and 0402 components are another matter...) – Jason S Dec 07 '09 at 16:06
-
Sounds like a cool project.
Some motor drivers already measure current in order to provide "overload protection". If you can't tap that signal, there are several ways to measure current. Start with the simplest and cheapest method, and if that won't work, try the next one.

- 17,426
- 11
- 66
- 115