Arduino Proximity Alarm
Do you have a pesky sibling or pet that sneaks up on you? Are cars always in your blind spot? Create a proximity alarm that alerts you to approaching objects. This simple guide will teach you how to create a proximity alarm that will light up and make noise when something approaches.
An ultrasonic rangefinder and Arduino microcontroller will check for nearby objects and if need be, alert you with a piezo-buzzer and RGB LED. Learn about these components using electronics lab simulations and eventually design, code, simulate, and build the proximity alarm itself! This is great if you are looking for a quick project to learn about digital electronics.
To sense distance, we will use the Parallax PING))) ultrasonic rangefinder. To sense distance, the rangefinder rapidly sends out ultrasonic sound waves. Each wave will travel outwards, and if there is an object in its path, it will collide and bounce back to the rangefinder. The time it takes for the wave to bounce back determines the distance of that object. The Parallax PING))) can only sense objects from around 2 inches to 10 ft.
The PING))) has onboard ICs (integrated circuits) that do most of the heavy lifting. All we need to do is send the rangefinder a quick 5V pulse from the Arduino and use the pulseIn() function to check the time it took for the wave to bounce back. See the ‘Code’ step for more information on how to code the rangefinder.
To alert the user we will use a piezo buzzer. This device will emit a click sound when a DC voltage is applied. To make a tone, we can use the Arduino tone() function. This will cause the device to emit an annoying sound at that tone. String enough of these tones together and you can create music!
Change the frequency in the simulation below to see how the tone changes:
For more detail: Arduino Proximity Alarm