Introduction: Security Alarm or Parking Sensor

In this Instructables page, I will tell you how to make a security alarm or parking sensor with Arduino. This device can be used as a security alarm or a parking senor because it is a device that will detect how close you are to an object, the led will shine faster if the object gets closer, and there will be an LCD board that will say how close you are with the object. The materials you will need is in the supplies section.


  1. an Arduino Uno or a Leonardo board.
  2. infrared sensor
  3. LCD board
  4. little speaker
  5. some wire

Step 1: Step 1: Connect the Wires to the Right Place

  1. LCD board : Scl to Scl Sda to Sda Vcc to positive on the board Gnd to negative on the board
  2. Sensor: Vcc to positive Gnd to negative Trig to digital pin 9 Echo to digital pin 10
  3. speaker: positive to digital pin 11 negative to gnd
  4. Led: positive to digital pin 13 negative to negative on the board

Step 2: Step 2: Code

code and picture of i#include

const int trigPin = 9;

const int echoPin = 10;

const int buzzer = 11;

const int ledPin = 13;

long duration;

int distance;

LiquidCrystal_I2C lcd_I2C_27(0x27,16,2);

void setup() { lcd_I2C_27.init (); // initialize the lcd lcd_I2C_27.backlight();

pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT);

pinMode(buzzer, OUTPUT); pinMode(ledPin, OUTPUT);



void loop() {

lcd_I2C_27.clear(); lcd_I2C_27.setCursor(0 , 0) ;


digitalWrite(trigPin, LOW);


digitalWrite(trigPin, HIGH);


digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance= duration/40;

if (distance <= 10) { digitalWrite(buzzer, HIGH); digitalWrite(ledPin, HIGH); delay(250); digitalWrite(buzzer, LOW); digitalWrite(ledPin, LOW); } else if(distance <= 25) { digitalWrite(buzzer, HIGH); digitalWrite(ledPin, HIGH); delay(500); digitalWrite(buzzer, LOW); digitalWrite(ledPin, LOW); } else if(distance<= 50) { digitalWrite(buzzer, HIGH); digitalWrite(ledPin, HIGH); delay(1000); digitalWrite(buzzer, LOW); digitalWrite(ledPin, LOW); }

else { digitalWrite(buzzer, LOW); digitalWrite(ledPin, LOW); } lcd_I2C_27.print(distance); delay(500); }

Step 3: Step 3: Test

instruction(connect your board to your computer.....)

Step 4: Step 4: Make the Outer Layer