Get Help
Using the Ultrasonic Distance Sensor (miniBloq)
Introduction
In this lesson, we will start learning how to do some basic tasks with sensors, specifically with the ultrasonic ranger included within Sparki. Although we will explain here the basics of usingthis sensor, the inner workings are better explained here. Please take a few minutes to read that link if you are completely new to ultrasonic ranger finders.Basic Sensor Usage
The ultrasonic ranger is really easy to use. There is just one instruction, which basically returns the distance read by the sensor:




Moving the Head
One nice feature of Sparki is that the ultrasonic ranger is mounted on a rotating head. It’s powered by Sparki’s servo, so we can control it with the following instructions (please read the previous link if you are not familiar with this kind of servos):




Questions
- What do you think happens when the sensor is used against materials that can absorb the mechanical ultrasonic waves? Why not try some experiments?
- Have you seen this sensor used in real modern cars? For doing what?
- And what about animals? Which animals use this kind of sensor to navigate?
Related Lessons
So, now that we know how to read the sensor and how to move it, we are ready to go to the next lesson: Wall Avoidance. Finally, at this time, you may have noted that some times, the readings are not that accurate. In future lessons, we will try to explain some techniques to reduce these and other problems when reading sensors.SparkiDuino Programming Environment
