Skip to content
Learnearn.uk » Microbit Unit Home » Controlling a continuous servo with the Microbit

Controlling a continuous servo with the Microbit

Introduction

Introduction

The FS90R servo can spin continuously, making it great for wheel control for smaller robots.

In this experiment we are going to look at how we can control a continuous servo, a type of servo that can spin continuously. This type of servo is great is you want to  control small wheeled robots or raise or lower winch cables on robots.

Required Components

Microbit

Jumper wires

FS90R Servo

 

Wiring

Wiring Diagram

Circuit

Circuit Diagram

Code

Microbit Blockly Code

In order to control to the servo you will need to import the servo extension first.

Then you can add the following code and download it to your Microbit:

Challenge 1

Challenge 1 – Random Spinner

Can you adapt the code so that when you shake the Micro:bit it spins in a random direction at a random speed for 1 second?

 

 

 

2

Challenge 2 – Speed changer

Can you adapt the code so that when you press the A button the servo speeds up, when you press the B button the servo slows down and when you press A+B the servo stops

 

 

 

3

Challenge 3 – Tilt power

Can you adapt the code so that the servo spins clockwise or anticlockwise depending on whether you are tilting the Micro:bit left or right. The more it tilts the faster it should go?

 

 

Note: The servo has a power setting between -100 and 100 but the accelerometer has values between -1024 and 1024. How can you convert these values?

Resources

Resources

Printable Worksheet