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

Arduino Nano IR Remote-Controlled Home Automation System

View and Edit Project In Cirkit DesignerImage of Arduino Nano IR Remote-Controlled Home Automation System

Circuit Documentation

Summary

This circuit is designed to control multiple relays and bulbs using an Arduino Nano and an IR remote control. The IR receiver captures signals from the remote, which the Arduino processes to control the relays. The relays, in turn, control the power to the bulbs. The circuit is powered by a 5V battery and an AC source.

Component List

  1. Arduino Nano

    • Description: A small, complete, and breadboard-friendly board based on the ATmega328P.
    • Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
  2. 1-Channel Relay (5V 10A)

    • Description: A relay module that can control high voltage, high current loads such as motors and lamps.
    • Pins: NC, signal, C, power, NO, ground
  3. 2-Channel Relay (5V 10A)

    • Description: A relay module with two channels, allowing control of two separate loads.
    • Pins: K1-Off, K1-In, K2-On, K2-In, K1-On, K2-Off, VCC, JD-GND, IN2, IN1, GND
  4. IR Receiver

    • Description: A device that receives infrared signals from a remote control.
    • Pins: DATA, VCC, GND
  5. HX1838 Infrared IR Wireless Remote Control

    • Description: A remote control that sends infrared signals to the IR receiver.
    • Pins: FFA25D (1), FF629D (2), FFE21D (3), FF22DD (4), FF02FD (5), FFC23D (6), FFE01F (7), FFA857 (8), FF906F (9), FF9867 (0), FFB04F (#), FF6897 (*), FF18E7 (↑), FF5AA5 (→), FF10EF (←), FF4AB5 (↓), FF38C7 (OK)
  6. Bulb

    • Description: A standard light bulb.
    • Pins: GND, power
  7. AC Source

    • Description: An alternating current power source.
    • Pins: +, -
  8. 5V Battery

    • Description: A battery providing 5V DC power.
    • Pins: +, -

Wiring Details

Arduino Nano

1-Channel Relay (5V 10A)

2-Channel Relay (5V 10A)

IR Receiver

Bulbs

AC Source

5V Battery

Code Documentation

#include <IRremote.h>

int IRpin = 9;
IRrecv IR(IRpin);
decode_results cmd;

int light1 = 2;
int fan1 = 3;
int light2 = 4;
int fan2 = 5;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  IR.enableIRIn();
  pinMode(light1, OUTPUT);
  pinMode(fan1, OUTPUT);
  pinMode(light2, OUTPUT);
  pinMode(fan2, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  while (IR.decode(&cmd) == 0) {
    // Wait for an IR command
  }
  Serial.println(cmd.value, HEX);
  delay(1000);
  IR.resume();

  if (cmd.value == 0xFFA25D) {
    digitalWrite(light1, LOW);
  }
  if (cmd.value == 0xFF629D) {
    digitalWrite(light1, HIGH);
  }

  if (cmd.value == 0xFF22DD) {
    digitalWrite(fan1, LOW);
  }
  if (cmd.value == 0xFF02FD) {
    digitalWrite(fan1, HIGH);
  }

  if (cmd.value == 0xFFE01F) {
    digitalWrite(light2, LOW);
  }
  if (cmd.value == 0xFFA857) {
    digitalWrite(light2, HIGH);
  }

  if (cmd.value == 0xFF6897) {
    digitalWrite(fan2, LOW);
  }
  if (cmd.value == 0xFF9867) {
    digitalWrite(fan2, HIGH);
  }
}

This code initializes the IR receiver and sets up the pins for the relays controlling the lights and fans. The loop function continuously checks for IR commands and toggles the corresponding relays based on the received command.