Grade Level
3, 4, 5, 6, 7, and 8


1 hour 30 minutes


Computer Programming
Computer Studies
Design & technology
Physical Science



Servo Motor, Capacitive Touch




Lesson for Download


In this lesson, students will:

  • Explore entrepreneurial skills, such as budgeting and prototyping a new product.
  • Understand that budgeting is a key aspect of starting a business and creating a product.
  • Design and prototype a new invention that helps those in need.



  • Learn what a servo motor does
  • Learn to control a servo motor with micro:bit code
  • Build a working circuit with a servo motor
  • Code the micro:bit to control a servo motor which can respond to micro:bit sensor inputs



  • Glowforge App
  • Micro:bit MakeCode (http://makecode


  • Proofgrade Medium Clear Acrylic
  • Proofgrade Medium Draftboard
  • 2 medium sized rubber bands
  • 3 medium (approximately 28 mm in length), uncoated steel paper clips -or- a length of 22 gauge connector wire
  • Micro:bit microcontroller
  • Standard 9g servo motor with plastic (not metal) gears (e.g.: . Most servos come with several types of “horns.” This project will require the horn with two straight arms extending from the pivot.
  • Alligator clips (at least 3)


  • Small screwdriver to attach the servo horn if it is not already attached
  • Computer with Internet access to code the micro:bit


  • MicrobitServoConnector.svg
  • Robot.svg



Lesson Outline:

  • Cut and assemble the parts for the robot
  • Cut and assemble the servo motor connector
  • Connect the micro:bit, robot and servo motor in a circuit
  • Program the micro:bit to make the servo motor move
  • Write programs incorporating the micro:bit buttons and sensors to control the robot’s motion in response to external input

Assessment Strategies:

Lesson Instructions

Step 1: SETUP


  • Each individual or group constructing a robot will need Proofgrade Medium Draftboard to print the robot pieces, Proofgrade Medium Clear Acrylic to print the connector pieces, two rubber bands, three paper clips, a micro:bit, and a 9g standard servo motor. Programming the micro:bit requires a computer with Internet access and micro USB connector. 



Ask students if they’re familiar with the purpose of a motor (to make things move) and can identify motorized objects they encounter in everyday life. The most common answer will be cars or similar vehicles, but challenge students to think of less obvious objects which rely on motorized mechanisms to work (e.g. escalators, garage doors, sliding doors in a supermarket, a printer which uses motors to propel the paper through its printing mechanism, etc…)   A number of different kinds of motors, like the small ones which propel toy cars, are activated by simply giving them power. More complicated motors, like stepper motors, and servo motors, offer more precise control over their motion, and require a computer to give them specific instructions.  

Servo motors are responsible for the ultra-precise motion of robot arms that can perform tasks as complicated as assembling motor vehicles or allowing surgeons to conduct surgery on a patient from a remote location. In this lesson plan, students will use a micro:bit microcontroller to control the position of a servo motor that animates a wooden robot.  


Step 3: IDEATE

Design Thinking Cycle 

Explain to the students that they’ll be constructing a moving robot with a servo motor which controls its head. If they’ve seen complicated robots (it’s worth looking at video of some of Boston Dynamics’ amazing robot inventions here), ask them how many different motors they think it takes to create such complicated motion. Lifelike movement requires the coordination of many, often dozens, of motors, and coordinating the motion of all those different moving elements is a complex task.  

Give the students the servo motors to handle and play with. If not already connected, attach a plastic servo horn to the motor. Ask students to firmly but gently rotate the horn with their fingers to observe its range of motion. They should find that the horn can rotate a total of 180 degrees, halfway around a circle. Inside the robot, this movement will allow its head to twist from side to side. Ask the students to think about what other parts of a robots’ body could be controlled by servo motors. What’s the minimum number of servo motors they might be able to use to allow a robot walk on two legs, and how might they arrange such motors?.


Step 4: CREATE

Build Step 1: Print the Robot Parts

Place a sheet of Proofgrade Medium Draftboard onto the Glowforge print bed and open the Glowforge App. Click the Import Artwork button in the Glowforge app and select Upload to import the design file “Robot.svg”. This file contains outlines for all wooden parts to construct the robot. The blue shapes which constitute the robot’s eyes and mouth should be set to Engrave, the red lines just inside the perimeter of the robot’s body and head should be set to Score and the black outlines of the body pieces should be set to Cut, as shown in the image above. It’s best to instruct the Glowforge app to perform the Cut step *after” the Engrave and Score steps so that the pieces can’t shift before they’re etched. 

When the settings are correct, print the pieces, remove them from the print bed, and peel off any protective paper. The robot assembly will require all parts shown above. 

Build Step 2: Assemble the Robot Body

Take the robot body and attach the four semi-circular stands to its feet by inserting the slots in the stand pieces into the corresponding slots in the robot’s feet. The body should now be able to stand upright on a level surface, as shown above.

Next, attach the four rectangular clips, which will hold the micro:bit in place. Each of the clips has a narrow and a wide slot. Insert the wider of the two slots downwards into a corresponding slot in the robot body. Each clip should be oriented so that the unused narrow slit sits behind the robot body.  

Build Step 3: Assemble the Robot Head

Take the servo motor, and attach the horn containing  two straight arms which protrude out from the center. To provide symmetric motion for the robots’ head, the midpoint of the servo’s range of motion should occur when the servo horn is oriented perpendicular to the servo’s long axis. At either end of the 180 degree range of motion, the horn should be oriented parallel to the servo’s long axis. If the servo horn is not oriented correctly, unscrew it, and place it so that it looks like the images above when at the endpoints and midpoints of its motion, respectively. Be sure the horn is securely affixed to the servo with the tiny screw that comes with it.  

Build Step 4: Assemble the Robot Head

Take the servo motor and the parts for the head assembly shown above. The two larger pieces will sandwich the servo from either side of its flat “shelf”. The back piece has a notch in the top to accommodate the wires. Slide the servo wires through the back piece and seat the servo into the rectangular hole. Then slide the matching piece without the notch over the servo from the front side. 

The two small notched clips hold the larger pieces together. Insert the side of the clip with two slots into the corresponding slots on the pieces holding the servo. When seated, the remaining open notch on the clip should sit in front of the assembly, on the same side as the servo horn, as shown above.

The next step is to attach the robot’s head to the servo motor assembly. Take the head, and place it face down on a flat surface. The two small clips with rounded nubs will sit over the ends of the servo horn and fit snugly into the slots in the robot’s head to attach the head to the servo horn. Rotate the servo horn relative to the servo so that it sits perpendicular to the servo’s long axis as shown in the image above.

Place the robot head on a flat surface, with its features oriented downwards. Insert  one of the clips into the slots in the robot’s head, pushing the clip in as far as it will go. Most of the clip sits flush with the back of the robot head leaving only a small gap to hold the servo horn. Moderate force may be required to get the clip firmly seated. With one clip seated, lift the servo assembly and turn it over so that the servo horn is facing downward. Place the assembly on top of the robot head and slide it towards the outer edge so that one end of the servo horn slips into the gap in the attached clip.

Now attach the remaining clip to the robot head to secure the other end of the servo arm. This may be a little tricky as the remaining slots are positioned underneath the servo assembly. It may be helpful to use a butter knife or other dull, flat object to push the second clip into place. When fully inserted, the clips should sit flush on the robot head and the ends of the servo horn should fit inside the small gaps in the clip. There is a little wiggle room between the servo horn and the clips, which won’t affect the robot’s function. If it is bothersome, apply a small amount of glue between the servo horn and the robot head to keep them securely together.

Now that the head assembly is complete, attach it to the body by slotting the two clips at the bottom of the head assembly into the two corresponding slots in the top edge of the robot’s body as shown.

The micro:bit fits just behind the large rectangular hole in the robot. Attach it by sliding it downward into the slots in the four clips along the bottom edge of the hole. The micro:bit should be aligned so that each clip holding it sits between two of the micro:bit’s labelled pins, as shown above.  


Build Step 5: Print and Assemble the Servo Motor Connector  
Next, we’ll build a special connector to allow the motor to be attached to the micro:bit using alligator clips.    Place a sheet of Proofgrade Medium Acrylic onto the Glowforge print bed and open the Glowforge App. Click the Import Artwork button in the Glowforge app and select Upload to import the design file “MicrobitServoConnector.svg”. The red text labels should be set to Engrave, and the black outlines of the body pieces should be set to Cut. It’s best to instruct the Glowforge app to perform the Cut step *after” the Engrave steps so that the pieces can’t shift before they’re engraved.

Once the pieces are cut, remove all protective paper from the acrylic. Gather three medium paper clips, two rubber bands, and the connector at the end of the servo motor (which is attached to the robot). The three acrylic pieces will be layered together with the engraved piece sitting in the middle of the other two.

The paper clips provide an electrical connection to the three leads of the servo motor. To make a working circuit, we’ll need to identify which lead does what. Servo motor wires come in different colors. The positive voltage lead always sits in the middle, and is usually colored red. The ground lead is usually black or brown, and the signal lead is sometimes yellow, blue or white.   

Lay the acrylic connector pieces out on a flat surface as shown above. The outer layers should have the side with two slots oriented to the right, and the middle layer should have the signal label on its left side and the two “-” (ground) labels on the right side. Orient the servo connector so that the ground lead sits on the right side. Take the three paper clips and bend them as in the picture above so that their orientations match the three large oval slots in the middle layer of the acrylic. Gently push the straightened ends of each of the paper clips into one pin of the servo connector cable as shown.

Lay the middle acrylic layer on top of one one of the other two layers and slip the end of the servo connector into the matching slot. The paper clips may need to be bent a bit more or less to fit into the oval slots which hold them. It is very important that the paper clips not touch each other when the servo is powered. The shape of the middle acrylic layer helps to keep them separated.

Place the last acrylic layer on top of the other two, and, while holding all three layers together, wrap the two rubber bands around the acrylic pieces to secure the connector assembly together. When tight, the rubber bands sit inside the slots at the sides of the acrylic pieces as shown above.  


Build Step 6: Attach the Servo Motor to the micro:bit

In the final assembly step, we’ll attach the servo motor to the micro:bit with alligator clips. Connect the clips to the servo motor by inserting the alligator clip ends into the holes in the acrylic and clamping them onto the accessible portion of the paper clip. On the micro:bit side, open the jaws of the alligator clip widely and clamp them over the micro:bit pins so that one jaw of the clip sits in the hole and the other side of the clip grips the bottom edge of the micro:bit.  

Make the following connections with the alligator clips:

Servo Motor micro:bit
Positive Voltage (+) 3V
Ground (-) GND
Signal Pin 0

Optional Build Step 7: Providing additional power for the servo
You may find the Micro:Bit doesn’t provide enough power to drive the servo motor. If this is the case, connect the
3xAAA battery pack to the circuit following this support document from Micro:Bit



Test your creation!

Students will write programs which send commands to the servo motor to make the robot’s head move . The micro:bit will need to be connected to a computer with a micro USB cable. You can insert the micro USB cable to the micro:bit connector without removing the micro:bit from the robot, as shown above.   If you have never coded a micro:bit before, the site has a getting started guide here

A comprehensive introduction to connecting and coding a servo motor with a micro:bit is available here.

Below are some different ideas for programming the micro:bit to control the robot:  

Activity 1: Animated Swiveling Head

On the MakeCode site, the code blocks to control a servo motor are on the Pins menu, found on the Advanced menu list. The “servo write pin” code block sets the motor position in a range of 0-180 degrees. The robot’s head is upright at 90 degrees. Setting the value 0 degrees tilts it left and sending it to 180 degrees tilts it right.  

The code above is a simple program which alternates swiveling the robot’s head left and right. The pause statements between the servo control blocks are necessary to allow the servo enough time to travel to the specified position. You can open up this program in a MakeCode browser window by clicking this link.  

Point out to the students that when they use the servo code blocks inside the MakeCode code editor, a virtual servo motor appears in the emulator window at the left side of the editor window. They will be able to preview the motion of the servo in the code editor before downloading their code to the micro:bit.  

Have the students download and run the code on their robot. Ask them to observe the motion of the servo motor controlling the robot’s head. How long does it take for the servo to travel from one position to the other? Does it stop at exactly the same place each time it rotates?  

Once students have successfully run this code, challenge them to modify the program to change the robot’s motion. Remind them that each time they alter the program, they’ll need to download it to the micro:bit to see their modifications work.   Here are some ideas for students to try:

  • Change the servo motor code blocks to send the robot’s head to different positions. Which values will result in the head moving just a little bit? Which values will send the head to the right and which to the left?
  • Change the time of the pauses between servo motor blocks to make the robot’s head movements occur more or less frequently. 
  • Add additional servo motor code blocks and pause code blocks to the program to create a more complicated pattern of motion. For a bigger challenge, ask the students to find a song they like and see if they can code the robot to move his head with the beat.
Activity 2: Push Button Control

The code above is a simple program that tilts the robot’s head one way when button “A” is purchased and the other way when button “B” is pushed. This program may be opened directly in the MakeCode environment by clicking on this link.  

Ask the students to download the code and test it on the robot. Does the robot’s head move when they depress the micro:bit’s buttons or when they release them? How long does it take for the servo to finish moving once they’ve pushed the button? What happens if they push one button immediately after releasing another? Does the robot finish moving to the first position before changing directions, or does pushing the button interrupt the motion?   Once they’ve tested the code above, they should modify it to add additional features to the program. Some ideas for them to try are:

  • Add a different robot response when buttons “A” and “B” are pushed simultaneously
  • Add additional servo code blocks to the program so that the robot responds to a button push by shaking its head back and forth
  • Add some “show icon” code blocks to make the picture displayed on the micro:bit change along with the motion of the robot’s head.
 Activity 3: Capacitive Touch Response  

Some micro:bit pins have a capacitive touch sensitivity, meaning that they can detect when people touch them. When these pins are connected to a conductive object like foil or a paperclip, then the micro:bit can detect when that object is touched.   

This activity will require two additional alligator clips and a conductive material such as tin foil to create the connection shown in the picture below.

Connect one additional alligator clip to the second ground ( “-”) slot in the acrylic servo motor connector. Leave the other end of the ground clip free. Cover one of the robot’s hands with tinfoil. Take another alligator clip and attach one of its end to micro:bit pin 1 and the other to the tinfoil as shown in the image above. To activate the capacitive touch sensor, you must touch both the ground pin and micro:bit pin 1 at the same time.

The micro:bit code shown above responds when a touch on pin 1 is detected, causing the robot’s head to move to one side, then back to the upright position. The program may be opened directly in the MakeCode environment by clicking this link. Have students download the code to the micro:bit, then ask them to see what happens when they place one hand on the alligator clip connected to the GND pin and touch the tin foil with their other hand. When the tinfoil is touched, the robot’s head should move in response.   After testing the code above, ask students to modify it to experiment with the micro:bit’s capacitive touch features. Some additional ideas to try are:

  • Add another piece of foil to a different portion of the robot’s body, and connect it to pin 2 on the micro:bit. Code the robot to perform a different motion when pin 2 is touched.
  • Connect the alligator clips from micro:bit pins 1 and 2 to different conductive materials to see if any work better than others in detecting being touched. 


Ask the students what they learned from constructing and coding a moving robot. Do they know why it was necessary to make a special connector for the servo motor?  

In this activity, students used a servo motor which rotates through a maximum range of 180 degrees. It would be difficult to use a motor with a limited rotation to power the wheels of a rolling vehicle. What kinds of locomotion could be generated using servo motors?

Ask students to evaluate the robot design. Are they satisfied with the way it moves? Could other parts of the robot be animated as well? Can they think of any ways – through design or code – to make the robot and its motion more lifelike?  



The micro:bit contains a number of different sensors. In addition to the push buttons and capacitive touch inputs, the micro:bit contains a light sensor and a tilt sensor. Ask students to think of ways the robot might respond to inputs from these sensors (e.g. the robot could “wake up” when it is light, or work to keep its head upright when its body is tilted to the left or to the right)  

If they’re up for a design challenge, students may use the servo motor and connector they built to design and construct their own original robotic invention with motion controlled by the micro:bit. Ask students to brainstorm what kinds of creations they could make and how they might animate them with a servo motor. 

Meet Glowforge

The magical 3D laser printer that made this lesson possible. Learn more!

Glowforge Editors Choice

Leave a Reply

Your email address will not be published. Required fields are marked *