![fritzing ultrasonic sensor fritzing ultrasonic sensor](https://hackster.imgix.net/uploads/attachments/1353792/how_to_measure_your_height_by_ultrasonic_sensor_project_uHMkUplTyn.jpg)
Beware of the little change between the photo and the schematic. In real life this is the setup I used in my case. In this example the trigger pin is connected to 8 and the echo pin to the 9 of the Arduino. wikiDFRobot URM09 is an ultrasonic sensor designed for fast ranging and obstacle avoidance applications, temperature compensation and analog output. Just connect the 5 volt and the ground to the outer pins. The connection of the HC-SR04 to an Arduino is really straight forward. Between two pings we need to keep a 60ms measurement cycle. Because of this we need to divide the result by two. The ping is traveling towards an object and back to the sensor again. We have to divide the length of the pulse by 2.9 to get the result in mm. The speed of sound is 340 m/s or 2.9 micro seconds per mm. You can calculate the distance with the length of the echo pulse and the speed of sound.
![fritzing ultrasonic sensor fritzing ultrasonic sensor](http://workshopweekend.net/arduino/labs/_?repo=many-ways-to-blink-4&path=many-ways-to-blink-4.png)
When the distance is measured by the 8 pulses the HC0SR04 puts a pulse on the echo pin. To start a ping you need to provide a 10us pulse on the trigger input. Note that while the recommended ultrasonic sensor is actually a weatherproof model, the pinout is.
![fritzing ultrasonic sensor fritzing ultrasonic sensor](https://forum.fritzing.org/uploads/default/original/2X/8/8dcb67d1bcfc039c777a95168a5f5602efcb88a8.png)
One ping of the HC0SR04 actually exists of 8 pulses at 40 kHz to do the measurement. The sensor circuit is available as a Fritzing project. At 1 meter this is 26 cm so we have to keep this in mind when using this information. At 4 meter distance this should be a beam of about 1 meter. The measuring angle from the HC-SR04 is 15 degree. One pin is the trigger ping and the last one is used to read the result of the measurements, the echo pin. Two pins are needed to power the module with 5 Volts. The module is about 45x20x15 mm in size and has a 4 pin connection. Because using sound for its measurements we can reach up to 4 meters.
![fritzing ultrasonic sensor fritzing ultrasonic sensor](https://i.pinimg.com/originals/82/d8/fa/82d8faa73de95dce3ed393d5c1e35d14.png)
The HC-SR04 sends a ping as a submarine does and measure the time between sending and receiving anything back when an object is in front of the sensor. and receiving anything back when an object is in front of the sensor. The HC-SR04 uses sound instead of light as the GP2D12 module does. In this project we are going to use the HC-SR04 ultrasonic ranging module with an. The connection to the Ultrasonic sensor and LCD are standard and well documented. In this project we are going to use the HC-SR04 ultrasonic ranging module with an Arduino. The Fritzing diagrams show the Bread-Board and Schematic for the overall system. Also the HC-SR04 is cheaper than the GP2D12. To detect objects further away we can use an ultrasonic ranging Module. This is a good solution for indoor projects and can detect objects up to 80 cm. As a result, the Measured distance = (T(Time of High Level output ) * (340M / S)) / 2 The reason for the division by two is that since this is a echo it has traveled both to and from the object.Earlier we did a project with an infrared distance measurement project with the GP2D12 module from Sharp. When there is an reflect signal back, the ECHO I/O will output a high level, the duration of the high-level signal is the time from untral sonic launch to return.The ultrasonic module will automatically send eight 40khz square waves, and will automatically detect when there is a reflect signal.Send a pulse signal to I/O TRIG which is at least 10us long, this will activate the module to start detecting.In short a ultrasonic sensor like this works like: Not sure what the out pin is about, I have seen claims that it goes high when it detects a obstacle.įrom my personal observations the HY-SRF05 seems like a slightly more accurate sensor and seems to have a much better range – but if I were to build for instance a robot that should not collide with a wall that would not matter. Both these ultrasonic range modules are fairly cheap modules, expect the HY-SRF05 to be the more expensive of the these two.Īt a quick glance there are only small differences between these two:Įlectric frequency signal, high level 5V, low level 0V