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 ultrasonic sensor to measure the front environment, so to find a out-gate of the trap. Goals:
Fun experience with Kitronik :MOVE Motor's onboard ultrasonic sensor
Engineering practice: Problem analysis, solution implementation and tuning for a result
Experience with while-do looping logic
Inspire interests on robotics and programming
START A BIT > Projects Library > This page
Here is the demo of the planned result.
Check 24w10 Learn by Data Logging, and Fun Making with Ultrasonic Sensor for some results demo by the students
Just the standard TM015: Kitronik :MOVE Motor for Micro:bit kit, remember to install the 4 batteries, no extra need.
We use a book, or similar material, to build a trapping like the picture, the shape and depth is flexible, but the opening should be made just enough for the vehicle to drive out.
The vehicle will be placed inside, and use the "logo" touching to start, then the vehicle should spin (towards left or right, no matter), it should stop towards the opening, and then start driving out for a few seconds, and stop.
[x] Simple: 30-60 minutes
[ ] 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-20 minutes: Programming, download to Micro:bit, test and improve program, retest to reach a good 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
Not a must, but better to have completed PJ009.2: Collect MOVE vehicle sensors data
1x TM015: Kitronik :MOVE Motor for Micro:bit, unboxed, or assembled
4x Alkaline AAA batteries
1x Micro:bit V2 board , with USB cable
One or a few books, used to build the walls of the trapping map
Click "Extensions"
Search by keyword "MOVE"
Click the found result
Then "MOVE Motor" blocks are available
Just use the block as a value of the measured distance, the unit , in cm or inch, needs to be set on start.
MOVE Motor -> Sensors-> Ultrasonic->
Remember to set unit on start
This makes the vehicle spinning around the "pen hole" in the middle of the vehicle chassis.
MOVE Motor -> Motors-> Drive->
This while-do looping is useful to help the continuous checking the ultrasonic sensor value until finding the opening of the trap
Loops ->
This snippet hints the main logic to spin and continuously measure ultrasonic sensor values, and stop facing the opening of the trap.
Note:
The spinning speed, ultrasonic threshold value need fine tuning to fit your real situation.
The functions "coutdown_to_start" and drive_out" are not shown here, it's easy to figure out by yourself.
Can you sort out an answer for those questions for ultrasonic sensor?
What could affect the accuracy of distance measurement?
How to ensure a better measurement quality?
What could be missed from the perception of ultrasonic sensor?
Share with your group about
What troubles you met
How you analyze
How you get help
How you solve it
What you have learnt
How does ultrasonic sensor detect the distance? Tell us your understanding.
More document and tutorials in TM015: Kitronik :MOVE Motor for Micro:bit