The Build
- Build and test your cyber:bot, following all tutorials up to Navigation with the cyber:bot
- Attach the Ping))) sensor and Mounting Bracket Kit to your cyber:bot, following the directions that come with the kit.
- The Ping))) Sensor plugs into servo header pin 16 on the cyber:bot board.
- Mounting bracket standard servo plugs into servo header 17 on the cyber:bot board.
- Center the Ping))) Mounting bracket on the servo horn.
- Attach the Ping))) Mounting Bracket to the servo horn.
- Move it back and forth and verify that the approximately 180 degrees of movement occurs evenly in front of the robot (the servo has mechanical limits)
- Reposition it as necessary before tightening the black screw.
- Next, you’ll need to check the servo wires to make sure they are free of binding.
It’s a good idea to add a “strain relief” with a zip tie or small wire to each end of the cable. One could secure the Ping)))’s cable to the header block and another may be used to keep the cable pointed upward so it doesn’t interfere with components on the breadboard. Make sure the cable doesn’t rub against anything when the servo moves.
How the Ping))) Ultrasonic Sensor Works
The Ping))) Ultrasonic Distance Sensor lets your cyber:bot detect obstacles by measuring the distance to them.
Much like a bat, the Ping))) sensor emits an ultrasonic chirp, then listens for the chirp's echo. The time between these two events is used to calculate the distance to an object. While most objects will return an echo, be aware that size, material, and angle all make a difference, as shown in the image below.
The Ping))) sensor measures the echo return time in terms of microseconds. Then, it uses the fact that sound travels at 0.03448 cm/µs at room temperature. That’s 3.448 hundredths of a centimeter per millionth of a second at a temperature of (22.2 ºC). Just as a car travels distance = speed x time, so does sound, with an equation of s = ct, where s is the distance, c is the speed of sound and t is the time.
Did you know that the speed of sound in air actually changes with air temperature? This Learn reference article explains more about why this happens. Temperature extremes can actually make a slight, but notable, difference in Ping))) sensor measurements.