New features: monitoring the servo holding force

I’m using a SSC32 to balance a biped. it would be very usefull to know the power consumption of each servo.(power consumption = applied force ) The new HMI protocol of HITEC does it, but is it possibile to add this feature on the SSC32 using the standard servo?

Can anyone suggest a solution, thanks.

I don’t think that a firmware solution will be possible. The SSC32 multiplexes its mcu pins through shift registers to ba able to drive that many servos. A side effect of this is one way communication through those registers.

Torque-sensing servos would be really great, you get for free (ie without any extra hardware) the feedback that many people are using various force sensors for.

The biological version of this is the kinesthetic sense.

That’s much harder than it sounds at first… I’ve got current sense data but it’s difficult data to interpret when it includes all the pulses for overcoming gear train friction, unbalanced loads on the servos, and especially if you were to try it on an unregulated servo supply.

Thanks for the info.
andylippitt, it think that is possibile calculate a median value with many samplings, but i don’t know how I can do a “current-sensor” (the hardware) , can you help me?

all you need is a resistor and a way to read a small voltage change.

If you put a tiny resistor in series with the negative power leg of the servo, a voltage drop proportional to the current draw will be measurable across the resistor.

Voltage = Current x Resistance

So send the analog voltage to a ADC or something, divide this by the fixed resistance of the resistor, and you will calculate the current flowing through the resistor. Lots of stuff on the web i would imagine for this kinda stuff.

Thanks andylippitt! Thanks biomechanics!

If you are using analog servos you may want to sense high side rather than low side. the servo pulse is ground referenced and unless you are planning on amplifying the voltage with an op-amp, getting enough voltage on the ground side to make a meaningful a/d measurement may (it depends on the servo) mess with the servo signal and cause it to jitter under load.

It depends on how much resolution you are looking for of course. Say you want 0 to 20 counts to equal 0 to 2.0 amperes, 5 volts full scale at 8-bit is 19.5 mV/bit, so 400 mV (ruff ruff) is 20 counts and would require a 0.2 ohm (hopefully 0.1%) 1-watt resistor in SERIES with the ground leg of your servo.

Now, the problem I started out trying to illustrate should become more obvious if you consider your PWM servo signal is referenced from ground at the control board, but at 2A the “ground” seen by the servo is 0.4V (400mV) ABOVE the board ground. If the servo is buffering and digitizing the input pulse before applying it to the servo amplifier this may still be acceptable. If it is simply rectifying and filtering the signal then the servo amplifier will see a varying voltage that varies with load current, which can in turn cause it to oscillate under load.

High side sensing is not without its own issues as frequently the battery voltage is significantly above the maximum a/d converter maximum input voltage AND your sensed voltage is referenced to the battery voltage which certainly is not a constant. The simplest way to address this is to use a voltage divider to scale the maximum battery voltage to less than the maximum a/d input voltage, and use the same ratio on the servo side of your sense resistor (located between the battery and the servo +V input.) Now you can measure the battery voltage and the sensed voltage (which by the way will also have a reduced input range due to the voltage divider) and calculate how much current is flowing by (delta-Volts / ohms) * factor to correct for the voltage dividers.

A more efficient way to do this with some resolution would be to use a current mirror IC like a Zetex ZXCT1009 (an example) and a smaller sense resistor. The current mirror will output a current proportional to the voltage drop across your sense resistor, which you can in turn feed to a resistor at your A/D input that will be chosen to scale the maximum current to the maximum a/d voltage and boom baby you have full scale resolution of your A/D over the full input current range.

I am not saying you need to do this this way, nor am I saying with any certainty that your servos will oscillate, I am just pointing out the potential problem and suggesting a known albiet slightly more complicated solution to the problem and that you may consider investigating the situation in some detail before hooking all this up and having a wtfn moment. :wink:

I can speak to the low-side shunt on analogs. I’ve been doing it with a .05ohm resistor and a fairly low voltage reference on the ADC. I’ve not seen any of the problems you’ve cautioned about, but of course YMMV. Rather the bigger issue I’ve run into is the very low bandwidth of the PID in analog servos. You can low pass this voltage or average a bunch of readings, but you’ll probably find that you can read this value much more quickly than the range of pulses you’ll see from the HiTec controllers.

I had lots of cycles to spare, so I ended up going sans filter and timing the duration that the reading broke a threshold, effectively reading the PWM output of the internal controller rather than the current.

If you’re interested in doing the high side monitoring, you can use the OpenServo design as a reference. There we are doing exactly as EddieB is suggesting with that very chip. The filter works much better with the OS than it would with a much lower frequency analog servo, though perhaps someone with more analog experience than I could help design a better filter.

You might be able to use some sort of synchronous detection method aligned with the actual servo frame to improve your filtering but, that is really getting carried away. I did not think anyone was looking for elaborate solutions to the problem. I also did not consider the PWM of the analog servo amplifier though so yeah, you would certainly need some aggresive filtering added to the circuit. If your time has value it seems like the open servo or figuring out how to use the feedback from the new hitec digital servos might be a better place for it.

I had the benefit of controlling the servo frame as I had built the pwm generators too. So the current sense, pot readings and pulse generators were all synched from the same line.

But again I want to stress that even once you have this data, it’s tough to interpret it very well. Stefan Engelke over at OpenServo has been doing some slick math to create the StateEstimator which generates a very good rotational velocity estimation from somewhat noisy position readings. He mentioned he’s working on extending it to include the data from the current sense chip to estimate load torque. From what I’ve seen from him so far, my hopes are high.