Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

control servo motor

control servo motor

2008-11-09 by wiyawan

hello, can you help me programing AVR to control servo motor ?, i
using atmega8535 and compiler use code vision. thx

Re: [AVR-Chat] control servo motor

2008-11-10 by David VanHorn

On Sun, Nov 9, 2008 at 6:55 PM, wiyawan <wwn_st3@yahoo.co.id> wrote:
> hello, can you help me programing AVR to control servo motor ?, i
> using atmega8535 and compiler use code vision. thx

Assuming you mean a radio-control type servo:

You'll need to output pulses of the appropriate width, for each of the
servos that you are controlling.
You can probably find out the appropriate widths on google for the
specific models (they do vary somewhat), but a 1mS pulse is a good
starting point.

The period between the pulses can be varied, shorter means more
accurate control.

What I've done in the past, is to store an array of bytes in ram with
0-255 values in each, and in the T0 ISR, load the appropriate byte,
calculate the proper timer value for T1, and load the timer value to
T1, and bring the proper output pin high.  When the T1 ISR fires, I
bring all the servo pins low. (easier than figuring out which one)

The T0 timer can be set to 1mS ints, and used for many different
timing functions.

Re: [AVR-Chat] control servo motor

2008-11-10 by David Kelly

On Mon, Nov 10, 2008 at 09:22:47AM -0500, David VanHorn wrote:
> 
> Assuming you mean a radio-control type servo:
> 
> You'll need to output pulses of the appropriate width, for each of the
> servos that you are controlling.
> You can probably find out the appropriate widths on google for the
> specific models (they do vary somewhat), but a 1mS pulse is a good
> starting point.

IIRC its 1.0 ms to 2.0 ms every 20 ms, with 1.5 ms being midstroke.
Thats what I saw last time I looked at the output of an R/C radio
receiver driving a common inexpensive servo. Didn't study any of the
then-new so-called PCM digital radios some of which require special
servos.

Driving one of these servos is easy using a timer and output compare.
Lots of ways to do it, using 1 timer, or 2, or PCM modes, or software,
or some combination of all. For perfect emulation of an R/C radio you
want a 20 ms period and the high output should be from 1.0 to 2.0 ms.

> The period between the pulses can be varied, shorter means more
> accurate control.

If so, thats new.

-- 
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Re: [AVR-Chat] control servo motor

2008-11-10 by David VanHorn

>> The period between the pulses can be varied, shorter means more
>> accurate control.

I worked with this a while back on the 8515.   With a longer delay
between pulses, the servo wasn't active as much, and with extreme
values, it turned into a "bang-bang-bang" kind of output, with each
pulse bringing the servo closer to proper position, and not driven
most of the time.  With high rates, the servo was noticably stiffer.
I didn't measure it, but I suspect that the motor is only driven for a
short while after the pulse stops.

I also found fairly large variations in the pulse widths for
"standard" servos.  IIRC 750uS was the bottom end.  I had a bunch of
different brands, and ended up implementing a table so that I could
set the servo brand per channel, and calculate the widths based on
what I measured for min and max on each.

1ms should be in-range for most anything.  Maybe 1.25 would be safer.

Something I didn't mention before, and I should have, is that you
don't want to hit the servos with pulses that are out of their
operating range.  They will run into the mechanical stops, and this is
hard on the motor and gears.  You can do it for short times, but  it's
best not to do it at all.

Re: [AVR-Chat] control servo motor

2008-11-10 by Sander Pool

This is probably obvious to the more experienced experimenters here but 
when I worked with servos and a mega128 I had spurious problems with my 
code that I traced back to the power supply getting 'hit' by the servos 
when they were being driven. Make sure you have separate power (common 
ground, of course) and a driver between your µC and servo.

As I recall I used one of the PWM channels.

    Sander

David VanHorn wrote:
Show quoted textHide quoted text
>
> >> The period between the pulses can be varied, shorter means more
> >> accurate control.
>
> I worked with this a while back on the 8515. With a longer delay
> between pulses, the servo wasn't active as much, and with extreme
> values, it turned into a "bang-bang-bang" kind of output, with each
> pulse bringing the servo closer to proper position, and not driven
> most of the time. With high rates, the servo was noticably stiffer.
> I didn't measure it, but I suspect that the motor is only driven for a
> short while after the pulse stops.
>
> I also found fairly large variations in the pulse widths for
> "standard" servos. IIRC 750uS was the bottom end. I had a bunch of
> different brands, and ended up implementing a table so that I could
> set the servo brand per channel, and calculate the widths based on
> what I measured for min and max on each.
>
> 1ms should be in-range for most anything. Maybe 1.25 would be safer.
>
> Something I didn't mention before, and I should have, is that you
> don't want to hit the servos with pulses that are out of their
> operating range. They will run into the mechanical stops, and this is
> hard on the motor and gears. You can do it for short times, but it's
> best not to do it at all.
>
> __

Re: [AVR-Chat] control servo motor

2008-11-11 by David VanHorn

On Mon, Nov 10, 2008 at 4:02 PM, Sander Pool <sander@tungstentech.com> wrote:
>
> This is probably obvious to the more experienced experimenters here but
> when I worked with servos and a mega128 I had spurious problems with my
> code that I traced back to the power supply getting 'hit' by the servos
> when they were being driven. Make sure you have separate power (common
> ground, of course) and a driver between your µC and servo.

Yes, the servo drain can be large, and however you handle the power,
you need to take that into account.  I also had some chip failures
until I inserted some series resistance in the control leads to the
servos. 100 ohms if I remember right.  I never bothered to work out
what caused it, the 100 ohm was an acceptably cheap fix.


> As I recall I used one of the PWM channels.

Yup, that's another way to do it. :)

Re: [AVR-Chat] control servo motor

2008-11-11 by Muhammad Amiruddin

i'm sorry before , but now i'm looking for a job, 
is there any job for microcontroller programmer especialy in Indonesia, if someone
know please inform me. I have been searching on Internet but i haven't found it until now
.. I need it so much. thanks before.
 

--- On Sun, 11/9/08, wiyawan <wwn_st3@yahoo.co.id> wrote:
Show quoted textHide quoted text
From: wiyawan <wwn_st3@yahoo.co.id>
Subject: [AVR-Chat] control servo motor
To: AVR-Chat@yahoogroups.com
Date: Sunday, November 9, 2008, 11:55 PM






hello, can you help me programing AVR to control servo motor ?, i
using atmega8535 and compiler use code vision. thx

 














      

[Non-text portions of this message have been removed]

Re: control servo motor

2008-11-12 by Rick

--- In AVR-Chat@yahoogroups.com, "wiyawan" <wwn_st3@...> wrote:
>
> hello, can you help me programing AVR to control servo motor ?, i
> using atmega8535 and compiler use code vision. thx
>


I see numerous people have responded with suggestions on how to
control a servo actuator ( such as those common in R/C models ), but
"servo motor" is something else.

Bls: [AVR-Chat] Re: control servo motor

2008-11-12 by wiyawan sumari

i using servo to control leg of legged robot. any sugestin todo that?. thx




________________________________
Dari: Rick <eprom999@yahoo.com>
Kepada: AVR-Chat@yahoogroups.com
Terkirim: Kamis, 13 November, 2008 02:11:18
Topik: [AVR-Chat] Re: control servo motor


--- In AVR-Chat@yahoogroup s.com, "wiyawan" <wwn_st3@... > wrote:
>
> hello, can you help me programing AVR to control servo motor ?, i
> using atmega8535 and compiler use code vision. thx
>

I see numerous people have responded with suggestions on how to
control a servo actuator ( such as those common in R/C models ), but
"servo motor" is something else.

    


      ___________________________________________________________________________
Nama baru untuk Anda! 
Dapatkan nama yang selalu Anda inginkan di domain baru @ymail dan @rocketmail. 
Cepat sebelum diambil orang lain!
http://mail.promotions.yahoo.com/newdomains/id/

[Non-text portions of this message have been removed]

Re: Bls: [AVR-Chat] Re: control servo motor

2008-11-14 by Muhammad Amiruddin

as i know,
 
servo motor can be driven base on the long time between the changes of logic from high    ( ' 1' ) to low ( ' 0 ' ) or the opposite from low ( ' 0 ' ) to high ( ' 1' ) . It can say that we try to regulate the periode time of the time high and time low.
 
if you already read some literature of servo motor , you will know that motor need a particular time high and time low to move.if the time high and time low run continue it will cause a PWM.
 
for one periode of PWM can make move the servo motor just for once certain degree circling.
 
so from that, we can make the program for uC to make an output like that on certain bit of port.
 
simple isn't? now your turn to try.
okay i give a picture maybe can help you.
 
 


--- On Wed, 11/12/08, wiyawan sumari <wwn_st3@yahoo.co.id> wrote:
Show quoted textHide quoted text
From: wiyawan sumari <wwn_st3@yahoo.co.id>
Subject: Bls: [AVR-Chat] Re: control servo motor
To: AVR-Chat@yahoogroups.com
Date: Wednesday, November 12, 2008, 11:30 PM






i using servo to control leg of legged robot. any sugestin todo that?. thx

____________ _________ _________ __
Dari: Rick <eprom999@yahoo. com>
Kepada: AVR-Chat@yahoogroup s.com
Terkirim: Kamis, 13 November, 2008 02:11:18
Topik: [AVR-Chat] Re: control servo motor

--- In AVR-Chat@yahoogroup s.com, "wiyawan" <wwn_st3@... > wrote:
>
> hello, can you help me programing AVR to control servo motor ?, i
> using atmega8535 and compiler use code vision. thx
>

I see numerous people have responded with suggestions on how to
control a servo actuator ( such as those common in R/C models ), but
"servo motor" is something else.

____________ _________ _________ _________ _________ _________ _
Nama baru untuk Anda! 
Dapatkan nama yang selalu Anda inginkan di domain baru @ymail dan @rocketmail. 
Cepat sebelum diambil orang lain!
http://mail. promotions. yahoo.com/ newdomains/ id/

[Non-text portions of this message have been removed]

 














      

[Non-text portions of this message have been removed]

Re: Bls: [AVR-Chat] Re: control servo motor

2008-11-14 by Rick B.

.
Pulse width modulation.  1 to 2 milliseconds, 50 hz.
.


--- On Wed, 11/12/08, wiyawan sumari <wwn_st3@yahoo.co.id> wrote:
Show quoted textHide quoted text
From: wiyawan sumari <wwn_st3@yahoo.co.id>
Subject: Bls: [AVR-Chat] Re: control servo motor
To: AVR-Chat@yahoogroups.com
Date: Wednesday, November 12, 2008, 6:30 PM










    
            i using servo to control leg of legged robot. any sugestin todo that?. thx



____________ _________ _________ __

Dari: Rick <eprom999@yahoo. com>

Kepada: AVR-Chat@yahoogroup s.com

Terkirim: Kamis, 13 November, 2008 02:11:18

Topik: [AVR-Chat] Re: control servo motor



--- In AVR-Chat@yahoogroup s.com, "wiyawan" <wwn_st3@... > wrote:

>

> hello, can you help me programing AVR to control servo motor ?, i

> using atmega8535 and compiler use code vision. thx

>



I see numerous people have responded with suggestions on how to

control a servo actuator ( such as those common in R/C models ), but

"servo motor" is something else.



____________ _________ _________ _________ _________ _________ _

Nama baru untuk Anda! 

Dapatkan nama yang selalu Anda inginkan di domain baru @ymail dan @rocketmail. 

Cepat sebelum diambil orang lain!

http://mail. promotions. yahoo.com/ newdomains/ id/



[Non-text portions of this message have been removed]




      

    
    
	
	 
	
	








	


	
	


      

[Non-text portions of this message have been removed]

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.