9
\$\begingroup\$

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.

\$\endgroup\$
13
\$\begingroup\$

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

\$\endgroup\$
  • 2
    \$\begingroup\$ OK, 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... \$\endgroup\$ – Len Holgate Dec 6 '09 at 21:46
  • 3
    \$\begingroup\$ Please 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. \$\endgroup\$ – Kortuk Dec 6 '09 at 22:55
  • \$\begingroup\$ That's good to know. \$\endgroup\$ – Len Holgate Dec 7 '09 at 7:39
7
\$\begingroup\$

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

\$\endgroup\$
  • 3
    \$\begingroup\$ I 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. \$\endgroup\$ – Kortuk Dec 6 '09 at 0:43
  • 1
    \$\begingroup\$ Kelvin connection layout: imgur.com/gVrH1 . Source: focus.ti.com/lit/ml/slua366/slua366.pdf \$\endgroup\$ – Vineeth Dec 6 '09 at 19:16
  • \$\begingroup\$ 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... \$\endgroup\$ – Len Holgate Dec 6 '09 at 21:48
  • 2
    \$\begingroup\$ I 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. \$\endgroup\$ – Kortuk Dec 6 '09 at 22:54
  • 1
    \$\begingroup\$ Speaking 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. \$\endgroup\$ – Kortuk Dec 7 '09 at 4:14
1
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.