กลับไปหน้ารวมไฟล์
proximity_alarm-d851b9-en.md

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.

INTRODUCTION

PROXIMITY_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.

HOW TO MAKE ?

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 CODE

After 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!

WORKING

It 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 !

EXPANDED TECHNICAL DETAILS

Hardware Components & Configuration

The system relies on the HC-SR04 Ultrasonic Sensor, which operates on the principle of echo-location. It emits a 40kHz sonic pulse and measures the time it takes for the pulse to bounce back from an object.

  • Trigger Pin: Receives a 10µs pulse to start the measurement.
  • Echo Pin: Outputs a pulse whose duration is proportional to the distance.
  • Buzzer & LED: Connected to digital output pins to provide audible and visual feedback.

Firmware Logic

The Arduino code calculates the distance using the formula: Distance (cm) = (Time * 0.034) / 2. To create the "Radar" effect:

  1. The script continuously loops to check the distance.
  2. It uses an if-else or map() logic to adjust the delay() between beeps.
  3. As the distance decreases, the delay becomes shorter, causing the "increasingly faster beeping" characteristic of proximity alarms used in automotive reverse-parking sensors or industrial safety zones.

Deployment Tips

Using a recycled plastic bottle as a chassis is an excellent example of low-cost prototyping. Ensure the HC-SR04 sensors are mounted parallel to each other and perpendicular to the detection plane for the most accurate readings. Wrapping the connections in electrical tape provides basic insulation without the need for a soldering station.

ข้อมูล Frontmatter ดั้งเดิม

title: "PROXIMITY_ALARM"
description: "Proximity Alarm with increasingly faster beeping like 'SONAR Radar'."
author: "PIYUSH_K_SINGH"
category: ""
tags:
  - "radar"
  - "proximity"
  - "alarm"
views: 3339
likes: 0
price: 299
difficulty: "Easy"
components:
  - "1x Buzzer"
  - "1x Jumper wires (generic)"
  - "1x Ultrasonic Sensor - HC-SR04 (Generic)"
  - "1x 9V DC Battery Connector"
  - "1x Arduino UNO"
  - "1x 9V DC Battery"
  - "1x LED (generic)"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "f3b1108f9bc14da5d9bdbc090ac8b56fba012cac54ba13a09b2ed79b617b8fc2"
encryptedPayload: "U2FsdGVkX19BsmiDMwOnhpcBASC8ZDxEyEVoD8FSWlUcGYzdexuXgEFzNzojaOW11z9sQO9tnuc+zPTz6LEk4q1eFOJ59Oxy4Tc6jiOFDi4="
seoDescription: "Build an Arduino Proximity Alarm with SONAR Radar style beeping that speeds up as objects get closer."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/proximity_alarm-d851b9_cover.jpg"
lang: "en"