Lab's Objective:
Bimo X Lab 4
Objective
Students will be able to code their robot to measure distances with a sonar sensor.
Activity
Students will learn to connect a four wire sensor which is more complex than three wire.
Students will teach their robot to interact with their environment through distance measurements and even avoid obstancles.
Assessment
Students will learn to visualize what the robot sees once it starts deteting distance.
Students will be able to imagine course of the robot when it comes to avoiding obstacles with sonar and what are the limitations.
Google Slides
Build Video
Today we will learn about the sonar sensor. In earlier labs we learned that a sensor is an object that allows the computer to sense the world around it, hence the word derrived from sense. A sonar sensor is a special sensor that allows the computer to measure distances. It is so accurate that you can trust it up to 4 milimiters. If we know, 4 milimeters is such a tiny distance that we can say its exact. These sensors are used to measure tanks heights, submarines, and many other examples. What a sonar does is it sends an ultrasonic sound that only it can detect. The sound travels throught the distance and the bounces back if there is an object or wall. The sound comes back to the sensor and then does calculations on the time the sound wave took to get back to the sensor. This is key as we can turn that time and velocity of the wave into a distance! That is how our little sensor works.
Lab Summary:
Required Materials:
Photos | Item Name | Purpose | Required Quantity | Labeled Bag |
---|---|---|---|---|
Step 1
First attach the sensor to the hinge in the front of Bimo. Use the wires to connect to the microcontroller. One of the wires is called echo and the other is trigger. The trigger connection is the one that sends the ultrasonic sound and the echo is the one that receives the sound, hence called echo.
Step 3
Lastly, use the distance parameter and have it avoid an obstacle. The idea is if it detects a wall a distance away the go right or left. The distance has to be specified it cannot be if its around 10 centimenters for example. We can always use the comparators which are if its less thatn 15 centemeters go right or left.
Step 1
Step 2
Download the library and see if you can get the distances to show on the terminal. The blocks only give us centimeters and millimeter. If you are up for the challenge you can convert them into inches or feet if you know the math behind it.