Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based Motion Detection System with I2C LCD Display and Buzzer Alert

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Motion Detection System with I2C LCD Display and Buzzer Alert

Circuit Documentation

Summary

This circuit involves an Arduino UNO microcontroller interfacing with various components including a 16x2 I2C LCD, a red LED, a green LED, a buzzer, and a vibration sensor (sw-18010p). The circuit is designed to display warnings on the LCD and activate the buzzer and LEDs based on the input from the vibration sensor.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. 16x2 I2C LCD

    • Description: A 16x2 character LCD display with I2C interface.
    • Pins: GND, VCC, SDA, SCL
  3. sw-18010p

    • Description: A vibration sensor.
    • Pins: None
  4. Resistor (330 Ohms)

    • Description: A resistor with a resistance of 330 Ohms.
    • Pins: pin1, pin2
  5. LED: Two Pin (red)

    • Description: A red LED.
    • Pins: cathode, anode
  6. Resistor (330 Ohms)

    • Description: A resistor with a resistance of 330 Ohms.
    • Pins: pin1, pin2
  7. buzzer

    • Description: A buzzer.
    • Pins: PIN, GND
  8. LED: Two Pin (green)

    • Description: A green LED.
    • Pins: cathode, anode

Wiring Details

Arduino UNO

16x2 I2C LCD

sw-18010p

Resistor (330 Ohms)

Resistor (330 Ohms)

LED: Two Pin (red)

LED: Two Pin (green)

buzzer

Code Documentation

int led = 8 ; 
int led1 = 9 ;
int buzzer = 10 ;

// LCD를 사용하기 위해 헤더파일을 추가합니다
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // 16x2 LCD객체를 생성합니다. 이때 확인한 I2C의 주소값을 넣어줍니다

void setup() 
{  
    pinMode(8,OUTPUT) ; //8번핀에 출력함
    pinMode(9,OUTPUT) ; //9번핀에 출력함
    pinMode(10, OUTPUT) ; //10번핀에 출력함
     
     lcd.init();
     lcd.backlight();
} 

void loop()
{ 
    int dec = analogRead(A0); 
    if ( dec < 800 )
    { 
       Serial.println(dec);
       tone(buzzer, 1000) ;
       digitalWrite(9,HIGH); 
       digitalWrite(8,LOW);
        delay(100); 
        lcd.setCursor(0,0); // 0번 행 0번 열부터 출력합니다
        lcd.print("    WARNING    "); // WARNING을 표시함
        delay(1000);
        lcd.clear();
    }
    else
    {  
         Serial.println(dec);
        noTone(buzzer) ;
         digitalWrite(8,HIGH);
         digitalWrite(9,LOW);
        delay(100);
    } 
}

This code initializes the pins for the LEDs and the buzzer, sets up the LCD, and continuously reads the analog input from the vibration sensor. If the sensor value is below a threshold, it activates the buzzer and the red LED, and displays a warning on the LCD. If the sensor value is above the threshold, it deactivates the buzzer and activates the green LED.