Center the Servos First

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 temporarily attach the servos to the cyber:bot board. Then you will run a script that sends a “stay still” signal to the servo motors. With a screwdriver, you will adjust each servo so it will actually stay still when receiving this signal. This is called "centering" the servos. After this adjustment is done, you will proceed to build the cyber:bot and run test scripts that will turn the servos clockwise and counterclockwise at various speeds.

Parts Required

  • (1) Assembled cyber:bot board, with micro:bit module installed from prior step
  • (2) Continuous rotation servos
  • (1) Battery pack
  • (5) AA batteries
  • (1) USB A to microB cable

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.

cyber:bot Library Required!

  • If you have not done so already, download the cyber:bot library and add it to your micro:bit module's file system.  Just follow the steps in Add modules to your micro:bit and then return here.

Connect the Servos

The servo cables plug into the 3-pin  P18 and P19 3-pin headers, sometimes called "servo ports," that are above the white breadboard.

  • Align the cables so that the white wires are near the board edge, and the black wires are by the pins labeled GND
  • Plug the left servo cable onto the P18 port.
  • Plug the right servo onto the P19 port.

Voltage Selection Jumper

There is a smaller 3-pin header to the left of the servo ports.  A shunt jumper connects two pins on it, selecting the voltage source supplied to the servos. The 5V setting limits the voltage to 5V, regardless of the input voltage.  The VIN setting supplies the servo with whatever voltage level is connected to the board.

The Continuous Rotation Servos need 4 to 6 VDC to operate. So, the setting you should use depends on the kind of batteries you have.

  • 1.5V alkaline batteries: Use the 5V setting.  (1.5V x 5 batteries = 7.5V, which is too much.)
  • 1.2V NiMH rechargeable batteries. Use the VIN setting. (1.2V x 5 batteries = 6V, which is just right)
  • If needed, lift the shunt jumper off of the pins and place it back on again so it connects the center pin and the pin for the correct voltage for your type of batteries.

Missing a Voltage Selection Jumper? Replacements are available  - contact our sales department to order part #452-00043; there are three per board.

Add the Batteries

  • Plug the battery pack into the power jack on the cyber:bot board.
  • Add the 5AA batteries to the battery pack.

The 3-position Switch

The cyber:bot board has a three-position switch, which allows you to choose whether or not to power the servos when you power the rest of the board.  Here are guidelines:

  • Position 0: ALWAYS use position 0 for building or modifying circuits on the breadboard or 3-pin/Servo ports. It is also good for flashing scripts. Position 0 turns off power to the whole cyber:bot board. If the micro:bit is plugged into USB, you can still flash and run non-robot scripts.
  • Position 1: Good for flashing scripts and powering breadboard circuits and the piezospeaker port.  Position 1 powers the Propeller system, the piezospeaker port, and sockets along the breadboard, but not the 3-pin/Servo ports, so your cyber:bot won’t roll away the moment you program it.   Position 1 also powers the micro:bit independent of its USB port.  
  • Position 2: ONLY use 2 when you are ready for your robot to move. NOT good for flashing scripts. Position 2 powers all the circuits on the board, including the 3-pin servo ports, and also the micro:bit independent of its USB port.

 

  • Connect the micro:bit to the computer with the USB cable, if it isn't already connected.

Complete System, Ready!

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. Once you’ve assembled the cyber:bot, the servos must be removed to be centered again, making this step critical.

  • Make sure the cyberbot.py module is loaded on your micro:bit (see Add modules to your micro:bit [1]).
  • 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.


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.

This short video will assist you with the process of centering the servos:

 


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)
  • NOW DISCONNECT YOUR SERVOS AND BATTERY PACK FROM THE BOARD!