Ultrasonic Range Sensor (HC-SR04)
The HC-SR04 Ultrasonic Range Sensor uses non-contact ultrasound sonar to measure the distance to an object - they're great for any obstacle avoiding systems on Raspberry Pi robots or rovers! The HC-SR04 consists of two ultrasonic transmitters (basically speakers), a receiver, and a control circuit. The transmitters emit a high frequency ultrasonic sound, which bounce off any nearby solid objects, and the reciever listens for any return echo. That echo is then processed by the control circuit to calculate the time difference between the signal being transmitted and received. This time can subsequently be used, along with some clever math, to calculate the distance between the sensor and the reflecting object!
The HC-SR04 is great, as it's low cost, can be powered via the Raspberry Pi's 5V output, and is relatively accurate! Please Note. The HC-SR04 has a 5V output (which needs to be reduced to 3.3V to work with the Raspberry Pi). We've put together a full tutorial on the HC-SR04 and the Raspberry Pi here!
The HC-SR04 sensor works best between 2cm – 400 cm (1" - 13ft) within a 30 degree cone, and is accurate to the nearest 0.3cm.
The HC-SR04 Ultrasonic Range Sensor Features: