
Servo Driver for Micro:bit
Servo Driver for Micro:bit
User Manual
OVERVIRE
This Servo Driver board is an PWM/servo expansion board for micro:bit. Use
PCA9685 chip, expands up to 16 channels and support 12-bits resolution for each
channel. Using I2C interface. This board also integrates 5V regulator, up to 3A output
current, can be powered from battery through VIN terminal. It could be used to for
Robot applications.
FEATURES
➢ Power supply: 6V~12V (VIN terminal)
➢ Servo voltage: 5V
➢ Logic voltage: 3.3V
➢ Driver: PCA9685
➢ Control interface: I2C
➢ Dimension: 65mm x 36mm
➢ Mounting hole size: 3.0mm

Servo Driver for Micro:bit
HARDWARE
You can connect battery to the green socket VIN on the left for power supply, for
VIM, voltage range 6V~12V. 5V regulator on board could output 3A (MAX) current.
You can also connect 5V power supply to the POWER interface on the right, and it
could power micro:bit via 3.3V regulator.
GPIOs on top are interfaces of servo. Black pins are connected to GND (mostly
connect to brown wire of servo). Red pins are VCC pin connected to 5V. Yellow GPIOs
are signal wires of PWM, channel 0~15 supports 16 servos connected at the same
time.
【Note】
1. If you only connect 5V power supply to USB interface, servo cannot be driven.
2. You should connect higher power supply for higher-power servo.
3. Make sure servo are connected properly, otherwise they will not move.

Servo Driver for Micro:bit
HOW TO USE
The website of typescript: https://makecode.microbit.org/# ,Open browser and type
the address as below:
Click Projects -> New Project to create a new project.
Then click Advanced->Add Package In the pop-up dialog box, click the search field
box to copy the URL: https://github.com/waveshare/pxt-Servo
Click Servo searched to add the package.

Servo Driver for Micro:bit
After adding, you can see that Servo block class appears to block area. In the class,
two blocks are included.
: This block is used to control the
angle of servo in range 0°~180°. Channel can be change from 0 to 15.
: Use this block, you can set the
PWM pulse in range: 500~2500.
The relationship between start pulse and degree is as below:
500 ------- 0°
1000 ------- 45°
1500 ------- 90°

Servo Driver for Micro:bit
2000 ------- 135°
2500 ------- 180°
You can control servo just by setting channel, degree and pulse, it is simple.
DEMO CODES
We provide three demo codes (HEX file) for this module. You can copy them to
micro:bit for testing. Drag HEX file to the web page directly could get details
information of demo code: https://makecode.microbit.org/
MICROBIT-SERVO
This demo code is used to rotate 16 servos in range 0~180 all the time

Servo Driver for Micro:bit
item: current angle
Flag: step length for every change. Positive value stands for co-rotating, and negative
for reverse, interval is 20s.
After running the code, you can see that 16 servos turn from 0° to 180°, then turn 0°
again all the time, you can adjust its speed by change the pause on code.
MICROBIT-SERVO-KEY
This demo uses A and B keys to control rotation of servo 0. It moves forward when A
button is pressed and moves backward when B button is pressed.
MICROBIT-SERVO-BLUETOOTH
microbit-Servo-Bluetooth, the function of this code is to rotate four servos 0~4 via
Bluetooth. If you assemble servo to robot arm, it could control robot ram via
Bluetooth.

Servo Driver for Micro:bit
This is the Bluetooth remote control code. pos0~pos3 are current degrees of channel
0~3. step0~step3 are step length.

Servo Driver for Micro:bit
When command are received by micro:bit from app, micro:bit will change the step as
received to control servo. If step is not equal to 0, change the pos and let servo move.
(Note that the value of pos should in: 0~180)
To use this demo code, you should first install APP for Bluetooth communication.
(Only support Android)
⚫ Bluetooth App (for Android)
Open APP, click Settings on the right top, uncheck Filter unpaired micro:bit from scan
results?.
Scanning BBCC micro:bit device and connect it. After connecting, you can enter the
control page by click the Joystick icon.
There are 8 buttons, could be used t control servos from channel0 to channel3.

Servo Driver for Micro:bit
Note: If you want to create new Bluetooth project, don’t forget to setting project
that, choose No Pairing Required:Anyone can connect via Bluetooth.
MICROBIT-SERVO-RADIO
This code we use 2.4Ghz RF function of micro:bit. To test this code, you need two
micro:bit, one is connected to Joystick for mciro:bit as sender, and another connected
to Servo Driver for micro:bit as receiver which will control robot.

Servo Driver for Micro:bit
Code if sender:

Servo Driver for Micro:bit
Code of receiver:
Similar to Bluetooth code, pos0~pos3 are current degree of servos from channel 0 to
channe 3, step0~step3 are step length.
You should flash sender code to micro:bit which connect Joystick module and flash
receiver one to servo module. Then you can control servo by module Joystick for
micro:bit.

Servo Driver for Micro:bit
For more details about Bluetooth and 2.4G, you can refer to the user guide of KitiBot
for micro:bit:
https://www.waveshare.com/wiki/Chapter_8_of_KitiBot-Microbit
https://www.waveshare.com/wiki/Chapter_9_of_KitiBot-Microbit