micro:bit ready: OC05 servo motor controller

Table of Contents:

   

 


What does it do?

The OC05 is a servo motor controller: connect 1 to 8 different servos to the pins on the OC05 and operate them from your code. 

  • A servo motor can usually turn 90 degrees in either direction allowing for 180 degrees of movement.  The code allows you to set the angle at which the servo points.
  • Some servos have 360 degrees of freedom which means they can spin in a full circle: with these you can set them to turn continuously. If you have a continuous servo you can set the speed at which it turns in your code.  

With the ability to control up to eight servos the OC05 is a great tool for all sorts of projects - from robots to RC flying machines to home automation. This page will describe how to use the OC05 controller in MakeCode..

Loading the MakeCode extension:

To write code for the OC05 in MakeCode you will need to load the OC05 extension:

  • Open MakeCode and start a new project
  • Click on Extensions
  • Type in XinaBox/pxt-oc05
  • Click on search
  • Select the OC05 tile:

 

Hello world:

Connect a servo to the OC05 and connect the OC05 to a micro:bit bridge (IM01, BM01 or BM02). Then copy the following code and flash it to your micro:bit: when you click the A button the servo will turn to its 180 degree position:

 

Remember to attach everything together before running the code. 

How-to Guides:

Tip: supply power to the IM01 rather than the micro:bit.  The micro:bit supplies 3.3V to the pins compared to 5V from the IM01. This can make a big difference: some servos just won't work with 3.3V and others work erratically and are underpowered.


Back to find a micro:bit ready xChip page