0
\$\begingroup\$

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

schematic

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.

Servo current measurement low torque

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.

Servo current measurement more torque

After searching for more information about doing current measurements on servos I read about this behaviour which I assume is originating from that the servo is controlled with a PWM signal?

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

\$\endgroup\$
  • 1
    \$\begingroup\$ What is the pulse rep rate min? I'm thinking of a high order Nyquist LPF such as those used for Telephony. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Oct 12 '16 at 19:29
  • \$\begingroup\$ @TonyStewart.EEsince'75 Hello Tony, I am sorry but I do not know what you mean with pulse rep rate min? \$\endgroup\$ – Mattias Wallin Oct 12 '16 at 19:32
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – Chris Stratton Oct 12 '16 at 19:35
  • 1
    \$\begingroup\$ 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 \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Oct 12 '16 at 19:36
  • 1
    \$\begingroup\$ @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 \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Oct 12 '16 at 20:05
1
\$\begingroup\$
  • just for giggles on a spreadsheet
  • a simple software filter but ADC samples synchronously to 10x servo rate. (500Hz) in order to demonstrate limitations of simple low pass filters on delay and ripple.
  • Rolling averages were done for different # of samples 1,3,5,7,7W (centre weighted) , 11, 19, 39 for less than 80 samples of servo pulses

  • asynchronous sampling would have aliasing errors.

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

\$\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.