go away spammer

Author Topic: Digital versus Analog Servo control  (Read 10406 times)

0 Members and 1 Guest are viewing this topic.

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Digital versus Analog Servo control
« on: October 05, 2006, 10:19:55 PM »
Hey guys,

I have an Atmega32 microcontroller, i already have working code that will control an analog servo and change positions and such. Yet the code will not work for my digital servo, i read the stuff on digital vs analog and i know they recieve info at a higher frequency and such, but i have no idea how to reflect that in my code :(

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Digital versus Analog Servo control
« Reply #1 on: October 06, 2006, 06:46:45 AM »
Digital Servo Tutorial

Digital servos can be controlled exactly the same as an analog servo. Perhaps the frequency it should recieve is slightly different that your analog signal - try increasing/decreasing the frequency until the servo moves.

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Re: Digital versus Analog Servo control
« Reply #2 on: October 06, 2006, 04:28:36 PM »
I'm fairly new to this stuff,

If i play with the # of milliseconds the pin is a high/low that will change the ange of my analog servo, but if i mess around with that on my digital servo the servo stay at the same exact angle through all the changes.

What do you mean by frequency?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Digital versus Analog Servo control
« Reply #3 on: October 06, 2006, 04:43:30 PM »
OK I guess what I meant was pulse width, not frequency. Hmmm so a digital servo will usually go to and hold some angle with force if it recieves a signal outside of the allowable signal.

Start the high pulse at 1000us and increase that by 10us intervals - it should work somewhere between 1000us and 1600us.

When you do a pin high command, are you using a variable to store the number of microseconds, or are you just giving it a number? Variables max out at 256 when calling time delays . . .

Does the same exact code work if you just swap to the analog servo?

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Re: Digital versus Analog Servo control
« Reply #4 on: October 06, 2006, 05:32:33 PM »
I did what you told me with the PWM but with no luck :(

The code works for my analog servo and changes angle, but with my digital it hold the angle but no matter what the PWM is its always the same angle :(

My time delay variable is set to max at 4294977295 (its an unsigned long int)

I dont know what to do, is it possible my servo is "broken"?

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Re: Digital versus Analog Servo control
« Reply #5 on: October 06, 2006, 09:27:25 PM »
Okay i think i did the 1000us wrong.


I figured out my servo gets a signal every 3.33 ms instead of the standard 20 ms, so the time that the pin is out i gonig to being somwhere between .1 - .001, so ill test that thanks!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Digital versus Analog Servo control
« Reply #6 on: October 06, 2006, 09:47:31 PM »
Hmmmm its worth a try but dont think that is the problem. The robot I am working on now, the digital servos get a pulse every 5.6ms.

Im not sure about atmel, but I do know that PIC's dont allow time delays stored as variables to exceed 255.

Can you post the group of code that you use to command the servo?

Do you have an oscilliscope to measure the pulse width?

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Re: Digital versus Analog Servo control
« Reply #7 on: October 06, 2006, 09:57:27 PM »
Before i answer your questions above, i have a quick question.

All this PWM research ive been doing has confused everything i once thought was right....

lets say the PWM is 20 ms, and i set my pin to high for 1.5 ms, then does that mean it had to be low for 18.5 ms and cyclced at like that?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Digital versus Analog Servo control
« Reply #8 on: October 06, 2006, 11:33:52 PM »
Servos dont really care how long the low signal is. If its within say 50ms low, and 1.5ms high, it will work fine. If it is low too long, the servo will 'forget' its supposed to do something. The only part that matters is how long the high signal lasts, as that directly determines the servo angle. A low signal that lasts only 5ms will also work fine.

 


Get Your Ad Here