कला
सुन्दरता र कल्याण
हस्तकला
संस्कृति र इतिहास
मनोरञ्जन
वातावरण
खाना र पेय
रिभर्स इन्जिनियरिङ
विज्ञान
खेलकुद
प्रविधि
पहिर्न मिल्ने
Building an Ultrasonic Parking Sensor
Ed

सिर्जनाकर्ता

Ed

13. जुलाई 2026FI
५६
०
०
०
०

Building an Ultrasonic Parking Sensor

Measure distance with sound. An HC-SR04 ultrasonic sensor sends out a pulse of sound and times its echo, and the Arduino turns that into a distance in centimetres. Wire it to a buzzer that beeps faster as something gets closer — a car parking sensor, a reversing aid, or a doorway proximity alarm.

शुरुआती
1 hour

निर्देशनहरू

1

Wire the sensor and buzzer

Push the HC-SR04 and the active buzzer into the breadboard. Wire the sensor: VCC to Arduino 5V, GND to GND, Trig to pin 9, Echo to pin 10. Wire the buzzer: + to pin 8, - to GND.

यस चरणका सामग्री:

Arduino Uno R3Arduino Uno R31 टुक्रा
HC-SR04 Ultrasonic Distance Sensor (5-Pack)HC-SR04 Ultrasonic Distance Sensor (5-Pack)1 टुक्रा
सक्रिय बजर मोड्युलसक्रिय बजर मोड्युल1 टुक्रा
ब्रेडबोर्डब्रेडबोर्ड1 टुक्रा
जम्पर तारजम्पर तार1 प्याक
2

Connect and open the IDE

Plug the Arduino into your computer with the USB cable, open the Arduino IDE, and select Arduino Uno and its serial port.

चाहिने औजार:

Arduino IDE भएको कम्प्युटरArduino IDE भएको कम्प्युटर
USB-B केबलUSB-B केबल
3

Upload the parking-sensor sketch

Paste this sketch and upload. It measures the distance and beeps faster the closer an object is. Open the Serial Monitor to see the distance in centimetres.

ultrasonic_parking_sensor.inoarduino
// Ultrasonic parking sensor: the buzzer beeps faster as an object gets closer.
// HC-SR04 Trig on pin 9, Echo on pin 10; active buzzer on pin 8.

const int TRIG_PIN = 9;
const int ECHO_PIN = 10;
const int BUZZER_PIN = 8;

void setup() {
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // send a short trigger pulse
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  // time the echo and convert to centimetres (speed of sound ~343 m/s)
  long duration = pulseIn(ECHO_PIN, HIGH);
  int distance = duration * 0.0343 / 2;

  Serial.print(distance);
  Serial.println(" cm");

  if (distance > 0 && distance < 50) {
    int gap = distance * 6;          // closer = shorter gap between beeps
    digitalWrite(BUZZER_PIN, HIGH);
    delay(30);
    digitalWrite(BUZZER_PIN, LOW);
    delay(gap);
  } else {
    digitalWrite(BUZZER_PIN, LOW);   // nothing close -> silent
    delay(60);
  }
}
4

Test and set the range

Move your hand toward the sensor — the buzzer beeps faster as you get closer and nearly solid when very near. Change the 50 in the sketch to set how far away it starts reacting, and the * 6 to change how quickly the beeping speeds up.

5

Mount it

Fix the sensor facing outward on a bracket or in a small box and power the Arduino from a USB power bank or a 9 V adapter. Aim it at your parking spot, garage wall or doorway.

सामग्री

5
  • 1 टुक्रा
    1 vendor sell this, none ship to you yet
    प्लेसहोल्डर
  • Ultrasonic Sensor - HC-SR0410% कमिसन
    1 टुक्रा
    $4.23
  • प्लेसहोल्डर
  • 1 टुक्रा
    1 vendor sell this, none ship to you yet
    प्लेसहोल्डर
  • 1 प्याक
    3 vendors sell this, none ship to you yet
    प्लेसहोल्डर

आवश्यक उपकरणहरू

3
  • प्लेसहोल्डर
  • 1 vendor sell this, none ship to you yet
    प्लेसहोल्डर
  • 1 vendor sell this, none ship to you yet
    प्लेसहोल्डर
अनुमानित जम्मा
बनाउनेले किनेको कुरा। मूल्य नदेखिएका सामग्री तपाईंले जहाँबाट किन्नुहुन्छ त्यहीँबाट पाइन्छ।
$4.23

सम्बन्धित ब्लुप्रिन्ट

यी ब्लुप्रिन्टहरूले ज्ञान साझा गर्छन् — प्रविधि, सामग्री वा सिद्धान्त

CC0 सार्वजनिक डोमेन

यो ब्लुप्रिन्ट CC0 अन्तर्गत जारी गरिएको छ। तपाईं अनुमति नसोधी प्रतिलिपि, परिमार्जन, वितरण र प्रयोग गर्न सक्नुहुन्छ।

ब्लुप्रिन्ट मार्फत उत्पादनहरू किनेर सिर्जनाकर्तालाई सहयोग गर्नुहोस् सिर्जनाकर्ता कमिसन विक्रेताले तोकेको, वा यो ब्लुप्रिन्टको नयाँ संस्करण बनाउनुहोस् र आम्दानी बाँड्न आफ्नो ब्लुप्रिन्टमा जडानको रूपमा समावेश गर्नुहोस्।

छलफल

(0)

लग इन छलफलमा सामेल हुन

टिप्पणीहरू लोड गर्दै...