====== Ultrasound Module ====== Included in your starter kit is an UltraSound distance detector module. The model is a HC-SR04. The transmitter sends out a pulse of ultrasound, it's reflected from an object and then the return signal is detected by the separate receiver on the module. If there is no object in the path of the wave then no signal is received by the receiver. {{workshops:ultrasound-theory.png}} The distance can be calculated using the simple physics formula: ''Distance = Speed of Sound in Air x Time'' As the ultrasound travels from the transmitter to the object and back again the result needs to be divided by 2. ====== Wiring ====== {{workshops:ultrasound.png?800x0}} ====== Software ====== The nice thing about using Arduino to interface with Hardware, is usually somebody else has already done the hard work to write a library of code for others to use. You can focus your effort on your cool project rather than working out how to interface with a piece of hardware. * Download the Zip file from http://tetrasys-design.net/download/HCSR04Ultrasonic/HCSR04Ultrasonic-1.1.2.zip * Follow the instructions for installing a library at [[http://arduino.cc/en/Guide/Libraries|Library Tutorial]] * Once you've installed the library and restarted the Arduino IDE you should see a new section in the menu, ''File->Examples->HCSR04Ultrasonic->UltrasonicDemo'' click on that to open a new sketch with the example * Change the start of the file to match the pins you wired up #define TRIGGER_PIN 12 #define ECHO_PIN 11 * Upload the Sketch to your Arduino and open the serial console, you should see a distance measurement output every second. | {{workshops:challenge_yourself.jpg?200x0}}| **Intermediate** \\ **(1)** Make a parking guide that switches on a LED when a object gets closer than 10cm to the sensor. \\ **(2)** Change the parking guide to change the tone of the buzzer based on the distance from an object. \\ \\ **Harder** \\ **(3)** Build a water depth gauge that will sound an alarm when the water reaches over 90% of the container capacity. | ====== Next Stage ====== Congratulations. Now you can go onto the next stage! [[stage_6|Stage 6]].