We have known that Maqueen Plus V2 is such a changeable robot with various functions, but more surprisingly, he can measure distance using his ultrasound eyes. With this buddy, you can say goodbye to your measuring tool.
Goal
1. Get to know ultrasound
2. Learn the principle of ultrasound
3. Measure distance using ultrasound
Electronic Component
Command Learning
What is ultrasound?
As we know, when vibrating, objects produce sound waves. Some of them can be heard by human ears, while others cannot. Scientists named the vibrating times per second as the sound frequency with its unit named as Hertz. Almost all human beings are able to hear the sound frequencies ranging from 20 to 20000Hertz. Sound frequencies out of that range are inaudible to humans. For those sound, the scientists name it as "Ultrasound".
How does an ultrasonic sensor measure distance?
Ultrasonic sensors work by sending out a sound wave at a frequency above the range of human hearing. The sensors determine the distance to a target by measuring time lapses between the sending and receiving of the ultrasonic pulse.
Hands-on Practice
Hardware Connection:
The pin connection is shown below:
Step 1 Create a New Project
1.Input https://makecode.microbit.org/ into your browser to enter the MakeCode editor.
2.Click "new project" to enter the MakeCode programming interface.
3.Add the Maqueen Plus V2 library: https://github.com/DFRobot/pxt-DFRobot_MaqueenPlus_v20
Step 2 Programming
1. Place the "show number" block into the "forever" block, shown as below.
2. Put the distance value detected by the ultrasonic sensor inside the "show number" block to display the current distance on the micro:bit LED matrix in real time.
3. The entire program is shown below.
4. Name your project as "Little ranging expert" and save it.
Step 3 Download Program
Step 4 Effect Display
Turn on the power switch, then we can use Maqueen Plus V2 to measure distance. The detected distance will be displayed on micro:bit.
Think & Explore
How do we measure the height of a person with an ultrasonic sensor?
Click Buy micro:Maqueen Plus V2 (Ni MH Rechargeable Battery) - an Advanced STEM Education Robot for micro:bit - DFRobot
Click Buy micro:Maqueen Plus V2 (18650 Battery) - an Advanced STEM Education Robot for micro:bit - DFRobot
Engage in learning the next Robot project:Auto-braking Robot
Engage in learning the previous Robot project : Moth Robot