Ultrasonic sensor HC-SR04 is one of the most easiest and helpful of all sensors. Various codes for this sensor are available online and beginners can use these codes, manipulate and modify them according to their project requirements.
INTRODUCTIONPROXIMITY_ALARM is my first Arduino project. It quite easy to make and can be used in a wide variety of applications including home security, obstacle avoiding robots,distance measurements etc.
For this project I have used Arduino Uno, but it can easily work with almost any Arduino board with slight modifications. Apart from this I have also used a piezoelectric buzzer to produce sound, some jumper wires, a LED for indication and a 9V DC battery for power.
One of the great advantage of this project is that it is cost effective. If you have Arduino and sensors, you don't have to spend money on anything. For project's main body, I have used an old plastic bottle and cut it according to my requirements, which both 'environment friendly' and 'innovative' - two ideas that will definitely fetch you good points in any developing competition, if you made such a project.
Use the circuit diagram to make connections. Attach Arduino, piezoelectric buzzer to the bottle with nut-bolts. Make holes for adding Ultrasonic sensor and LED. Use electric tape to join wires (no soldering required!).
THE CODEAfter making connections, upload the code (given below).
Just copy paste the code to your Arduino IDE and upload the code to Arduino Uno. The code does not uses any external libraries, so you don't have to download any thing!
WORKINGIt works on principle of SONAR. As the object approaches near the sensor, the rate of beeping from buzzer increases, acting like a Radar. Also every time you power the Arduino, a tone is played, thus giving the feel of a cool starting music !
If you have any queries or suggestions, please write them in the comment section below.
Comments