Introduction: Computer Controlled Home Lighting System

About: Hyperrobotix provides Robotics and Electronics solutions online.

The main aim of this project is to demonstrate the control of home lights (220 V AC) with the help of computer program. The foundation provided by this project can easily be extended to build more complex systems which would allow controlling more devices easily. This instructable illustrates on interfacing various components and the software used to build the system.

More complete information regarding this project and report, please visit :--

http://www.hyperrobotix.com/category-blog/144-comp...

Step 1: Gather the Components

The main components required to build the project are: ---

· Arduino Uno Microcontroller Board

· Relay Board

· Power Supply

· Transformer

· Bulb Holder

· AC Plug with wire.

Step 2: Connect the AC Mains...

Connect the AC mains wire to the transformer as shown.

Step 3: Connect One of the Joint ...

Connect one of the joint to the bulb holder connector.

Another joint would be connected to relay board shown later.

Step 4: ​Connect the Other Bulb Holder Connector...

Connect the other bulb holder connector port to the relay board.

Step 5: Connect the Other Joint...

Connect the other joint (one of the joint shown in step 2) to relay board. This completes the connection of relay board to the bulb holder.

Step 6: Connect the Output Wire...

Connect the output wire from transformer to power supply.This will serve as input to the power supply.

Step 7: ​Connect the Output From the Power Supply Board ...

Connect the output from the power supply board (12v & 0v) to the input of relay board. Also connect GND of power supply to Arduino GND.

Step 8: Connect Input Pin of Relay Board...

Connect input pin of relay board to pin 13 of Arduino.

Step 9: Connect the Bulb

Connect the bulb to the holder.

Step 10: Compile the Code

Compile and following code and upload to Arduino: ---

String s="";

char c;

void setup()

{

// start serial port at 9600 bps:

Serial.begin(9600);

pinMode(13, OUTPUT);

establishContact(); // send a byte to establish contact until receiver responds

}

void loop()

{

// if we get a valid byte, read analog ins:

if (Serial.available() > 0) {

// get incoming byte:

c = (char) Serial.read();

if (c == '\n') {

if(s=="LightOn") {

digitalWrite(13,HIGH);

Serial.print("Lights Turned On");

}

if(s=="LightOff") {

digitalWrite(13,LOW);

Serial.print("Lights Turned Off");

}

s="";

} else {

s=s+c;

}

}

}

void establishContact() {

while (Serial.available() <= 0) {

Serial.print('A'); // send a capital A

delay(300);

}

}

Step 11: Select the Correct Commmunication Port

Make sure the correct com port (the port assigned to Arduino) is selected. Open serial monitor provided with Arduino IDE.

Step 12: Send Command

Send “LightOn”. This will turn light on. Send “LightOff” to turn light off.