Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »


  • Standard servos are used to maintain a certain angle, not meant for full rotation
  • Uses closed loop feedback control
  • Servos are used in applications requiring high torque, accurate rotation within a limited angle such as Robotic arms, valve control, rudder control etc.

Courtesy : https://howtomechatronics.com/how-it-works/how-servo-motors-work-how-to-control-servos-using-arduino/

  • SG90 is a servo motor which operates based on PWM control signals
  • The servo maintains a certain angle (position) based on the width of the pulse fed in through a signal input
  • Some technical specifications
  • Weight: 9 g
  • Dimension: 22.2 x 11.8 x 31 mm approx.
  • Stall torque: 1.8 kgf·cm
  • Operating speed: 0.1 s/60 degree
  • Operating voltage: 4.8 V (~5V)
  • PWM frequency = 50Hz
  • Pin configuration: Yellow / Light Orange / White (Signal), Red / Dark Orange (+5V), Brown/Black (Ground)


Note : The pulse width in the image does not correspond to SG90, for illustration of the concept only.

Image courtesy: Stefan Tauner

544 – 1500 – 2400 us

  0°  –   90° – 180°

Continuous Rotation Servos

  • Continuous rotation servos are normal servos modified to perform open loop speed control (instead of closed loop position control)
  • Rotation speed and direction are controlled through PWM signals (pulse width) for continuous rotation servos, just like how position is controlled for standard servos
  • Effectively, continuous servos are DC motors with integrated motor drivers and reduction gears in a compact, inexpensive package
  • FS90R continuous rotation operating speed: 110RPM (4.8V); 130RPM (6V)
  • Can continuous rotation servos be used to achieve accurate positioning without any additional hardware?

Servo Library

  • This library allows an Arduino board to control servo motors.
  • Standard servos allow the shaft to be positioned at various angles, usually between 0° and 180°. Continuous rotation servos allow the rotation of the shaft to be set to various speeds
  • Any digital pin on UNO can be used, not necessarily those supporting PWM. However, note that using Servo library disables analogWrite() functionality on pins 9 and 10
  • attach(int) - attach a servo to an I/O pin, e.g., servo.attach(pin), servo.attach(pin, min, max)

  servo: a variable of type Servo, pin: pin number, default values: min = 544 ms, max = 2400 ms

  • write(int) - write a value to the servo to control its shaft accordingly

  Standard servo - set the angle of the shaft

    Continuous rotation servo - set the speed of the servo

    (0: full speed in a direction, 180: full speed in the other, and around 90: no movement)

  e.g., servo.write(angle),  angle = 0 to 180 

  • detach() - stop an attached Servo from pulsing its I/O pin

http://arduino.cc/en/Reference/Servo

#include <Servo.h>
 
Servo servo_7;
 
void setup()
{
  servo_7.attach(7);
}
 
void loop()
{
  servo_7.write(45);
  delay(10); 
}
/* servo connected to pin 7 will maintain an angle of 45o */

]] ></ac:plain-text-body></ac:structured-macro><p><br /></p><p><br /></p><p><ac:image ac:height="250"><ri:attachment ri:filename="image2019-12-28_18-47-48.png" /></ac:image></p><p>Caution : Do not overload the servo. The servo and your battery / power source could be damaged if servo is overloaded.</p><p>Do not power the servo from a 9V battery. Most servos can&rsquo;t take &gt; 6V.</p><p><br /></p><p><strong>Exercise 6</strong></p><ul><li>Create a program to sweep the servo back and forth between 0o and 180o gradually such that it takes a total of 18 seconds to complete a back and forth sweep</li></ul><p>Hint :</p><ul><li>Increment and decrement by 1o, with a 50 milliseconds delay at each step</li></ul><p><br /></p><ac:structured-macro ac:name="code" ac:schema-version="1" ac:macro-id="41ef3738-d59b-4b15-8e05-4a8f467ff94c"><ac:parameter ac:name="language">cpp</ac:parameter><ac:plain-text-body><![CDATA[#include <Servo.h> 
 
Servo myservo; 
int pos = 0;    
// variable to store the servo position 

void setup() 
{ 
  myservo.attach(7);  
} 

void loop() 
{ 
  for(pos = 0; pos <= 180; pos++)
  {                                
    myservo.write(pos);            
    delay(50);                     
  } 
  for(pos = 180; pos >= 0; pos--)   
  {                                
    myservo.write(pos);            
    delay(50);                     
  } 
}


]] ></ac:plain-text-body></ac:structured-macro>
  • No labels