IOT

🔑 Arduino Password System with Buzzer Alert

A simple Arduino project that checks a password via Serial Monitor and alerts with a buzzer if incorrect.


📌 Code

int buzzerPin = 10;
String password = "1234";
String inputPassword = "";

void setup() {
  pinMode(buzzerPin, OUTPUT);
  Serial.begin(9600);
  Serial.println("Enter password:");
}

void loop() {
  if (Serial.available()) {
    inputPassword = Serial.readStringUntil('\n');
    inputPassword.trim();

    if (inputPassword == password) {
      Serial.println("Access Granted");
    } else {
      Serial.println("Wrong Password!");
      wrongPasswordBeep();
    }
  }
}

void wrongPasswordBeep() {
  for (int i = 0; i < 3; i++) {
    digitalWrite(buzzerPin, HIGH);
    delay(200);
    digitalWrite(buzzerPin, LOW);
    delay(200);
  }
}

📖 Explanation

1. Variable Setup

  • buzzerPin → Pin number where the buzzer is connected.
  • password → The fixed correct password ("1234").
  • inputPassword → Stores user input from Serial Monitor.

2. setup() Function

  • Configures buzzer pin as output.
  • Starts serial communication at 9600 baud.
  • Prompts user to enter a password.

3. loop() Function

  • Checks if user typed something in Serial Monitor.
  • Reads input until newline (\n).
  • Compares entered password with correct one:
    • If correct → prints "Access Granted".
    • If wrong → prints "Wrong Password!" and calls buzzer function.

4. wrongPasswordBeep() Function

  • Makes buzzer beep 3 times when password is incorrect.
  • Each beep lasts 200 ms followed by 200 ms silence.

⚙️ Summary

This project is a simple password-protected system using Arduino:

  • User enters a password via Serial Monitor.
  • If correct → Access granted.
  • If wrong → Buzzer beeps 3 times as an alert.

💡 Great for beginners learning Arduino input/output and security basics!

Comments

Best AI Image Generators 2025

Discover the most powerful AI tools for creating stunning visuals, artwork, and designs

Most Popular

Midjourney V6

Create artistic and surreal images with unparalleled quality and style control

4.7/5
  • Advanced style control
  • High-resolution output
  • Community gallery
  • Regular updates

DALL-E 3

Generate realistic image compositions with advanced understanding of context and details

4.8/5
  • Photorealistic images
  • Context understanding
  • Safe for work
  • API access
Open Source

Stable Diffusion XL

Open-source AI model with extensive customization options and local deployment

4.2/5
  • Completely free
  • Local installation
  • Custom models
  • Community support
Commercial

Adobe Firefly

Professional AI tool integrated with Adobe Creative Cloud for commercial use

4.6/5
  • Commercial license
  • Adobe integration
  • Brand-safe content
  • Professional workflow

Runway ML Gen-2

Advanced video and image generation with state-of-the-art AI models

4.3/5
  • Video generation
  • Real-time editing
  • Multiple styles
  • Team collaboration