This project is an alternative to PJ009.2: Collect MOVE Vehicle Sensors Data, which uses Micro:bit serial communication (redirected to USB). This project uses TM012: Kitronik :VIEW OLED 128x64 Display for Micro:bit to directly display ultrasonic sensor and IR light sensor data to visualize and analyze the real-time environment perceptions. The test scenarios and analysis tasks are exactly the same as PJ009.2. Goals:
Fun experience with Kitronik :MOVE Motor's onboard perception sensors
Fun experience with Kitronik :VIEW OLED display
Engineering practice: Data logging/collection, visualization and analysis
Knowledge preparation for obstacle detection effectiveness, and line following algorithm
Inspire interests on robotics and programming
START A BIT > Projects Library > This page
Here is the demo of the setup with VIEW OLED display, it's a "dry run" without the MOVE vehicle here, but in actual test tasks, the board is plug into the MOVE vehicle.
The standard TM015: Kitronik :MOVE Motor for Micro:bit kit, remember to install the 4 batteries, plus TM012: Kitronik :VIEW OLED 128x64 Display for Micro:bit.
Please refer to the "Tests and Analysis" section below for the test scenarios. The main purpose is to find out the effectiveness of objects detection.
Please refer to the "Tests and Analysis" section below for the test scenarios. The final purpose is to find out an algorithm of line following.
[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
10 minutes: Programming, download to Micro:bit, and can see data collecting ongoing
5 minutes: Focus on ultrasonic data, adjust actual distance and compare with data
10-15 minutes: Focus on IR light sensor data, place the vehicle on different surfaces, put the vehicle "in line" or "out of line", observe and analyze the data
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.1: Make MOVE vehicle driving forward
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
Some TM020: Masking Tape with different colors
1x A4 printing white paper
1x ruler (10-30 cm) to measure the physical distance
Refer to KB016: Ultrasonic Sensor, TM019: Ultrasonic sensor HC-SR04 for more details
The distance is calculated by looking at how much the delay of hearing the reflected sound
Read value in unit cm or inch that needs to be set on start
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)
Refer to TM012: Kitronik :VIEW OLED 128x64 Display for Micro:bit
No any wiring needs, just plug and play!
Click "Extensions"
Search by keyword "MOVE"
Click the found result
Then "MOVE Motor" blocks are available
Click "Extensions"
Search by keyword "VIEW"
Click the found result
Then "128x64 Display" 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.
Note:
The value is as integer, so no decimals, which means the resolution of distance value is a full 1 cm/inch
MOVE Motor -> Sensors-> Ultrasonic->
Remember to set unit on start
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 is the block to show things on the display, there are some options to specify more details of where and how to display, click "+" to expand.
128x64 Display -> Show ->
This is to connect several strings/texts and numbers together as a new string, this is useful to make a whole value for OLED to display as a line.
Text ->
This snippet bases displays the distance data on OLED display, while still keeping it sending to PC.
This snippet collects left and right light sensor data, and the difference value, display them on OLED, and also sending to PC.
Place the vehicle towards a good blockage (e.g. a box with flat surface, large and high enough), in 3 different distances (near, mid, far), measure the physical distance, compare with the data from ultrasonic
Real distance
Sensor value
Difference
Are you satisfied with the data accuracy vs reality?
Try an irregular shape object, like a coffee mug, test again, find out how accurate the measurement data is
Real distance
Difference placement of the object (height, angle, etc.)
Sensor value
Difference
How accurate is it for this object now?
Try a random small irregular object, like a marker pen, test again, find out how accurate the measurement data is
Real distance
Difference placement of the object (height, angle, etc.)
Sensor value
Difference
Can the sensor detect this small object? How accurate about the data for distance vs reality? What needs to be minded for this kind of objects detection by ultrasonic sensor?
Put the vehicle on top of different surfaces (different color or materials), try at least 3 options, observe the real time data, find out the differences.
White paper
Black surface, e.g. the laptop
Colored surface, table top, or a book, etc.
What kind of surface gives the highest sensor value? The lowest sensor value?
Test on different tapes, find out the sensor values difference on top of the tapes and on the white paper.
Black tape
Blue tape
Yellow-white tape
Which kind of tape gives the most differences comparing to white paper? Which tape is more suitable to mark a line following map?
Test on the standard TM016: Kitronik :MOVE mat line following and activity map, place the vehicle on top of the line, place the vehicle (accurately it's the sensor board).
The Left/Right is meant from the vehicle's point of view in forward direction.
In the middle of the line
Left deviated from the line
Right deviated from the line
What is the pattern from the real time data for above situations?
Can you sort out an answer for those questions for ultrasonic sensor?
How does the ultrasonic sensor detect the distance?
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?
Based on the analysis of the left/right/diff data from the sensors when the vehicle is in the middle of the line, left deviated, right deviated from the line, can you figure out an algorithm for line following?
Note: The Left/Right is meant from the vehicle's point of view in forward direction.
More document and tutorials in TM015: Kitronik :MOVE Motor for Micro:bit
So now we know the ultrasonic sensor, as well as the real time data, it's fun to continue trying next project.