go away spammer

Author Topic: servo problem  (Read 5417 times)

0 Members and 1 Guest are viewing this topic.

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
servo problem
« on: January 30, 2008, 05:12:34 PM »
i wrote this little code to turn my servo to -90

Code: [Select]

while (1)
      {                       
      PORTD.7 = 1;
      delay_us(200);
      delay_us(200);
      delay_us(200);
      delay_us(200);
      delay_us(100);
      PORTD.7 = 0;
      delay_ms(19);
      delay_us(100);}

i also made sure that the portd is an out and i did include the delay library and the xtal freq is set right,,,
problem is that the servo is turning into +90 with jerky steps,, somthin is wrong,,
anyone can help?
good ol' BeNNy

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: servo problem
« Reply #1 on: February 01, 2008, 02:53:49 PM »
Your delay is .9ms . . . make it to 1.4ms and see if it centers.

If it doesn't center then there is something else wrong with your code . . .

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: servo problem
« Reply #2 on: February 01, 2008, 03:53:46 PM »
Quote
Your delay is .9ms .

thats the pulse width to make it turn to -90 i suppose
good ol' BeNNy

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: servo problem
« Reply #3 on: February 02, 2008, 09:34:25 AM »
Yea this is just to verify that your clock is what you think it is.

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: servo problem
« Reply #4 on: February 04, 2008, 05:05:19 PM »
ill do this once i get my programmer pcb back,,
anyways i was thinking ,,im feeding my servo from a 6 volt battery but this batter cant provide more than 300mA but anyways im not putting any load on the servo,would this affect its motion?
and by the way, should the micro and the servo share the same ground?
good ol' BeNNy

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: servo problem
« Reply #5 on: February 06, 2008, 12:22:26 PM »
So what would happen if your servo requires 400mA, your microcontroller requires 20mA, and your battery can only supply 300mA?

I'm sure you can figure out the problem there ;)

Quote
should the micro and the servo share the same ground?
yes! keep your grounds common!

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: servo problem
« Reply #6 on: February 06, 2008, 04:14:23 PM »
Quote
So what would happen if your servo requires 400mA,

that was actually the heart of my question
would my servo require such big current when operating with no mechanical loads?

i jus wanna use this battery when i check my codes with the motor with no loads at all
good ol' BeNNy

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: servo problem
« Reply #7 on: February 07, 2008, 09:25:58 AM »
Well if your motor requires 400mA and it only gets 290mA, its obviously going to be much weaker/slower.

And if your microcontroller requires 20mA but only gets 10mA, it just won't work, or will act very strangely.

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: servo problem
« Reply #8 on: February 11, 2008, 07:55:25 AM »
hey folks, i jus hav a lil question
what happens when loading the servo motor with a very big load that it cant push?? would it burn?
good ol' BeNNy

Offline gmatkins

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: servo problem
« Reply #9 on: February 11, 2008, 08:26:57 AM »
It "stalls". That means it draws a whole heap of current, but doesn't actually move. Unless I'm way off this shouldn't set it on fire or anything. Basically the rotor of the motor is held in a static position, which means after time the coil that makes the motor move will just behave like any other piece of wire.

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: servo problem
« Reply #10 on: February 11, 2008, 04:32:56 PM »
well does this mean that the motor would be to trash? or it will still work after this but with less performance?
good ol' BeNNy

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: servo problem
« Reply #11 on: February 11, 2008, 07:55:45 PM »
If a motor has huge amounts of current, it will heat up.

If it heats up faster than it cools from the air around it, then the temperature will rise.

High temperatures will cause the motor coils to melt/fuse, and the motor driver inside it to fry/crack.

Servos are designed to take abuse, but not forever.

In short, if you stall a motor, you reduce the lifetime until its been 'trashed' (destroyed, hence you throw it away in the trash).

Offline TrickyNekro

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,208
  • Helpful? 15
  • Hardware and Firmware Designer
    • The Hellinic Robots Portal
Re: servo problem
« Reply #12 on: February 12, 2008, 01:00:55 AM »
In short, if you stall a motor, you reduce the lifetime until its been 'trashed' (destroyed, hence you throw it away in the trash).

But still!!! It has a nice small ESC on it!!!
You probably be a able to drive a small hobby - toy motor with the dead servo's electronics!!! (forward / backward)

And as mentioned before... servos can handle a lot abuse... but just don't over do it...
Also keep the gear box and try to find a motor fitting to replace the old-burned motor... This will reduce the whole maintenance cost of your project-robot
For whom the interrupts toll...

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: servo problem
« Reply #13 on: February 12, 2008, 10:55:25 PM »
In short, if you stall a motor, you reduce the lifetime until its been 'trashed' (destroyed, hence you throw it away in the trash).

But still!!! It has a nice small ESC on it!!!
You probably be a able to drive a small hobby - toy motor with the dead servo's electronics!!! (forward / backward)

And as mentioned before... servos can handle a lot abuse... but just don't over do it...
Also keep the gear box and try to find a motor fitting to replace the old-burned motor... This will reduce the whole maintenance cost of your project-robot

Small hobby motors fit inside standard servos and can replace the previous motor in there
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: servo problem
« Reply #14 on: February 15, 2008, 05:22:30 AM »
i got to turn my servo from -90 to +90 and +90 to -90 and so on,, but thats the servo speed (the one written on it)
so changing the PWM directly would let your servo operate at its maximum speed.
i dont want to move that fast , i want it to take longer, so should i change the PWM gradually?
wouldnt that by too much coding?
good ol' BeNNy

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: servo problem
« Reply #15 on: February 15, 2008, 12:13:05 PM »
Quote
i want it to take longer, so should i change the PWM gradually?
sure . . . it will be easy/obvious when you try it

Offline benjiTopic starter

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: servo problem
« Reply #16 on: February 22, 2008, 06:14:43 AM »
well i did give a 1.5 ms on pwm and the servo is centered
,i then gave it a 2.1 ms on pwm (supposed to go to +90(datasheet)), it went to about +45
,, any one can give me the +90 and -90 pwms for the hitec HS-322HD servo?

good ol' BeNNy

 


Get Your Ad Here