Tekko BDSimSimulatorProjects

সিঁড়ির বাতি নিজে নিজে বন্ধ হয় — PIR সেন্সর দিয়েStair Light That Switches Itself Off

PIR মডিউল শরীরের তাপ নড়াচড়া ধরলে OUT পিন HIGH হয়ে যায়। বাতি ৬ সেকেন্ড জ্বলে থাকে — নতুন নড়াচড়া পাওয়া মাত্র সময় আবার নতুন করে গোনা হয়, তাই মাঝ সিঁড়িতে অন্ধকার হয় না।

The PIR module notices body heat moving and its OUT pin jumps HIGH. The lamp follows with a 6-second holdover — every new movement restarts the timer, so it never dies mid-step.

▶ ফ্রি চালিয়ে দেখো / Run it free Parts অর্ডার করো (WhatsApp)

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

Stair Light That Switches Itself Off circuit diagram — Arduino Uno R3, PIR motion sensor (HC-SR501), Relay module (5V, 1 channel), Light bulb, Jumper wires

যা যা লাগবে · Parts you need

তার লাগানো · Wiring

PIR motion sensor (HC-SR501) VCC→Arduino Uno R3 5V
PIR motion sensor (HC-SR501) GND→Arduino Uno R3 GND
PIR motion sensor (HC-SR501) OUT→Arduino Uno R3 D2
Relay module (5V, 1 channel) VCC→Arduino Uno R3 5V
Relay module (5V, 1 channel) GND→Arduino Uno R3 GND
Relay module (5V, 1 channel) IN→Arduino Uno R3 D7
Relay module (5V, 1 channel) COM→Arduino Uno R3 5V
Relay module (5V, 1 channel) NO→Light bulb a
Light bulb b→Arduino Uno R3 GND.3

Code (Arduino C++)

// Stair light: a PIR module notices body heat moving and its OUT pin jumps
// HIGH. The lamp follows with a 6-second holdover, so it never dies mid-step
// — every new movement restarts the timer. This is the hallway light in
// every office tower: nobody touches a switch, and the bill drops anyway.
void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT);
  pinMode(7, OUTPUT);
}

void loop() {
  static long lastMotion = -10000;
  if (digitalRead(2) == HIGH) lastMotion = millis();
  bool lamp = millis() - lastMotion < 6000;
  digitalWrite(7, lamp ? HIGH : LOW);
  Serial.print("Motion: "); Serial.print(digitalRead(2) == HIGH ? 1 : 0);
  Serial.print(" | Lamp: "); Serial.println(lamp ? "ON" : "OFF");
  delay(200);
}

আরো project · More projects