Introduction: Sonar Proximity Alarm
This Instructable will explain how to create a proximity sensor/alarm using an ultrasonic emitter/receiver and LEDs.
Step 1: Connect Ultrasonic Emitter/Receiver
1. Select the Ultrasonic Emitter/Receiver and connect it to the breadboard.
2. Connect a Jumper Wire to the GND pin on the Ultrasonic sensor and to the grounded rail (-) on the breadboard.
3. Connect a Jumper Wire to the VCC pin on the Ultrasonic sensor and to the positive rail (+) on the breadboard.
4. Connect a Jumper Wire from the grounded rail to the GND (ground) Pin on the Arduino.
5. Connect a Jumper Wire from the positive rail to the 5v Pin on the Arduino.
6. Connect a Jumper Wire to the Trig pin on the Ultrasonic sensor and to pin 12 on the Arduino
7. Connect a Jumper Wire to the Echo pin on the Ultrasonic sensor and to pin 11 on the Arduino
Step 2: Add an LED
1. Place an LED (any color) into the breadboard
2. Connect one end of 220 Ω (ohm) resistor to the top lead (+), should be the longer lead, and the other end into Pin 3 on your Arduino Board.
3. Connect a Jumper Wire to the bottom lead (-) and to the grounded rail on the breadboard.
4. Connect a Jumper Wire from the grounded rail to the GND (ground) Pin on the Arduino.
Step 3: LED Errors
Step 4: Add a Yellow LED
The green LED has the same setup as our green LED.
1. Connect the led to the breadboard.
2. Connect a 220Ω resistor to the positive(+) lead of the LED and to a Pin 5 on the Arduino.
3. Connect the negative lead to the ground rail.
Step 5: Add a Red LED
The red LED has the same setup as our yellow and green LEDs.
1. Connect the led to the breadboard.
2. Connect a 220Ω resistor to the positive(+) lead of the LED and to Pin 6 on the Arduino.
3. Connect the negative lead to the ground rail.
Step 6: Code for Sonar Proximity Alarm
Attached is SonarAlarm.ino which contains all of the code for running the Sonar Proximity Alarm project on an Arduino Uno.