Building a BBC Micro:bit Rover
by simon-hasanprep in Teachers > 9
1523 Views, 15 Favorites, 0 Comments
Building a BBC Micro:bit Rover
Building a BBC micro:bit Rover
Introduction
This project-based learning lesson includes instructions to make a robotic rover using the BBC micro:bit and the ELECFREAKS micro:bit Motor:bit motor driver breakout board.
The BBC micro:bit is a pocket-sized microcontroller designed to inspire creative thinking in children. It was invented by the BBC and its partners and launched in 2015. The device is an open-source hardware ARM-based embedded system. It can be programmed in many different programming languages. The most popular ways to program the device are using Microsoft MakeCode (a block-based programming language) and MicroPython (a lean version of Python for optimized for microcontrollers).
The latest micro:bit (v2) adds sound sensing and playback capabilities. The device inputs and outputs are through five-ring connectors that form part of a larger 25-pin edge connector. The device is half the size of a credit card and has an ARM Cortex-M0 processor, accelerometer, magnetometer, temperature sensor, two programmable buttons, a display consisting of 5x5 LED matrix, two programmable buttons, and can be powered by either USB or an external battery pack. The micro:bit also has radio and Bluetooth connectivity.
The ELECFREAKS micro:bit Motor:bit is a motor driving board designed for the micro:bit. It integrates a TB6612 motor driving chip, which can drive two DC motors with a maximum 1.2A DC single-channel current.
The Motor:bit also includes ports for connecting the ELECFREAKS OCTOPUS series of sensors and 1 I2C communication port, allowing you to extend with various sensors and electric modules.
Additionally, the Motor:bit includes a passive buzzer for playing sounds. It is designed for students and can be used to create a smart car or other interesting projects. The Motor:bit supports a power supply of 6-12V DC.
The BBC micro:bit has been chosen for this project for two main reasons:
- The BBC micro:bit is more accessible for students as Python is easier to learn than a C-family language.
- The BBC micro:bit was designed for education and has a vast array of support in terms of documentation, lessons, and compatible hardware.
This project can be implemented in a computer science class to introduce computer science students to engineering concepts. The engineering concepts used are ideal to introduce the engineering design process.
This project and also ne implemented in an engineering class to introduce students to computer science concepts. The code base is simple enough to introduce students to coding and designing algorithms.
Note: The ELECFREAKS has been chosen for this project because it officially supports both MakeCode and MicroPython. It also is designed to work with a family of sensors that are available from ELECFREAKS. This is not the only motor driver board available for the micro:bit and the instructions in this lesson can still be used for other motor driver breakout boards using different libraries.
Standards
There is a vast corpus of standards used in education today that is used to standardize education. The standards listed below are from the following sets of standards:
- Common Core State Standards Mathematics (CCSD Math)
- Computer Science Teachers Association (CSTA)
- International Society for Teaching Technology in Education (ISTE)
- International Technology and Engineering Educators Association (ITEEA)
- Next Generation Science Standards (NGSS)
The standards for this project listed below are a small set of possible standards that can be used for this project:
CCSS Math
- HSG.MG.A.3: Apply geometric methods to solve design problems (e.g., designing an object or structure to satisfy physical constraints or minimize cost; working with typographic grid systems based on ratios). (CCSD Math)
CSTA
- 3A-AP-16 Design and iteratively develop computational artifacts for practical intent, personal expression, or to address a societal issue by using events to initiate instructions.
- 3B-AP-16 Demonstrate code reuse by creating programming solutions using libraries and APIs.
ISTE
- 1.4 Students use a variety of technologies within a design process to identify and solve problems by creating new, useful or imaginative solutions.
- 1.5 Students develop and employ strategies for understanding and solving problems in ways that leverage the power of technological methods to develop and test solutions.
ITEEA
- STEL-2T Demonstrate the use of conceptual, graphical, virtual, mathematical, and physical modeling to identify conflicting considerations before the entire system is developed and to aid in design decision making.
- STEL-7Y Optimize a design by addressing desired qualities within criteria and constraints.
- STEL-7AA Illustrate principles, elements and factors of design.
- STEL-7BB Implement the best possible solution to a design
NGSS
- HS-ETS1-2 Design a solution to a complex real-world problem, based on scientific knowledge, student-generated sources of evidence, prioritized criteria, and tradeoff considerations by breaking it down into smaller, more manageable problems that can be solved through engineering.
Supplies
1x ELECFREAKS micro:bit Motor:bit
1x Caster wheel
FDM 3D printer (Ideally a newer generation high-speed printer)
1x 1kg spool of inexpensive FDM filament for prototyping
4x AA batteries
Digital caliper
Ruler
PC or laptop (any operating system)
Scissors
Velcro (to fasten parts while testing the prototype)
6x M3x30 screws
6x M3 locknuts
6x M3 brass standoffs (optional but optimal)
6x M3x3x5mm knurled brass nuts (optional but optimal)
1x Vertical heat press for knurled brass nuts (optional but optimal)
1x Engineering design notebook or graph paper (Teacher's preference)
Measuring and Diagramming the Motor (Optional)
This is an optional step in the process. It is included because some students do not have much experience measuring with rulers, calipers or the metric system. Introducing students to diagramming objects in their engineering design notebooks is also an excellent exercise.
Objectives
Students will be able to:
- Identify the correct tool for measuring: Understand the differences between rulers and calipers and when to use each tool.
- Read and interpret measurements: Learn how to read and interpret measurements on a ruler and caliper, including the different units of measurement.
- Measure accurately: Practice measuring objects accurately using both tools.
- Apply measurement skills: Apply your measurement skills to real-world problems and situations.
- Understand the metric system: Learn about the metric system and how it is used to measure length.
Materials
- 1 hobby motor (TT motor)
- 1 caliper
- 1 ruler
- Engineering design notebook or graph paper
Procedure
- Introduce the purpose of the lesson with a short introduction that includes:
- The objectives of the lesson.
- An introduction to the motor and its parts.
- A brief demonstration of diagramming.
- Distribute a motor and measuring tools to the students.
- Instruct the students to measure the motor and draw a motor diagram in their engineering design notebooks.
- Have the students write a brief reflection about what they have learned about measuring the motor below their diagram.
Measurements will vary. This is an excellent opportunity for students to discuss their measurements and diagrams with other students. They often learn from one another in this process. Here is an example diagram from a student diagram of a motor:
Here is an example from a student diagram of a motor in their engineering design notebook:
Designing a Bracket for the Motor
In this step, students will diagram their motor bracket and render a 3D object of their motor bracket in Tinkercad. They will then be able to print their bracket and improve their design. The process has two parts, mainly to save filament and help prototype the bracket rapidly. If the students print the whole bracket, it will take longer and possibly waste filament on failed prints.
Note: This is important in the project. The bracket cannot be too tight, interfering with the motor's gears. The bracket cannot be too loose as it will cause vibrations while the motor operates. The bracket should be able to fit the motor with a little space to insert and remove the motor freely. This lesson does require a basic knowledge of Tinkercad.
Objectives
Students will be able to:
- Identify the parts of a motor: Learn about the different parts of a motor, including the bracket, and how they work together.
- Read and interpret datasheets: Learn how to read and interpret datasheets for motors, including the measurements needed to design a bracket.
- Design a bracket: Use Tinkered to design a bracket for the motor using the measurements from the datasheet.
- Print the bracket: Use a 3D printer to print the bracket and test its fit and function.
- Evaluate the design: Evaluate the design of the bracket based on its fit and function and identify areas for improvement.
Materials
- 1 motor diagram
- 2-3 M3x30 screws (to test their fit in the motor bracket)
- 1 caliper
- 1 ruler
- PC or laptop (any operating system)
- Engineering design notebook or graph paper
- 3D FDM printer with inexpensive filament
Procedure
Part 1: Fitting the Bracket to Motor Width
- Introduce the purpose of the lesson with a short introduction that includes:
- Distribute a motor and the datasheet with the motor diagram and all the measurements to the students.
- Have the students observe the motor and the given measurements on the diagram.
- Explain the importance of not making the motor bracket too loose or tight.
- Have the students diagram a motor bracket in their engineering design notebook.
- Give the students the following constraints:
- The bracket should have 3 sides with 90-degree angles.
- The walls should be 3mm thick.
- The hole for the screw should be 3.2mm
- Have the students produce their design in Tinkercad.
- 3D print the motor brackets for testing.
Note: These brackets can be printed in 8 to 15 minutes with a high-speed 3D printer.
Here is an example from a student diagram of the motor bracket in their engineering design notebook:
Here is an example from a student design of the motor bracket in Tinkercad:
After the students have a motor bracket that fits well (not too tight or too loose), they may proceed to Part 2.
Part 2: Fitting the Bracket to the Whole Motor
- Have the students observe the motor and the given measurements on the diagram.
- Point out the parts that may stick out of the sides of the motor that cannot be enclosed in the motor bracket.
- Have the students diagram a motor bracket that encloses the entire motor in their engineering design notebook.
- Give the students the following constraints:
- The bracket should have 3 sides with 90-degree angles.
- The walls should be 3mm thick.
- The hole for the screw should be 3.2mm
- 3D print the motor brackets for testing.
Note: It is best to have students make copies and work on the copy in case they may want to return to an earlier version. This is a good time to introduce the students to version control.
Here is an example from a student diagram of the entire motor bracket in their engineering design notebook:
Here is an example from a student design of the entire motor bracket in Tinkercad:
Designing the Rover Chassis
In this step, the students will begin prototyping the rover and using the engineering design process to improve their designs.
Objectives
Students will be able to:
- Design and Optimization: Design a 3D model of a robotic rover chassis using Tinkercad. They should consider factors such as the size and placement of the motor brackets, motors, motor driver plate, and wiring holes. The design should also be optimized for 3D printing, considering factors such as print time, material usage, and structural integrity.
- Integration with Electronics: Integrate the 3D printed chassis with the motor brackets, motors, motor driver plate, and other electronic components, ensuring secure and functional assembly. They should also be able to route the wires through the appropriate holes in the chassis and troubleshoot any issues that arise during the integration process.
- Reflection and Improvement: After testing the assembly of the 3D-printed chassis, students will be able to reflect on the effectiveness of their design and identify areas for improvement. They should also propose and implement modifications to the design based on their reflections and test the revised design.
Materials
- 2-3 M3x30 screws (to test their fit in the motor bracket)
- 1 caliper
- 1 ruler
- 1x ELECFREAKS micro:bit Motor:bit
- 2x DC gear motors (TT motor)
- 2x Wheels for DC motor
- 1x Caster wheel
- 1x 4 x AA battery holder
- 1x 3D printed motor bracket
- Velcro
- PC or laptop (any operating system)
- Engineering design notebook or graph paper
- 3D FDM printer with inexpensive filament
Procedure
Have the students sketch an outline of the following on a sheet of paper:
- ELECFREAKS Motor:bit
- Caster wheel
- Battery holder
- Motor bracket with motor (twice)
The sketches do not need to dimentionally accurate.
Here is an example of the components sketched:
Have the students cut out the sketched components and place them on a sheet of paper as demonstrated below:
The students can now freely move the components around and begin to imagine how the components can be placed in a roughly accurate scale.
Have the students move them around to see how they may fit together in their design. Here is a student's example:
Once they have an idea of how their components can be placed, they can start to diagram their chassis:
When they have a design, they want to try to produce, they can render the design in Tinkercad as demonstrated below:
Students can now begin improving their designs using the engineering design process. Next, they can test the stability of their designs with all the components in place.
It is easier to attach the components with Velcro. Students can move components to distribute weight to optimal places on the chassis.
Students' designs will differ greatly; they will learn more about what works as they watch their peers. Allow them to collaborate and exchange ideas about their designs. Some will topple when turning or flip while moving forwards and backward.
Wiring the robots is relatively simple, as displayed below:
Now, students are ready to begin testing and coding their rovers.
Testing the Stability of the Design With MakeCode
ELECFREAKS offers an extension for Motor:bit.
The students can go to the MakeCode for micro:bit here.
Once they create a new project, they have to load the extension by clicking on Extensions:
Search for motorbit and select it:
The students now have all the necessary blocks to code their robots:
It is best to place the code for the rover in the [on start] block unless the students want to run the code in an infinite loop:
Students should always put a delay of 5 seconds before any code to allow them time to back away from the rover. This prevents damaging their designs.
There are three types of turns the students should understand. These turns depend on the way the wheels move.
Turning the wheels in opposite directions creates the following type of turn:
Turning one wheel creates the following type of turn:
Turning both wheels at a different percentage creates the following type of turn:
Allow the students to create their stress tests to test the stability of their rovers. They can collect data in their engineering design notebook and improve their prototypes.
Testing the Stability of the Design With MicroPython
ELECFREAKS offers a MicroPython library for Motor:bit.The students can go to the micro:bit Python Editor here.
A translated version of the library can be downloaded here. Once the repository is downloaded and extracted, the motorbit.py file must be loaded in the editor. A .hex file with the library preloaded called motorbit-starter.hex is available in the same repository.
Open this file in the micro:bit Python Editor.
The library is preloaded in the microbit-starter.hex file, and students can code their stress tests for their rovers.
The library is pretty simple students must first instantiate a MOTORBIT object as follows:
from microbit import *
from motorbit import MOTORBIT
# Instantiate a MOTORBIT object
rover = MOTORBIT()
To move forward at full speed, the code is as follows:
from microbit import *
from motorbit import MOTORBIT
# Instantiate a MOTORBIT object
rover = MOTORBIT()
rover.set_motors_speed(100, 100) # Move forward full speed
The values for the motor are an integer between -100 and 100. To move backward at full speed, the code is as follows:
from microbit import *
from motorbit import MOTORBIT
# Instantiate a MOTORBIT object
rover = MOTORBIT()
rover.set_motors_speed(-100, -100) # Move backward full speed
To stop all the motors set the value in the method to 0 for both motors:
from microbit import *
from motorbit import MOTORBIT
# Instantiate a MOTORBIT object
rover = MOTORBIT()
rover.set_motors_speed(0, 0) # Stop all motors
There are three types of turns the students should understand. These turns depend on the way the wheels move.
Turning the wheels in opposite directions creates the following type of turn:
Turning one wheel creates the following type of turn:
Turning both wheels at a different percentage creates the following type of turn:
Allow the students to create their stress tests to test the stability of their rovers. They can collect data in their engineering design notebook and improve their prototypes.
Modifying the Rover Design
The students can now modify their designs after they have created their stress tests. When they are satisfied with how the rover operates, they can now remove the Velcro and fasten the components to make them more permanent. The knurled brass nut inserts and standoffs are a popular way to make them more stable and permanent after rigorous testing and modification. The rovers are now ready for whatever they want to do with them.
- Adding crash sensors
- Adding line following sensors
- Navigation obstacle courses
- Etc.
Allow the students to tinker and make and break things. There are valuable lessons in mistakes. It is part of the engineering design process.
Happy coding!