Arduino, Sensor

Arduino Based Security Alarm

Arduino Based Security Alarm টিউটোরিয়ালে আপনাকে স্বাগতম। এই ডিভাইসটির মাধ্যমে আমরা রাতে আমাদের বাড়ির নিরপত্তা ব্যবস্থা আরো বাড়াতে পারি। এটি কোনো বস্তুর চলাচল ডিটেক্ট করতে পারে এবং তা এলার্মের মাধ্যমে জানিয়ে দেয়।

কম্পোনেন্ট লিস্ট

প্রজেক্টগুলোতে যে সকল ইলেক্ট্রনিক্স কম্পোনেন্ট ব্যবহার করা হয়েছে,

  • Arduino UNO
  • Motion sensor
  • Buzzer
  • Led
  • Bread board
  • Switch
  • Resistor
  •  

সার্কিট ডায়াগ্রাম

প্রজেক্ট স্টেপ

->  Arduino এর  +5V--------- Breadboard

->  Arduino এর যেকোন GND--------- Breadboard 

-> LED ছোট প্রান্ত----- Breadboard এর GND

-> LED  বড় প্রান্ত ----- 220 বা 330 ohm Resistor ----- Arduino D6 Pin

-> Buzzer এর পজিটিভ প্রান্ত------- Arduino D5 Pin

-> Buzzer নেগেটিভ প্রান্ত------Breadboard এর GND

-> Push Button 3(চিত্রে)---- Arduino D12 Pin

-> Push Button 4(চিত্রে)---- 1k ohm----GND

-> Push Button 2(চিত্রে)----+5v (Breadboard)

-> PIR Module Positive  Pin(Vcc) ---- +5v (Breadboard)

-> PIR Module Negative Pin( GND) ---- GND (Breadboard)

-> PIR Module Sensor Pin(OUT) ---- Arduino D7

কোড

নিচের কোডটি কপি করে Arduino Uno তে লোড করুন

//this project is made by BEASTIDREES62 https://id.arduino.cc/?code=MTxqeHweG6vL2cur&state=amxEcTB2bnNiYjluTUxmRExWaWZnOXIzUk1BLWRqZTZYUGtJNGtxODB%2Bdg%3D%3D
// Declaring Pins
const int buzzerPin = 5;
const int ledPin = 6;
const int motionPin = 7;
const int buttonPin = 12;

// Setting Buzzer mode to False
boolean buzzer_mode = false;

// For LED
int ledState = LOW;
long previousMillis = 0; 
long interval = 100;  // Interval at which LED blinks

void setup()
{
  //The Following are our output
  pinMode(ledPin,OUTPUT);
  pinMode(buzzerPin,OUTPUT);

  //Button is our Input
  pinMode(buttonPin, INPUT);
  
  // Wait before starting the alarm
  delay(5000);
}

void loop()
{
  // To chech whether the motion is detected or not
  if (digitalRead(motionPin)) {
    buzzer_mode = true; 
  }

  // If alarm mode is on,blink our LED
  if (buzzer_mode){
    unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval) {
      previousMillis = currentMillis;   
      if (ledState == LOW)
        ledState = HIGH;
      else
        ledState = LOW;
    // Switch the LED
    digitalWrite(ledPin, ledState);
    }
    tone(buzzerPin,1000);
  }

  // If alarm is off
  if (buzzer_mode == false) {
  
    // No tone & LED off
    noTone(buzzerPin);  
    digitalWrite(ledPin, LOW);
  }

  // If our button is pressed Switch off ringing and Setup
  int button_state = digitalRead(buttonPin);
  if (button_state) {buzzer_mode = false;}
}

কাজ শেষ। প্রজেক্ট সম্পন্ন করার পর  কোন মন্তব্য / সাজেশান থাকলে অবশ্যই আমাদের জানাবেন। ধন্যবাদ। 

Leave a Reply