Center the servos

The cyber:bot robot's drive motors are Parallax Continuous Rotation Servos.  Rotation speed and direction are controlled by sending very specific patterns of high/low voltage signals to the servos.

In this activity, you will run a script that sends a “stay still” signal to the servo motors. You will then use a screwdriver to adjust each servo so it will actually stay still when receiving this signal. This is called "centering" the servos. After this adjustment, you will run test scripts that will  turn the servos clockwise and counterclockwise at various speeds.

Tool Required

You’ll need a Parallax screwdriver, or a different Phillips #1 point screwdriver with a 1/8″ (3.18 mm) or smaller shaft.

Sending the Center Signals

If a servo has not yet been centered, it may turn, vibrate, or make a humming noise when it receives the “stay-still” signal.

  • Make sure the cyberbot.py module is loaded on your micro:bit (see Add modules to your micro:bit).
  • Enter and save left_servo_stay_still.py.
  • Make sure to include the line from cyberbot import *.
# left_servo_stay_still.py

from cyberbot import *
 
bot(18).servo_speed(0)
  • Flash left_servo_stay_still.py to your micro:bit.
  • Set the cyber:bot’s power switch to 2, to provide power to the servos.

Powering cyberbot.py:  If your script includes from cyberbot import* you must:
(1) Make sure that the module cyberbot.py is loaded onto your micro:bit
(2) Make sure the battery pack is plugged into the cyber:bot board.
(3) Put the cyber:bot board's 3-position power switch in position 1 or 2.  Position 1 powers the breadboard circuits, and position 2 powers the breadboard and the servo ports.

On the side of the servo is a small access hole. Inside the hole is what appears to be a small screw. This is a plastic potentiometer adjustment knob.

  • Use a screwdriver to gently adjust the potentiometer in the servo as shown below.  Don’t push too hard! Turn the potentiometer slowly in each direction to find the setting that makes the servo stop turning, humming, or vibrating.

 

Note: If you mounted the servos so that the potentiometer access holes are facing the battery pack, you can still use a very long, thin screwdriver to adjust them.


Did you know?

A potentiometer is an electrical device that provides variable electrical resistance. Some potentiometers have a knob for adjusting the resistance, like these servos, while others may have a sliding bar. Either way, the schematic symbol for a potentiometer is the same. 


Your Turn – Center the Servo Connected to Pin 19

  • Repeat the process to center the servo on P19, using the script right_servo_stay_still.py.
# right_servo_stay_still.py
 
from cyberbot import *
bot(19).servo_speed(0)