DUE Servo

Servo

Traditional motors convert electrical energy to mechanical rotation. When it comes to speed, the higher the voltage, the faster the motor. Servo motors are a bit smarter! They take a voltage (power) for energy but also take a signal that comes into the servo to tell it what we want it to do. This page covers the RC Servo motor, originally made for RC (radio controlled) hobby vehicles. On RC Servos, the signal coming in is a pulse that repeats 50 times per second, that is every 20 milliseconds. The incoming pulse size can vary between 1 and 2 milliseconds typically and then repeats every 20 milliseconds. The smart circuit inside the servo sees the pulse and then controls the internal motor based on the pulse size.

Connections

The three wires on a servo are usually Black, Red, and Yellow. The Red and Black ones are for power, where Red is positive (power source) and Black is negative (ground). The Yellow wire is the signal. Some other servos have Orange, Red, and Brown. Where Red and Brown are the power and Orange is the signal. If in doubt, always remember that the middle pin is always the power source, and then the negative pin (the ground) is the darker color, like Brown or Black.

Positional vs Continuous

Positional vs Continuous servos, their names imply how they work. Positional servos move the motor to a specific position, from 0 to180 degrees. On the other hand, continuous servos rotate continuously in either direction. The pulse in this case controls the speed and direction instead of position.

On a positional servo, a smaller pulse will send the servo all the way to one side (0 degrees), and a larger pulse will send the servo to the other side (180 degrees).

In contrast, a continuous servo will go full speed at a smaller pulse, then stop moving at a middle pulse, and then full speed in reverse at a larger pulse.

Servo Control

A servo is controlled using ServoSet() function that takes 2 arguments, pin number and position.

ServoSet(1,110) # Set a servo that is connected to pin 1 to 110 degrees.

Some servos do not reach the full 0 to 180 degrees. It is usually a good practice to limit the position from 10 to 170 degrees.

When using a continuous servo with the ServoSet() function, the arguments are the same range (0-180) but those values have a different meaning:

  • 0 value means the servo runs full speed in counterclockwise direction.
  • 90 value means the servo is stopped.
  • 180 value means the servo runs full speed in clockwise direction.

Any values in between are also valid. For example, a 45 will make the rotational servo go counterclockwise at half speed.

BrainStorm

How does a servo read and understand an incoming pulse? And then when it controls an internal traditional motor? A positional servo motor is a combination of a traditional motor, gears, a variable resistor, and a tiny processor. There is even code that lives inside that tiny processor!

To save on cost, that tiny processor can be a chip that is hard coded to do a specific task. The BrainPad processor differs as it is made to be reprogrammed and repurposed.

Content Licensing
Newsletter

Twitter Feed
Hot off the press!