Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Servo motor VS-2 control

Status
Not open for further replies.

Jayk

Junior Member level 1
Joined
Dec 18, 2011
Messages
16
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Rajkot,India
Activity points
1,426
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
 

Here is info pack for you...............

VS-2 Vigor_RC_Servo.jpg

https://www.strikemodels.com/wp-content/uploads/VS-2-Servo.pdf

fix your VS-2
Warning: Vigor VS2 servos

Servo Motor Control by Using AVR ATmega32 Microcontroller | eXtreme Electronics
 

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 a moderator:

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
 

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.
 

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.
 

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 ??
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top