The purpose of this file is to explain how the HCSR04 works. It will give a brief explanation of how ultrasonic sensors work in general. It will also explain how to wire the sensor up to a microcontroller and how to take/interpret readings. It will also discuss some sources of errors and bad readings. 1. H Ult i S s Work 2. HC
The purpose of this file is to explain how the HCSR04 works. It will give a brief explanation of how ultrasonic sensors work in general. It will also explain how to wire the sensor up to a microcontroller and how to take/interpret readings. It will also discuss some sources of errors and bad readings.
2. HCSR04 SpecificationThe sensor chosen for the Firefighting Drone Project was the HCSR04. This section contains the specifications and why they are important to the sensor module. The sensor modules requirements are as follows. ● Cost ● Weight ● Community of hobbyists and support ● Accuracy of object detection ● Probability of working in a smoky environment ● Ease of use The HCSR04 Specifications are listed below. These specifications are from the Cytron Technologies HCSR04 User’s Manual (source 1). ● Power Supply: +5V DC ● Quiescent Current: <2mA ● Working current: 15mA ● Effectual Angle: <15º ● Ranging Distance: 2400 cm ● Resolution: 0.3 cm ● Measuring Angle: 30º ● Trigger Input Pulse width: 10uS ● Dimension: 45mm x 20mm x 15mm ● Weight: approx. 10 g The HCSR04’s best selling point is its price; it can be purchased at around $2 per unit.
3. Timing Chart and Pin Explanations The HCSR04 has four pins, VCC, GND, TRIG and ECHO; these pins all have different functions. The VCC and GND pins are the simplest they power the HCSR04. These pins need to be attached to a +5 volt source and ground respectively. There is single control pin: the TRIG pin. The TRIG pin is responsible for sending the ultrasonic burst. This pin should be set to HIGH for 10 μs, at which point the HCSR04 will send out an eight cycle sonic burst at 40 kHZ. After a sonic burst has been sent the ECHO pin will go HIGH. The ECHO pin is the data pin it is used in taking distance measurements. After an ultrasonic burst is sent the pin will go HIGH, it will stay high until an ultrasonic burst is detected back, at which point it will go LOW. Taking Distance Measurements The HCSR04 can be triggered to send out an ultrasonic burst by setting the TRIG pin to HIGH. Once the burst is sent the ECHO pin will automatically go HIGH. This pin will remain HIGH until the the burst hits the sensor again. You can calculate the distance to the object by keeping track of how long the ECHO pin stays HIGH. The time ECHO stays HIGH is the time the burst spent traveling. Using this measurement in equation 1 along with the speed of sound will yield the distance travelled. A summary of this is listed below, along with a visual representation in Figure 21. Set TRIG to HIGH 2. Set a timer when ECHO goes to HIGH 3. Keep the timer running until ECHO goes to LOW 4. Save that time 5. Use equation 1 to determine the distance travelled
All about the HCSR04 ● http://www.circuitdb.com/?p=1162 ● http://www.micropik.com/PDF/HCSR04.pdf ● http://randomnerdtutorials.com/completeguideforultrasonicsensorhcsr04/ ● http://www.ezdenki.com/ultrasonic.php (^fantastic tutorial, explains a lot of stuff) ● http://www.elecrow.com/hcsr04ultrasonicrangingsensorp316.html (^ this one has some cool charts)
Your message must be between 20-8000 characters