Author Topic: Servo rotates in one direction  (Read 1803 times)

0 Members and 1 Guest are viewing this topic.

Offline robotcoderTopic starter

  • Full Member
  • ***
  • Posts: 53
  • Helpful? 0
Servo rotates in one direction
« on: July 13, 2009, 12:13:06 AM »
I just modified 2 servos (HS-311) to rotate in 360 and I can get one of them to move clockwise and counter clockwise, but the other servo only moves in one direction.  Any ideas on what I can do to correct this?

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: Servo rotates in one direction
« Reply #1 on: July 13, 2009, 12:21:57 AM »
does the servo stop if you send a 1.5ms pulse (center)?
Howdy

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: Servo rotates in one direction
« Reply #2 on: July 13, 2009, 12:23:23 AM »
you probably did not properly center the servo(s).  The potentiometer inside the servo has to be fixed at its neutral position to fool the servo.

http://www.societyofrobots.com/actuators_modifyservo.shtml

step 5

Offline robotcoderTopic starter

  • Full Member
  • ***
  • Posts: 53
  • Helpful? 0
Re: Servo rotates in one direction
« Reply #3 on: July 13, 2009, 12:28:41 AM »
I am new to all of this, so I am not sure exactly how to send 1.5ms.  I am using the sample code for the $50 robot, so to move the servo's I am using, for example C7(500);  If you have a code example of how to send 1.5ms to the servo that would help.  Thanks for the reply.

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: Servo rotates in one direction
« Reply #4 on: July 13, 2009, 12:31:25 AM »
set the pin high, wait 1500us, set the pin low.
if i can find the code anywhere ill upload it for you.

EDIT: here it is http://www.societyofrobots.com/downloads/hold_servo.hex
« Last Edit: July 13, 2009, 12:33:58 AM by SmAsH »
Howdy

Offline Joker94

  • Supreme Robot
  • *****
  • Posts: 1,119
  • Helpful? 26
Re: Servo rotates in one direction
« Reply #5 on: July 13, 2009, 12:37:04 AM »
one time the cord that connects to the mcu board had a break in one of the lines there for only span one way

it is most likely not that, mabey  .0000000000005  % chance  

the reason it happened to me is i had a box or carbon fibre sheets fell onto my servo box which pearced the servo cable, if that ever happens hold you shipper accountable.

good luck finding the problem

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: Servo rotates in one direction
« Reply #6 on: July 13, 2009, 12:40:07 AM »
a servo works by listening for a 50Hz pulse.  The length of he pulse is ~ from 1 to 2 ms. 1500us or 1.5ms is the pulse length to make the servo go t the center position.
So essentially

set pin HIGH
_delay_us(time)
set pin LOW
_delay_us(20000-time)
  
time equates to the pulse time of 1 to 2 ms that is the general idea.
« Last Edit: July 13, 2009, 12:41:29 AM by sonictj »

Offline robotcoderTopic starter

  • Full Member
  • ***
  • Posts: 53
  • Helpful? 0
Re: Servo rotates in one direction
« Reply #7 on: July 13, 2009, 12:42:43 AM »
I just found this example code, I will try this and see what the servo does.

int main()
{
   int i;
   DDRB = 0xff;
   PORTB = 0xff;
   while(1)
   {
      //Hold the motor in neutral for 2 seconds (Each signal is 20ms, so repeating that 100 times = 2000 sec

      for(i=0;i<101;i++)
      {
         PORTB = 0xff;
         _delay_ms(1.5);
         PORTB = 0x00;
         _delay_ms(18.5);
      }
      //Turn 90deg clockwise for 2 sec
      for(i=0;i<101;i++)
      {
         PORTB = 0xff;
         _delay_ms(2);
         PORTB = 0x00;
         _delay_ms(18);
      }
      //Turn to -90deg ccw, while passing the neutral state for 2 sec
      for(i=0;i<101;i++)
      {
         PORTB = 0xff;
         _delay_ms(1);
         PORTB = 0x00;
         _delay_ms(19);
      }
   }
return 1;      
}

Offline sonictj

  • Supreme Robot
  • *****
  • Posts: 416
  • Helpful? 11
Re: Servo rotates in one direction
« Reply #8 on: July 13, 2009, 12:45:54 AM »
what pin do you have the servo connected to?  Do you have anything else connected to PORTB?

 


Get Your Ad Here