One of our favorite sensors that come on the Q-Scout and Qooper robots, is the ultrasonic sensor. The ultrasonic sensor allows the robot to interact with the world around them, by identifying how far away they are from an object. The sensor has a transmitter, which sends an ultrasonic wave out, and then a receiver, which reads the wave when it bounces back. Depending on how long it takes the wavelength to bounce off an object and return, the robot can determine how far away an object is. This is extremely useful, because you can write code, that when an object is X distance away, the robot does something, such as changes the lights or moves in a certain direction.
Check out our video below to see Q-Scout change his lights depending on how close a box is to him, and also to navigate around a space without bouncing into anything. Under the video, you can find the code for both so you can get started with your own robot!
Ultrasonic Sensor - Lights
If an object is more than 20cm away, the lights will be green, if not, the lights will be red
Ultrasonic Sensor - Motion
If the robot is more than 20cm away from an object, it will move forward at a speed of 50. If not, it will run backwards for 1 second, then turn right for 1/2 second. By having it run backwards and turn right, it will reposition the robot, so it should be away from the object, and can then move forward.
Want a set of robots for your classroom? Check out our page for more information!
Have an idea on what you can use the ultrasonic sensor for? Let us know!
Follow us @aquilaeducation