Close

Sensors

A project log for Wall Following and Obstacle Avoidance

Raspberry Pi 3B based robot, distance sensors, and ROS.

Sinclair GurnySinclair Gurny 12/22/2017 at 06:240 Comments

Ultrasonic Sensor

AKA Sonar Sensors measure distance by sending a sound pulse and waiting for it to return. The datasheet lists accuracy up to 400 cm in ideal conditions. Sonar sensors are digital sensors that require two GPIO pins to use: one to ‘Trigger’ the ultrasonic pulse, and one to receive the time for the ‘Echo’ to return. The distance needs to be manually calculated using the time it takes for the echo pin to return a pulse, and the speed of sound. The equation becomes distance = ((time / 29) / 2). Where time is in microseconds, 29 microseconds per centimeter which is the inverse of the speed of sound in the correct units. Half of that distance is taken because the pulse goes there and back.

Infrared Sensor

Sharp IR distance sensors measure distance by sending IR light and measuring the angle at which it returns. IR sensors are analog, which lead to several design choices discussed later. The sensor can measure distances between 10 cm and 80 cm, by reading voltages of  3.1V and 0.4V respectively. However, according to the datasheet and as seen in practice the actual voltages can vary.

Discussions