This project belongs to the Kitronik :MOVE Motor series projects, it based on PJ009.2: Collect MOVE vehicle sensors data. The project uses the vehicle's onboard IR light sensors to detect the black lines marked on TM016: Kitronik :MOVE mat line following and activity map, it's an application for knowledge KB017: Line Following Algorithm. This project contains 2 steps for implementation, the project can be split into 2 parts in actual teaching and learning activities. Goals:
Fun experience with Kitronik :MOVE Motor's onboard IR light sensors for line following
Engineering practice: Problem analysis, algorithm designing, solution implementation and tuning for a result
Practice with while-do looping logic
Practice using Functions to structure the program design, use function with return value
Inspire interests on robotics and programming
START A BIT > Projects Library > This page
Here is the demo of the planned results.
Just the standard TM015: Kitronik :MOVE Motor for Micro:bit kit, remember to install the 4 batteries, TM016: Kitronik :MOVE mat line following and activity map is used for this activity.
Implementation 1/2: Prototype with Indications, No Moving
This step focuses on the algorithm designing, and verify it on the vehicle using the real sensor data, implement the evaluation of "too much to the left/right" state, indicate it on the LED matrix, the vehicle will be kept still, not moving.
Implementation 2/2: Add Moving and Fine-tune the Result
This step adds the moving functions, and assemble every piece together to make a working result, this step also includes debugging and retrying to fine-tune an expected result.
[ ] Simple: 30-60 minutes
[x] Moderate: 1-2 hours
[ ] Challenging: more than 2 hours
The estimation bases on average situation without unexpected difficult troubleshooting. It only indicates rough time needed to complete this project, but not about technical difficulty, not covering discussion and sharing time. Here is a possible breakdown:
5-8 minutes: Understand requirement and goals, collect materials
15-30 minutes: Line following sensors understanding, algorithm designing
30-45 minutes: Implementation 1/2: Prototype with Indications, No Moving
30-45 minutes: Implementation 2/2: Add Moving and Fine-tune the Result
One should have prior knowledge
Micro:bit V2 board: Know what it is, better to have prior experience using them
MakeCode by Microsoft, the programming tool, better to have prior experience using it with Micro:bit
Completed PJ009.2: Collect MOVE vehicle sensors data, it's very important to have experienced with IR sensor data collection
1x TM015: Kitronik :MOVE Motor for Micro:bit, unboxed, or assembled
1x TM016: Kitronik :MOVE mat line following and activity map
4x Alkaline AAA batteries
1x Micro:bit V2 board , with USB cable
Refer to TM015.1: Kitronik :MOVE Line Following Board for more details
Analog signal input to Micro:bit pin 1, 2
Read value integer
0 (darkest surface) - 1023 (lightest surface)
KB017: Line Following Algorithm explains the logic. And it's very helpful to use PJ009.2: Collect MOVE Vehicle Sensors Data or PJ009.2.1: Collect MOVE Vehicle Sensors Data Using VIEW OLED Display to visualize the real time sensor data so to find out the threshold values to judge the deviation.
Click "Extensions"
Search by keyword "MOVE"
Click the found result
Then "MOVE Motor" blocks are available
The read values are ranged as integer
0 (darkest surface) - 1023 (lightest surface).
Note:
It's the same when reading analog signal input from Micro:bit pin 1, 2.
The value is as integer, so no decimals
MOVE Motor -> Sensors-> Line Following->
This while-do looping is useful to help the continuous checking the ultrasonic sensor value until finding the obstacles
Loops ->
Use these blocks to control specific side's motor to to move
MOVE Motor -> Motors -> Motor Control ->
This block controls specific side's motor to stop
MOVE Motor -> Motors -> Motor Control ->
This is the main logic, as reference. There could be other solutions and the logic flow could differ a bit.
Note:
The blue block "call ..." is calling the functions that are defined separately.
Just follow the algorithm logic, here is the snippet
There are several ways to do the adjustment, here is one example to reach
Do you have other algorithm/solution for the vehicle to
Detect the "too much to left/right side"?
Adjust to right/left side?
Why is the vehicle driving wagging so much? What can we do to improve the soomthness?
Share with your group about
What troubles you met
How you analyze
How you get help
How you solve it
What you have learnt
More document and tutorials in TM015: Kitronik :MOVE Motor for Micro:bit
The current solution makes the vehicle exploring all the time, never stop. Can you improve the program to let it stop after 10 times of obstacle detected?