+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Junior Member level 1
    Points: 605, Level: 5

    Join Date
    Dec 2011
    Location
    Rajkot,India
    Posts
    16
    Helped
    1 / 1
    Points
    605
    Level
    5

    Servo motor VS-2 control

    I am interfacing VS-2 servo with ATMEGA32 controller. I want to know how can we know PWM and rotation angle relation of servo motor specially for VS-2 servo

    •   Alt18th December 2011, 11:45

      advertising

        
       

  2. #2
    Advanced Member level 4
    Points: 17,009, Level: 31
    kak111's Avatar
    Join Date
    Mar 2011
    Location
    Finland
    Posts
    1,366
    Helped
    941 / 941
    Points
    17,009
    Level
    31
    Blog Entries
    8
    ---> Hike with wise men , then you will be wise <---



  3. #3
    Junior Member level 1
    Points: 605, Level: 5

    Join Date
    Dec 2011
    Location
    Rajkot,India
    Posts
    16
    Helped
    1 / 1
    Points
    605
    Level
    5

    Re: Servo motor VS-2 control

    I have generated simple PWM signals by following program.But still there is some problem.motor is moving 20 degree whatever pulse we are giving.
    Code:
    #include<avr/io.h>
    #include<compat/deprecated.h>
    #include<util/delay.h>
    
    main()
    { 
       sbi(DDRD,5);
       
       while(1)
       {
         sbi(PORTD,5);
         _delay_ms(0.6);
         cbi(PORTD,5);
         _delay_ms(19.4);
        
         _delay_ms(2000);
    
         sbi(PORTD,5);
         _delay_ms(1.5);
         cbi(PORTD,5);
         _delay_ms(18.5);
    
         _delay_ms(2000);
    
         sbi(PORTD,5);
         _delay_ms(2.4);
         cbi(PORTD,5);
         _delay_ms(17.6);
    
         _delay_ms(2000);
    
        }
    }
    Last edited by bigdogguru; 28th December 2011 at 07:29. Reason: Added Code Tags



    •   Alt28th December 2011, 07:09

      advertising

        
       

  4. #4
    Administrator
    Points: 68,870, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,797
    Helped
    2348 / 2348
    Points
    68,870
    Level
    64
    Blog Entries
    4

    Re: Servo motor VS-2 control

    Quote Originally Posted by Jayk View Post
    I have generated simple PWM signals by following program.But still there is some problem.motor is moving 20 degree whatever pulse we are giving.
    The issue you are dealing with is the lack of a loop around each different pulse width:

    Try something like this:

    Code:
    #include<avr/io.h>
    #include<compat/deprecated.h>
    #include<util/delay.h>
    
    main()
    { 
       sbi(DDRD,5);
       
      while(1)
      { 
         int i;
    
         for(i=10000; i > 0; i--)
         {
             sbi(PORTD,5);
             _delay_ms(0.6);
             cbi(PORTD,5);
             _delay_ms(19.4);
        }
         
         for(i=10000; i > 0; i--)
         {
             sbi(PORTD,5);
             _delay_ms(1.5);
             cbi(PORTD,5);
             _delay_ms(18.5);
         }
    
         
         for(i=10000; i > 0; i--)
         {
             sbi(PORTD,5);
             _delay_ms(2.4);
             cbi(PORTD,5);
             _delay_ms(17.6);
         }
    
    
       }
    }

    You must constantly generate the PWM of a particular duty cycle and frequency to maintain the rotor in that particular position. Otherwise you are generating an average of all three PWM widths.

    BigDog



  5. #5
    Advanced Member level 4
    Points: 17,009, Level: 31
    kak111's Avatar
    Join Date
    Mar 2011
    Location
    Finland
    Posts
    1,366
    Helped
    941 / 941
    Points
    17,009
    Level
    31
    Blog Entries
    8

    Re: Servo motor VS-2 control

    The control signal is a digital PWM signal with a 50 Hz frame rate.
    Within each 20 ms timeframe, an active-high digital pulse controls the position.
    The pulse nominally ranges from 1.0 ms to 2.0 ms with 1.5 ms always being center of range.
    Pulse widths outside this range can be used for "overtravel" -moving the servo beyond its normal range.
    This PWM signal is sometimes (incorrectly) called Pulse Position Modulation (PPM).

    The servo is controlled by three wires: ground, power, and control.
    The servo will move based on the pulses sent over the control wire,
    which set the angle of the actuator arm.
    The servo expects a pulse every 20 ms in order
    to gain correct information about the angle.

    The width of the servo pulse dictates the range of the servo's angular motion.
    ---> Hike with wise men , then you will be wise <---



    •   Alt28th December 2011, 07:31

      advertising

        
       

  6. #6
    Junior Member level 1
    Points: 605, Level: 5

    Join Date
    Dec 2011
    Location
    Rajkot,India
    Posts
    16
    Helped
    1 / 1
    Points
    605
    Level
    5

    Re: Servo motor VS-2 control

    Quote Originally Posted by kak111 View Post
    The control signal is a digital PWM signal with a 50 Hz frame rate.
    Within each 20 ms timeframe, an active-high digital pulse controls the position.
    The pulse nominally ranges from 1.0 ms to 2.0 ms with 1.5 ms always being center of range.
    Pulse widths outside this range can be used for "overtravel" -moving the servo beyond its normal range.
    This PWM signal is sometimes (incorrectly) called Pulse Position Modulation (PPM).

    The servo is controlled by three wires: ground, power, and control.
    The servo will move based on the pulses sent over the control wire,
    which set the angle of the actuator arm.
    The servo expects a pulse every 20 ms in order
    to gain correct information about the angle.

    The width of the servo pulse dictates the range of the servo's angular motion.
    Sir i have tried out every pulse between 1ms to 2ms and given at every 20ms but still cant control the servo motor angle.Motor is rotating whole 180 degree.



  7. #7
    Newbie level 1
    Points: 177, Level: 2

    Join Date
    Dec 2011
    Posts
    1
    Helped
    0 / 0
    Points
    177
    Level
    2

    Re: Servo motor VS-2 control

    I have tried the above program given by bigdogguru with VS-2 interfaced with ATmega32 but there is continuous rotation of motor from 0° to 180° immaterial of the variation in the duty cycle... moreover once the motor rotates clockwise, it doesnt move counter clockwise.. Nw wat should do ??



--[[ ]]--