Author Topic: Cant center servo  (Read 4607 times)

0 Members and 1 Guest are viewing this topic.

Offline TSITopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Cant center servo
« on: November 07, 2008, 05:04:37 PM »
So I was trying my hand at the $50 robot but I cant seem to get my HS-311 servos to center. Whenever I try to use the centering .hex file on here it just spins. If I try to write my own code and send various signals to the servo it does the same thing....just spins. I cant even get it to spin in the other direction. I can turn the pot, very slowly, from 1 side to the other and the motor never stops spinning.

Im using the ATMega8 chip with the AVRISP mkII programmer and AVR studio 4. I verified that the CKSEL is set to the default setting of "int rc osc 1 Mhz:startup time 6CK + 64msldefault" (so the timing im using should work).

Any ideas?

Offline Rebelgium

  • Supreme Robot
  • *****
  • Posts: 637
  • Helpful? 0
  • It's called the future ... We like it here
    • orgcrime.net
Re: Cant center servo
« Reply #1 on: November 07, 2008, 06:59:52 PM »
spinning?
Are your servo's modified?
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline TSITopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Cant center servo
« Reply #2 on: November 07, 2008, 07:17:20 PM »
Not yet thats what im trying to do.

Even if I plug a non moded servo, with code to tell it to go to the 0 position, it turns all the way to one side and I can hear it trying to keep spining. Ive tried this on 3 servos and and get the same result. It almost seems like something with the delays im using (which come from the clock) are sending a position to the servo that it cant get to....

Offline ArcMan

  • Supreme Robot
  • *****
  • Posts: 519
  • Helpful? 4
  • Mmmm... Plasma
Re: Cant center servo
« Reply #3 on: November 07, 2008, 08:29:02 PM »
It sounds like your pulse width is not "center" - ~1.5 ms.  Do you have a scope to check?

Offline TSITopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Cant center servo
« Reply #4 on: November 07, 2008, 08:32:03 PM »
I wish I had a scope.

Even if the pulse was "slightly" off it should be near center. I can go from end to end with no slow down in the motor. Ive even tried to go outside of the calculated range and still cant get the thing to slow down or turn around.

Offline ArcMan

  • Supreme Robot
  • *****
  • Posts: 519
  • Helpful? 4
  • Mmmm... Plasma
Re: Cant center servo
« Reply #5 on: November 08, 2008, 09:31:49 AM »
What do you mean - end to end?

Also, since you don't have a scope, you could use an R/C radio to narrow down your problem.  Connect the servo the the R/C receiver to see if it still behaves badly.  If it does, you'll know it's a servo problem.  If it works OK, you'll know the problem is on the uC end.

Offline TSITopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Cant center servo
« Reply #6 on: November 08, 2008, 09:42:58 AM »
Ive tested 3 servos, so I highly doubt its a servo problem.

By end to end I mean from -90 position to 0 to +90 position.

So if I send a a 0 position pulse, I should be able to stop the gears from spinning by moving the pot to the 0 position...on the modded servos. But there is no position of the pot that will cause the motor to stop, or even slow down.

And on a non modded servo if I send the 0 position pulse it should just go to position 0, straight....but these just turn to -90 and keep trying to turn.
« Last Edit: November 08, 2008, 09:47:22 AM by TSI »

Offline ArcMan

  • Supreme Robot
  • *****
  • Posts: 519
  • Helpful? 4
  • Mmmm... Plasma
Re: Cant center servo
« Reply #7 on: November 08, 2008, 09:53:20 AM »
OK.  It definitely sounds like your pulse width is not within range (1-2ms).  I assume you reviewed your code over and over again to find the error.
I'm not clever enough to know how to actually measure the pulse width without a scope (and without going to other great lengths electronically).
A DC PWM measurement won't work because that will just give you duty cycle, not pulse width.

Offline TSITopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Cant center servo
« Reply #8 on: November 08, 2008, 10:15:54 AM »
Im gona try to use _delay_ms from dealy.h to calculate the time rather than just try to count cycles.

Just to double check...I send a pulse for 1.5ms then I wait 20ms then repeat right?


My other question would be specifying the the clock speed. The actual clock speed of the chip is set via fuse and the then I tell the code the speed in what the global header or the makefile?

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Cant center servo
« Reply #9 on: November 08, 2008, 12:46:54 PM »
Definitely sounds like a timing issue - due to either your program or incorrect oscillator setting
Check out the Roboduino, Arduino-compatible board!


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

www.Narobo.com

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts
Re: Cant center servo
« Reply #10 on: November 08, 2008, 02:24:21 PM »
Make sure ALL of your grounds in the circuit are interlinked somehow. One time on a PIC board I forgot to connect the ground, and no matter what the servo just spun towards one side. Once I connected the ground, it was all fixed.

If you are using the visual $50 robot schematic, the one you view in PDF form, there are two wires hidden under the picture of the microcontroller. Uncheck the box to show the microcontroller, and those two wires will be revealed... make sure those are connected.

Offline Rebelgium

  • Supreme Robot
  • *****
  • Posts: 637
  • Helpful? 0
  • It's called the future ... We like it here
    • orgcrime.net
Re: Cant center servo
« Reply #11 on: November 08, 2008, 02:25:30 PM »

Just to double check...I send a pulse for 1.5ms then I wait 20ms then repeat right?


No, you send a pulse for 1.5ms, and then wait for 20ms-1.5ms, and then repeat.
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline TSITopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Cant center servo
« Reply #12 on: November 08, 2008, 03:31:30 PM »
So then everytime I change the pulse duration I have to compensate for that in the duration of the wait between? I thought the servo was looking for pulses in 20ms increments not a pulse every 20ms....ill try the other way.

Offline sdavis6736

  • Jr. Member
  • **
  • Posts: 26
  • Helpful? 0
Re: Cant center servo
« Reply #13 on: November 08, 2008, 06:31:13 PM »
Razor Concepts has a very valuable suggestion.  I would check the common ground as he/she mentioned.  I had the exact same problem you are describing on my robot and common ground was the solution.
« Last Edit: November 08, 2008, 06:43:03 PM by sdavis6736 »

Offline mbateman

  • Full Member
  • ***
  • Posts: 82
  • Helpful? 0
    • Robotics 4 Fun
Re: Cant center servo
« Reply #14 on: November 08, 2008, 06:38:02 PM »
Technically, the servos want to see one pulse every 20mS, but in reality, most servos are very forgiving. I have found that anywhere between 20 and 40 mS does not seen to make any significant difference. I don't think that is your problem.

Offline TSITopic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
Re: Cant center servo
« Reply #15 on: November 08, 2008, 08:17:59 PM »
It in fact was the common ground!

Thanks to everyone who helped and especially Razor Concepts. This thing was driving me 100% insane! I did have my ground connected at first but i think one of the wires came loose.

Offline sdavis6736

  • Jr. Member
  • **
  • Posts: 26
  • Helpful? 0
Re: Cant center servo
« Reply #16 on: November 09, 2008, 06:49:54 AM »
Yahoo!!  I'm glad you took the time to check this out.  Common ground is "vitally" important!  I never built the $50 robot, but the robots I have built the common ground was a major problem.  Don't forget it!!  I even have a BIG note on my white board in RED ink written to remind me (I'm old so I need the reminder).  There was another post I read before this one who is having the same kind of problem.  Hope this person has the same willingness to accept direction as you did.  It will save a lot of hard time.  Good luck on your future adventures. 

 


Get Your Ad Here

data_list