go_away

Author Topic: Current sensing of servomotors  (Read 2042 times)

0 Members and 1 Guest are viewing this topic.

Offline dustynrobotsTopic starter

  • Beginner
  • *
  • Posts: 3
  • Helpful? 0
Current sensing of servomotors
« on: August 10, 2011, 11:43:22 AM »
I'm in a total bind and need to find a quick way to measure current draw in 4 servo motors.  I just stumbled across the current sensing page here:
http://www.societyofrobots.com/sensors_currentsensor.shtml
which has a circuit that claims to sense current in servos.  However, here:
http://www.societyofrobots.com/actuators_servos.shtml
it says specifically that "servo current draw is very unpredictable" - and I'm finding that to be true!  I'm just using a microcontroller to sense voltage drop across a 1 ohm resistor in series with the ground wire of the servo (then get current through V=IR).  This worked fine for DC motors, but in servos, it's a disaster!  I'm using Hitec-7950 digital servos, and I'll get 1.6A current spikes when it's not moving, and flatlined current when the servo is moving.  It's totally erratic.  Is there anything I can do in software or hardware to get a reading that makes sense?  Has anyone tried the MAX471 chip circuit to confirm that it works?  If so I'll have to overnight myself one of those! 

Thanks

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: Current sensing of servomotors
« Reply #1 on: August 10, 2011, 02:07:10 PM »
I can't confirm operation of the MAX471 but the measurements you are doing sound correct.

Motors will draw a momentary high current when starting and a lower constant current when turning at a constant speed.
With a servo at a fixed position the error circuit will pulse the motor in one direction or the other to keep the servo's position constant. Since the motor is not turning when the error circuit pulses the motor the motor will draw the maximum current for a very short time. The MAX471 will not change this.

What is it you really need?
Peak current?
Average current?
Current to calculate battery life?
Jammed servo or against a stop?

Offline dustynrobotsTopic starter

  • Beginner
  • *
  • Posts: 3
  • Helpful? 0
Re: Current sensing of servomotors
« Reply #2 on: August 10, 2011, 02:41:35 PM »
Ideally I would like operating current vs. time, so I can infer torque vs. time during a certain task (measuring the stiffness of the thing I'm pushing on pretty much).  I thought that max circuit might smooth something out, but maybe not.  The weird thing is when I was using analog servos, I got consistent results at least - the servos drew almost no current at rest, but would draw current when moving.  If moving against no load, I would get a few pulses of a high current around 1.4V as it moved, then nothing once it got to position.  Against a load, I would get a lot more pulses at 1.4V, then nothing.  If the load was great enough to stall the motor, I would get consistent pulses to about 1.4V.  So, although not as easy as with DC motors, I could easily see when the motor was working harder by looking at the current vs. time graph.

However, I just switched to digital servos, and am not having the same luck.  The pulses are just all over the place, and don't correspond at all to when the motor is moving, no matter how much load is on the motor.  Thoughts?

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Current sensing of servomotors
« Reply #3 on: August 11, 2011, 12:07:45 AM »
Hi,

However, I just switched to digital servos, and am not having the same luck.  The pulses are just all over the place, and don't correspond at all to when the motor is moving, no matter how much load is on the motor.  Thoughts?
It's bound to have some influence when there's a load, but you'd need to sample at the exact right moments to catch it and that can be hard.

Digital or analog servos, I think a leaky integrator (i.e. a resistor over the cap) would be your best option for measuring servo current draw. You'll still need to choose the optimum integration and "disintegration" times for your application though.

If you want to dedicate an extra I/O line to the job, you could have it reset the integrator(s), either at preset intervals, or right before pushing something - then it shouldn't be leaky, but would need resetting before each measurement.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Current sensing of servomotors
« Reply #4 on: August 11, 2011, 09:49:59 PM »
Quote
Ideally I would like operating current vs. time, so I can infer torque vs. time during a certain task
I tried that like ~6 years ago. It's simply not possible to infer forces by measuring the current of a servo. The crazy measurements you got are the same as what I got - I tried hard to plot it out, but the chart looked like random zig-zags when I was done  . . .

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Current sensing of servomotors
« Reply #5 on: August 12, 2011, 06:03:41 AM »
Hi,

Did you try an integrator (a circuit, as it won't help trying to integrate a flawed signal mathematically)?
I'm pretty convinced that it would work, although I haven't tried it on a servo myself.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Current sensing of servomotors
« Reply #6 on: August 12, 2011, 06:14:23 AM »
Nothing would work. :-X

Strangely, servos can draw less power as static torque on it increases. Then when you reach some tipping point, some tiny increase, the current shoots up (or down) dramatically. Then add dynamic torque, and current is just completely unpredictable.

It definitely has something to do with the internal control system inside the servo.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Current sensing of servomotors
« Reply #7 on: August 14, 2011, 05:20:47 AM »
Hi,

Strangely, servos can draw less power as static torque on it increases. Then when you reach some tipping point, some tiny increase, the current shoots up (or down) dramatically.
Sounds like it could be the dead-band.
As long as the servo is inside the dead-band is should not use any particular current besides what its controller takes and perhaps narrow spikes (depending on the control strategy).
As soon as the pot is moved even a tiny bit outside the band, the controller should try to correct its position with as much power as it can muster.


It definitely has something to do with the internal control system inside the servo.
Agreed... But control system or not, I'm convinced that a correlation would show, if the signal was integrated.
After all, it boils down to power in/power out so, in lack of extremely high rate sampling and numerical integration, an integrator circuit is bound to show.

If the purpose is just for limiting peak current, rather than logging, a resistor and a transistor would be fine for eg. triggering an external interrupt, as there's no need to sample the signal. Another simple solution would be some sort of autonomous current limiting. I have a feeling that a chopper would be a very good limiter, as it would keep it at the max permissible power, while a resistor will reduce the voltage available.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline dustynrobotsTopic starter

  • Beginner
  • *
  • Posts: 3
  • Helpful? 0
Re: Current sensing of servomotors
« Reply #8 on: August 14, 2011, 09:25:10 AM »
I figured out a way to do it that I'll be writing up formally as part of a journal article (and will post the link then - but it could be a year!).  So long story short:  I used low side current sensing (resistor in series with ground wire of servo), pull off the analog voltage signal where the wire meets the resistor.  Then I moved the servomotor through a 0-90 degree range and recorded the current data from the millisecond I moved the potentiometer that controlled the servo out 4 seconds.  The servo had various levels of external load.  Then in MATLAB I smoothed the spikes by saying every time the raw value was below a certain number (25 in my case as I had a 10-bit ADC on the Arduino that read 0-1024), replace that number with the average of the two around it.  This took out the 0's and 1's in the data and smoothed the dramatic spikes.  Then I changed this raw reading to actual voltage (*5/1024) then current (I=V/R).  THEN I numerically integrated over those 4 seconds to get the area under the curve, then divided by 4 seconds.  This gives a "representative" current for the 0-90 sweep that although not indicative of current over time or mapped to a specific angle, at least gave me a means of comparing different trials with various external loads. 

Hope that makes some sense!  It did work for me - I saw the differences I needed to compare different cases.  I've also discovered the open servo project and they claim to do current sensing, and it would make sense to break this out at the motor level and not the control board level.  I think they do that but have not spent time with the schematic to confirm that.   

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: Current sensing of servomotors
« Reply #9 on: August 14, 2011, 12:56:02 PM »
Good work and short write up. Basically you did in software what Soeren was suggesting to do in hardware.
Now that you know what sample rates and integration times are needed you can design hardware to do this. That would be a nice addition to your journal article.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Current sensing of servomotors
« Reply #10 on: August 15, 2011, 09:19:31 AM »
ehhhh . . . it's not just the dead-band, or as dustynrobots described.

My experiment:
I hung various weights (to create a torque) on the servo, then measured the current for each torque. This means that the servo had a constant static load under steady state, so there were no fluctuations in current (with the exception of the fluctuations caused by PWM).

Then I plotted torque to current, and it had a zig-zag line. It should have been a smooth curving line, but it wasn't.

 


Get Your Ad Here