This project will guide you step by step on setting up a line following robot using the BBC micro:bit that stops when it senses something within a certain distance using the ultrasonic and line following sensor.
Let’s see an overview of how the bunny robot follows a line and how it reacts when having a barrier in front of it:
Unpack the robot. Put the rubber on the plastic wheels, and then push the assembled wheels onto the robot.
Go to Microsoft MakeCode for micro:bit (microbit.org) and select a new project. Choose a name such as Bunny Project. Click on “Advanced” and click “Extensions”.
Search for Kitronik, and you will see the extension code:
Click the “kitronik-move-motor” picture. This will now install the extensions you need, and the Move Motor extensions will be added to the sidebar.
Download the code to your micro:bit. Put the device over your bit of paper with a line on it and turn the device on (making sure the line is in the middle of both the left and right sensor). The robot should now follow the line.
Add a measure distance in cm, followed by adding a variable for that measured distance called distance. Add in an additional else if to the main logic stating that if the distance variable is less than 20, stop the motor.
Download the code to your micro:bit, put the device over your bit of paper with a line on and turn the device on (making sure the line is in the middle of both the left and right sensor). As the robot follows the line, put something in its path, and it will stop!
You can follow the following video Easter Origami Inflatable Bunny. (Easy Instructions) (Full HD) – YouTube to make an easter bunny, simply cut out the bottom in order to fit the bunny over the robot.
This project is a fun and easy way to learn basic programming and robotics skills. What’s more, it offers the perfect opportunity to use the best-selling BBC micro:bit board and create a fun line following bunny robot.
From the multitude of micro:bit projects available in our Projects Hub, this easy to follow 10 step project is ideal for beginners and fantastic for engaging children in learning through play.
Discover our full range of Educational products here.
From a quick tap to smashing that love button and show how much you enjoyed this project.