Tekko BDSimSimulatorProjects

হোম অটোমেশন: ব্লুটুথে ৪টা বাতি (রিলে মডিউল)Home Automation using Arduino: 4 Lamps over Bluetooth & Relays

ফোন থেকে Bluetooth এ ১, ২, ৩ বা ৪ পাঠালে Arduino সেই রিলে টগল করে। এই রিলে বোর্ডগুলো active LOW — LOW দিলে চালু হয় — প্রথমবার সবাই এটাতেই আটকায়।

The phone sends 1, 2, 3 or 4 over Bluetooth; the Arduino toggles that relay. These relay boards are active LOW — a LOW output closes the contact — which is the one thing that surprises everyone the first time.

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

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

Home Automation using Arduino: 4 Lamps over Bluetooth & Relays circuit diagram — Arduino Uno, Bluetooth module (HC-05), Relay module (4 channel), Light bulb, Jumper wires

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

তার লাগানো · Wiring

Bluetooth module (HC-05) VCC→Arduino Uno 5V
Bluetooth module (HC-05) GND→Arduino Uno GND
Bluetooth module (HC-05) TXD→Arduino Uno D10
Bluetooth module (HC-05) RXD→Arduino Uno D11
Relay module (4 channel) VCC→Arduino Uno 5V
Relay module (4 channel) GND→Arduino Uno GND
Relay module (4 channel) IN1→Arduino Uno D2
Relay module (4 channel) IN2→Arduino Uno D3
Relay module (4 channel) IN3→Arduino Uno D4
Relay module (4 channel) IN4→Arduino Uno D5
Relay module (4 channel) COM1→Arduino Uno 5V
Relay module (4 channel) NO1→Light bulb a
Light bulb b→Arduino Uno GND.3
Relay module (4 channel) COM2→Arduino Uno 5V
Relay module (4 channel) NO2→Light bulb a
Light bulb b→Arduino Uno GND.3
Relay module (4 channel) COM3→Arduino Uno 5V
Relay module (4 channel) NO3→Light bulb a
Light bulb b→Arduino Uno GND.3
Relay module (4 channel) COM4→Arduino Uno 5V
Relay module (4 channel) NO4→Light bulb a
Light bulb b→Arduino Uno GND.3

Code (Arduino C++)

#include <SoftwareSerial.h>
// Home automation: a 4-channel relay board switches four lamps.
// These relay boards are ACTIVE LOW: digitalWrite(pin, LOW) turns the relay ON.
// From your phone (Bluetooth terminal, paired with HC-05) send 1 2 3 4 to toggle a lamp.
SoftwareSerial bt(10, 11);
const int lamp[4] = {2, 3, 4, 5};
bool on[4] = {false, false, false, false};

void setup() {
  for (int i = 0; i < 4; i++) { pinMode(lamp[i], OUTPUT); digitalWrite(lamp[i], HIGH); }
  bt.begin(9600);
  bt.println("Send 1 2 3 4 to toggle lamps");
  Serial.begin(9600);
}

void loop() {
  if (!bt.available()) return;
  char c = bt.read();
  if (c >= '1' && c <= '4') {
    int i = c - '1';
    on[i] = !on[i];
    digitalWrite(lamp[i], on[i] ? LOW : HIGH);   // LOW = relay closed = lamp on
    bt.print("Lamp "); bt.print(i + 1); bt.println(on[i] ? " ON" : " OFF");
    Serial.print("Lamp "); Serial.print(i + 1); Serial.println(on[i] ? " ON" : " OFF");
  }
}

আরো project · More projects