Author Topic: GWS S03T servo control  (Read 1957 times)

0 Members and 1 Guest are viewing this topic.

Offline kalu125Topic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
GWS S03T servo control
« on: October 03, 2010, 01:27:38 AM »

Hi,
Im adding IR range finder to my $50 robot. i want my range finder to detect objects rather than tracing a object. for that i want my scan servo turn 0 position 90 (neutral) position and 180 position. i have already modified my $50 robot to use 8MHz clock because a added UART functionality to it.  i tried to control my scan servo angle as follows,

servo_scan(232);  //  (23/0.992)*1.25*8
servo_scan(278);  //  (23/0.992)*1.5*8
servo_scan(325);  //  (23/0.992)*1.75*8

void servo_scan(signed long int speed)
{  
   PORT_ON(PORTD, 4);
   delay_cycles(speed);      
   PORT_OFF(PORTD, 4);
   delay_cycles(1600);
}

but servo doesn't work as i hoped  ???
please let me know how can i control my servo in the way that i want
Thanks


Offline kalu125Topic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: GWS S03T servo control
« Reply #1 on: October 03, 2010, 01:28:35 AM »

Hi,
Im adding IR range finder to my $50 robot. i want my range finder to detect objects rather than tracing a object. for that i want my scan servo turn 0 position 90 (neutral) position and 180 position. i have already modified my $50 robot to use 8MHz clock because a added UART functionality to it.  i tried to control my scan servo angle as follows,

servo_scan(232);  //  (23/0.992)*1.25*8
servo_scan(278);  //  (23/0.992)*1.5*8
servo_scan(325);  //  (23/0.992)*1.75*8

void servo_scan(signed long int speed)
{  
   PORT_ON(PORTD, 4);
   delay_cycles(speed);      
   PORT_OFF(PORTD, 4);
   delay_cycles(1600);
}

but servo doesn't work as i hoped  ???
please let me know how can i control my servo in the way that i want
Thanks



im still stuck Huh does any body have an idea??
i opened up my servo and when it comanned by servo_scan(278);
it comes to the center position from both ends.
what i did is, turn servo feed back hone to one end manually and switch on my mcu wich including above command program.
then it comes to centre position.
again switch off the mcu and bring servo feed back hone to other end, and switch on my mcu.
servo turns to center position.

so i thought that servo_scan(278); will bring my servo to netral (90 degree) position.

but when i command it as
                servo_scan(278); //90
      servo_scan(200); //0
      servo_scan(278); //90
      servo_scan(340); //180

it gets stuck   ???

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: GWS S03T servo control
« Reply #2 on: October 03, 2010, 12:06:23 PM »
Hi,

Doesn't it move away from the neutral position at all, no matter the code?
Have you tried it with more than one servo?

If you have access to an oscilloscope, look at the signal going to the servo (servo not connected).
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 kalu125Topic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: GWS S03T servo control
« Reply #3 on: October 03, 2010, 06:49:34 PM »
Hi,

Doesn't it move away from the neutral position at all, no matter the code?
Have you tried it with more than one servo?

If you have access to an oscilloscope, look at the signal going to the servo (servo not connected).


Thanks for your reply Soeren,
 
yes with my previous code it does not move away from the neutral position.
but unfortunately i don't have an oscilloscope.

i spent followed the trial and error method and my code like this,
void left(void)
{
  servo_scan(278);
  servo_scan(280);
  servo_scan(282);
  servo_scan(284);
  servo_scan(286);
  servo_scan(288);
}

void right(void)
{
  servo_scan(278);
  servo_scan(276);
  servo_scan(274);
  servo_scan(272);
  servo_scan(270);
  servo_scan(268);
}

void middle(void)
{
  servo_scan(278);
  servo_scan(278);
  servo_scan(278);
  servo_scan(278);
  servo_scan(278);
  servo_scan(278);
}

now it moves here and there, but still i don't have clear idea about the values those i should pass to servo_scan() to
move my servo sharply 0degree, 90 degree and 180 degree.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: GWS S03T servo control
« Reply #4 on: October 03, 2010, 07:17:59 PM »
Hi,

[...] now it moves here and there, but still i don't have clear idea about the values those i should pass to servo_scan() to
move my servo sharply 0degree, 90 degree and 180 degree.
Just increase and decrease the outer values in say 5 a time until you get the wanted response - don't go any further, as the servo will then try to break the end stops (and perhaps burn the windings or snapping a cog or two while trying).

Don't have it go to a multitude of positions, just have it go to one (low) value, stay there a second or two, then to another (high) value - start and return at or near neutral position.
Then increment and/or decrement as needed and try again.
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 kalu125Topic starter

  • Jr. Member
  • **
  • Posts: 12
  • Helpful? 0
Re: GWS S03T servo control
« Reply #5 on: October 08, 2010, 07:49:29 PM »
Hi,

[...] now it moves here and there, but still i don't have clear idea about the values those i should pass to servo_scan() to
move my servo sharply 0degree, 90 degree and 180 degree.
Just increase and decrease the outer values in say 5 a time until you get the wanted response - don't go any further, as the servo will then try to break the end stops (and perhaps burn the windings or snapping a cog or two while trying).

Don't have it go to a multitude of positions, just have it go to one (low) value, stay there a second or two, then to another (high) value - start and return at or near neutral position.
Then increment and/or decrement as needed and try again.



I modified my program as follows,


void servo_scan(signed long int speed)
{
   
   PORT_ON(PORTD, 3);
   delay_cycles(speed);      
   PORT_OFF(PORTD, 3);//keep off
   delay_cycles(380-speed);
}

while(1){

        for(i=160; i<=360; i++){
        servo_scan(i);
        servo_scan(i);
        servo_scan(i);
        }
        for (i=360; i >=192; i--){
            servo_scan(i);
       servo_scan(i);
       servo_scan(i);
   }
}

then it works,

but when i change the delay value of my servo_scan() function as follows,
void servo_scan(signed long int speed)
{
   
   PORT_ON(PORTD, 3);
   delay_cycles(speed);      
   PORT_OFF(PORTD, 3);//keep off
   //delay_cycles(380-speed);
        delay_cycles(1600); // change delay cycles
}

it didn't work  ???

i again changed it to previous value, but my servo doesn't move any more.
i think my servo got burnt, how can i make sure that the servo it burnt??? ???

 


Get Your Ad Here