Servo Motor

We can hook up a servo motor to a microbit.  A servo motor is different from a regular motor because it is a precise motor with position feedback.  In our case we're using a $12 TowerPro MG92B, which is sometimes used in radio-controlled airplanes.

Attaching Servo Arm and Wires

Select single arm and small non-pointy screw.

Screw arm onto servo.

Attach servo Cable

Carefully attach servo cable with the yellow wire connected to 0 and the dark purple wire connected to G (ground).  The red wire is the control wire.

Enable the Servo Extension

Select Advanced in the microbit menu.

Within Advanced select Extensions.

Select the servo extension.

The servo drawer will now be added to this project.

Servo Test Program

Test your servo connection using the microbit program shown at right.  Note that we use 1 as the minimum value rather than 0.  

We've used a function in this program, but you could also just directly embed the set servo block within each button press, without using a function.

Selecting buttons A, A+B, or B moves the servo arm to the positions as shown.  

Your results could appear as the opposite from this if you mounted your server arm upside-down, which is fine.  You just have to keep track of which degrees give you which movement.

Button press A: 180 degrees

Button press A+B: 90 degrees

Button press B: 1 degree

Servo Delay

If a servo has not had time to finish the previous command, then a new command will be ignored.  Change the program shown at right with enough delay between the servo commands so that it can complete each command. 


Slow Wave

Have you ever seen the "slow wave" of a famous person in a parade?  The image above is of Jackie and John F. Kennedy. (https://www.nydailynews.com/life-style/fashion/jackie-fashion-lady-article-1.2220436)


Program your microbit  with your servo motor to do a "slow wave" when button A is pressed.  (Decorative hand is optional!)  You will need to use a loop and insert a delay so that the wave moves slowly.

Dance

Create synchronized motion.

Robot Dance with Sydney, Joanna, Getzi, Ciara.mp4

Joanna, Sydney, Getzi, and Ciara.