# Measuring current draw from servo

I am trying to measure the current draw of a digital hobby servo (futaba 3050) to estimate its applied torque.

To implement this I am using a shunt resistor setup with an IC that will send a proportional current through its output (P3) which will then be drawn through a resistor (R2) giving a output voltage that will be measurable by the MCU.

(The setup is shown in the schematic below, using a 0.2ohm shunt resistor and the IC ZXCT1009FTA by 'Diodes Incorporated') simulate this circuit – Schematic created using CircuitLab

After having implemented this on a PCB I have been testing the circuit and I have a few questions regarding my results.

When first testing the circuit I used a simple power resistor to draw a fixed current through the wire called "Servo Supply" in the schematic. And while varying the current from my lab bench power supply through the power resistor the voltage on "ADC measurement" changed proportionally to the current as expected.

After passing this simple first test I then moved on to the real test, actually running a servo as load. But unfortunately I ran into trouble. I probed the voltage at "ADC measurement" pin. And the result from running the Servo (keeping it at a fixed position but applying small torque) can be seen in the first image. When then applying more torque the measured voltage is kept at the same level but kept high for a longer time. Actually making the current measurement behave like a PWM. Here is another image with more torque applied to the servo. So to summarize into the actual question: How will I go about to measure the current (torque) of the servo in a good way? I read about measuring the average current draw for example by adding a capacitor (at the ADC pin I assume), but I feel unsure about how I would choose said capacitor?

Or could I just do ADC measurements and take the average over a full PWM period?

Thankful for any input/help. If there's any additional info needed I am happy to extend the question.

Best regards, Mattias

• What is the pulse rep rate min? I'm thinking of a high order Nyquist LPF such as those used for Telephony. – Tony Stewart Sunnyskyguy EE75 Oct 12 '16 at 19:29
• @TonyStewart.EEsince'75 Hello Tony, I am sorry but I do not know what you mean with pulse rep rate min? – Mattias Wallin Oct 12 '16 at 19:32
• Chances are the motor pulses are triggered in direct response to the input PWM command based on the position error measured relative to what that is commanding, so would match its rate - nominally 50 Hz by tradition, but it would depend on the source in use. A more sophisticated servo with a digital implementation of the onboard PID loop might run the loop at an internally determined frequency and use the PWM input only to update the setpoint. In any case the output is likely to be PWM, as linear motor drive wastes power, and these are designed to run on batteries. – Chris Stratton Oct 12 '16 at 19:35
• Can you average in software or prefer to use nth order LPF Nyquist filter and sample with ADC at some rate? Another approach is I to V to VCO to counter average in software and reset before overflow. or just measure I in software at a fast rate and crunch the results like a LiPo Coulomb counter – Tony Stewart Sunnyskyguy EE75 Oct 12 '16 at 19:36
• @MattiasWallin not a simple filter. In order to suppress fundamental f , since narrowest pulse determines >>2x min.sampling rate , filter must suppress ripple by 20dB for 10% err. or 40dB for 1% error and compute order of filter from fastest result desired below 25Hz with 6dB per octave per order – Tony Stewart Sunnyskyguy EE75 Oct 12 '16 at 20:05

• Note simple rolling average adds group delay or latency to the peak current. But an optimal "Nyquist" filter would not. (as much) 