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

Arduino Leonardo Vibration-Detected Alert System with Piezo Buzzer

View and Edit Project In Cirkit DesignerImage of Arduino Leonardo Vibration-Detected Alert System with Piezo Buzzer

Circuit Documentation

Summary

This circuit is designed to detect vibrations using the SW-420 Vibration Sensor and alert through a Piezo Buzzer. The Arduino Leonardo (Rev3b) serves as the central processing unit, reading the sensor's output and controlling the buzzer accordingly. When the vibration sensor detects movement, the Arduino activates the buzzer to emit a sound.

Component List

Arduino Leonardo (Rev3b)

Piezo Buzzer

SW-420 Vibration Sensor

Wiring Details

Arduino Leonardo (Rev3b)

Piezo Buzzer

SW-420 Vibration Sensor

Documented Code

// Define the pins for the piezo buzzer and the vibration sensor
int piezoPin = 5;      // Pin for the piezo buzzer
int switchPin = 10;    // Pin for the SW-420 switch

void setup() {
    pinMode(piezoPin, OUTPUT);   // Set piezo pin as output
    pinMode(switchPin, INPUT);   // Set switch pin as input
}

void loop() {
    // Read the state of the switch
    int switchState = digitalRead(switchPin);
    
    // If the switch is moved (assuming HIGH when moved)
    if (switchState == HIGH) {
        digitalWrite(piezoPin, HIGH); // Turn on the buzzer
    } else {
        digitalWrite(piezoPin, LOW);  // Turn off the buzzer
    }
}

Filename: sketch.ino

Description: This Arduino sketch is written to control a Piezo Buzzer based on the input from a SW-420 Vibration Sensor. The setup() function initializes the buzzer and sensor pins. The loop() function continuously checks the state of the vibration sensor and turns the buzzer on or off accordingly.