This is an old revision of the document!
The SR-04 ultrasound module can be used for many applications. For example, it can be used to trigger Halloween decorations, as car back-up proximity alerts in garages, movement alarms in homes, or as a basement sump water level alarm.
There are four pins: Vcc and GND, which supply power to the module, trigger, which is used to send an ultrasonic pulse when brought high by the Arduino, and echo, which is used to receive the echo of the pulse. The time it takes for the emitted pulse to echo back to the module is what's used to calculate the distance to the object or person. The formula is distance = echo time * speed of sound / 2. The SR-04 can measure distances from 2cm to about 400cm.
RGB LEDs come in two flavours: common anode (positive supply) and common cathode (negative). They are essentially three LEDs in one package, with either the positive or negative leads connected internally. As with all LEDs, we will add a current-limiting resistor to prevent the LED from drawing too much current and getting damaged. We are using the same value resistor for all 3 LEDs in this workshop, but if you were to do this for a long-term project you would want to calculate the optimum resistance for each LED.