Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: servo motor control

  1. #11
    Senior Member T-1000
    Join Date
    Jun 2007
    Location
    Jamshedpur/Bhubaneswar
    Posts
    421

    Default

    Heres the code to Control Servos From PWM from TIMER1 Module

    Code:
    #include <avr/io.h>
    #include <util/delay.h>
    
    void main()
    {
    	TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11);
    	TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11)|(1<<CS10);//PRESCALER=64 MODE 14(FAST PWM)
    
    	ICR1=4999;	//fPWM=50Hz (Period = 20ms Standard).
    
    	DDRD|=(1<<PD4)|(1<<PD5);	//PWM Pins as Out
    
    	OCR1A=374;
    	OCR1B=374;	//Servos In Neutral Position (90 degree).
    
    	//Now you can set OCR1A and OCR1B inbetween 312 and 437 to get
    	//angles between 0 and 180 degrees
    
    	OCR1A=437;	//Servo in 180 degree
    
    
    }
    Connect Servo Control Line to OC1A (PD5) PIN (PIN19)

    Make sure AVR Fuse is
    LOW=0xFF HIGH=C9

    And The XTAL is 16MHz

    By the way I am not helping you Individually.

    I am posting it here so that other RI members and visitors may use it!
    Avinash Gupta
    ************
    www.eXtremeElectronics.co.in

  2. #12
    Senior Member Cyborg sudarshan's Avatar
    Join Date
    Jun 2008
    Location
    Virudhunagar - 626001, Tamilnadu, India
    Posts
    180

    Default

    thanks avinash_g for the code it was really helpfull
    also publish article on you site

  3. #13
    Senior Member T-1000
    Join Date
    Jun 2007
    Location
    Jamshedpur/Bhubaneswar
    Posts
    421

    Default

    Any one know the exact timing for Futaba S3003 ??? I mean the pulse width for 0 90 and 180 degrees ??? And the PWM Period.

    In the above Code I have used standard value
    Fpwm=50Hz
    0 degree=1.25 ms 90 = 1.50ms and 180 = 1.75 ms
    Avinash Gupta
    ************
    www.eXtremeElectronics.co.in

  4. #14
    Senior Member T-1000
    Join Date
    Jun 2007
    Location
    Jamshedpur/Bhubaneswar
    Posts
    421
    Avinash Gupta
    ************
    www.eXtremeElectronics.co.in

  5. #15
    Senior Member Cyborg sudarshan's Avatar
    Join Date
    Jun 2008
    Location
    Virudhunagar - 626001, Tamilnadu, India
    Posts
    180

    Thumbs up thanks

    hi
    i modified my robot by changing the servo control with timer
    my robot works fine .
    i hope you would publish this article in you webpage to.

    thank you,
    Sudarshan
    robot.superrobot.co.in
    BY
    Sudarshan Anbazhagan,
    SuperBotics MultiTech Pvt. Ltd.

    http://www.superbotics.com
    http://www.getahost.in

  6. #16
    Senior Member T-1000
    Join Date
    Mar 2005
    Location
    Bangalore
    Posts
    728
    Blog Entries
    7

    Default

    Just to add on,,

    IF you are just controlling a couple of servos, a couple of 555s are enough.
    A micro is not necessary at all.
    .... I didnt do it ! ....

  7. #17
    Senior Member T-1000
    Join Date
    Jun 2007
    Location
    Jamshedpur/Bhubaneswar
    Posts
    421

    Default

    i hope you would publish this article in you webpage to.
    Hi Guys

    I wrote the Servo Motor Control with ATmega32 Tutorial this weekend. Enjoy !
    http://extremeelectronics.co.in/avr-...crocontroller/

    Hope you find it useful. Don't Forget to leave your replies.
    Avinash Gupta
    ************
    www.eXtremeElectronics.co.in

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •