Goals

  • Use the micro:bit, Breakout Board, and servos to make a car that moves!
  • Get to know the servo, and how to use it with the micro:bit and Breakout Board and MakeCode
  • Marvel at how ridiculous this car is

Note: This activity uses extra parts not found in the Tinker Kit.

(Stay tuned to our online store for our Car Kit, though!)

Materials

1 x BBC micro:bit

1 x Micro USB cable

1 x Battery box

2 x AA batteries

1 x Breakout board

 

2 x Servo

1 x Acrylic car body

2 x Wheels

1 x Felt pad

Sticky tape

  • Connect your car parts as shown in the pictures.
  • If you’re using our Car Kit, follow the labels on the car body to insert the components correctly with the sticky tape.
  • Connect the servo connectors to Pin 0 and Pin 1 on the Breakout Board.
  • Note that the colours of common servo cables don’t match the yellow, red, and black colour scheme exactly—match orange to the yellow pin, and brown to the black pin.

 

  • Add the blocks shown to your “On Start” block.
  • What this does: resets the servos to fixed positions whenever we start!
  • The servo block in MakeCode takes values from 0 to 180. You can find it under Advanced, then Pins.
  • For the continuous servos we’re using, a value of 90 is right in the middle, i.e., we’re telling the servo to “stay still”.
  • We display an image to make a visual indication that we’ve downloaded our code onto the micro:bit.

 

  • Let’s make the wheels move! Add the following code shown to your Forever block.
  • The Digital Write Pin to 0 block is also found under AdvancedPins.
  • What’s happening here? We’re turning one servo clockwise (180), while turning off the other servo. Then, after a short pause, we’re turning off the first servo, and turning the other anti-clockwise (0). Remember, 90 is straight ahead!
  • Why do we need to turn off one servo at a time? That’s because of battery power requirements—your micro:bit has trouble powering both servos at once. If you’re interested, you can explore using a DC motor with an external power source; email us to find out more!
  • Make sure to check that your motors are facing the right directions—you can change them by swapping the 0 and 180 values.

When you’re ready to go, attach your battery pack to your micro:bit, and off you go! Be sure to personalise your car with some craft material to, umm, improve its aerodynamic properties…? For an extension, consider how you can hook up an ADKeyboard to control the motors manually, instead of having this move autonomously.