Distance measurement using the ultrasonic HC-SR04 sensor and Bolt 18F2550 system
Modern ultrasonic sensors for the measurement of distances, are inexpensive and allow their connection to microcontroller systems. These sensors have a small speaker and a receiver microphone of the ultrasonic signal bounced by the object from which you want to measure the distance.
The principle of operation is as follows: through the speaker, trains of ultrasound pulses are sent at a frequency of 40 Khz. This signal bounces off the object, and returns to the sensor, being detected by the microphone (Figure 1). Once the delay is measured between the signal emitted and received, based on the constant speed of propagation of sound (340 meters per second) and using an arithmetic formula (Figure 5) the distance to the object can be calculated.
The HC-SR04 sensor, capable of measuring distances between 2 cm and 4 meters, was used in the project described below.
Figure 1: Testing equipment for the ultrasonic sensor HC-SR04
Figure 2: Connection diagram between HC-SR04 sensor and Bolt 18F2550 board
Figure 3: Bolt 18F2550 system with HC-SR04 sensor displaying the distance on its LCD
Figure 4: for checking the accuracy of the sensor, tests were made with a scale ruler, moving the object and noting the distance shown by system Bolt 18F2550 on its LCD, and comparing with the mark on the scale ruler. The precision is approximately 3 mm measuring distances from 3 cm up to 50 cms.
Figure 5: Calculus of distance given the time elapsed by the ultrasonic signal (outbound and return).