# How to Make a Cheap Home Automation System

19,859

296

32

Well Automated Home are a dream to every DIY er, But they Cost much
So here is a solution to make a low budget Automated system

======================================================

Cost of building the project:

• Relay module (0.32\$)
• transistor bc548 (0.016\$)
• perfboard (0.16\$)
• screw terminal (0.08\$)
• arduino or arduino compatible device(12\$)

Total : For two switch it will be 13\$ max

======================================================
So Lets make it :)

Also like my page for support

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Circuit Diagram

The working is very simple and is divided into 3 part

1. Arduino
2. IR Communication/IR data reception
3. Relay module

=================================================

The Arduino will be covered at the last part of this Instructable

We will start the relay module

Relay Module

A relay is a electromechanical switch.
It has 5 pin

• Cmn-Common Terminal
• C1-Coil 1
• C2- Coil 2
• NC- Normally Connected
• NO - Normally Open

C1 will be connected to the 6v via transistor bc548

C2 to ground

Cmn will be the Line input

and lastly NO will be at output

=================================================

The relay module cost much so i made the custom relay module
you can use a ready made relay module.my relay operate at a voltage of 6v
so i had operate those with a transistor.

The transistor acts as a switch when a HIGH is send to the base connecting the 6V power circuit to the relay module.

We are using relay to provide a connection between 220v and arduino without any direct electrical connection of the both the system.

## Step 2: IR Communication

IR communication has been made so easy thanks to Ken Shirriff

https://github.com/shirriff/Arduino-IRremote

************************************************************************

Note: Vs is the data out for which is to be connected to pin 11

************************************************************************

Steps to install the library

1. Close the Arduino ide
2. Open the Arduino folder
3. Locate libraries
4. Extract the files as a folder named IRremote
5. Open Arduino ide

The library has installed

Now to get an idea of how remote works

Try the example of IRrecvDemo in the ir library

Note: Erase the Hex in parameter in the program

After uploading the sketch u can see the the data in for the switch u press on the remote

press the switch and get the value for u button note it :

For my case

1 is 33444015

2 is 33478695

now since u have the value its time to code

## Step 3: Coding Time

The code is given in the attachment
Change it as per requirement

=======================================================

Connection are as follow

• vs of ir receiver to pin 11
• relay coil pin to 8
• vc to 5v of arduino
• gnd to gnd of arduino

----------------------------------------------------------------------------------------------------

========================================================

/*
Author :Prajjwal Nag

*/

#include

int RECV_PIN = 11;// data reception pin

int relaypin=8;// To relay 1

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {

Serial.begin(9600);

pinMode(relaypin,OUTPUT);

}

void loop()

{

if (irrecv.decode(&results))

{

switch(results.value)

{

case 33444015:// for 1 button on remote

digitalWrite(relaypin,HIGH);

break;

case 33478695:// for 2 button on remote

digitalWrite(relaypin,LOW);

break; }

irrecv.resume(); // Receive the next value

} }

==================================================

## Step 4: Working

Here is the working video of the model

I Hope You guys Enjoy
And Feel free to ask Anything if seem to be complicated

Participated in the
Home Automation

Participated in the
Bedroom Contest

## Recommendations

• ### Internet of Things Class

22,792 Enrolled

## 32 Discussions

Great tutorial. I appreciate the time and effort it took to create this tutorial!

I do not see the remote/transmitter in the parts list.

Do I just pick any remote, and use the data in test shown above?

Thank you.

What is the brown board with holes in it called?

can u please direct me this same for controller 89c51 instead of arduino.
with circuit diagram and program.
it would be a great thanx.............
plzzzzzzzzz

AhmedA27 The diode returns current back to the supply when a magnetic field collapses, and generates a current spike. Without the protection diode the current goes backwards in the circuit, and reverse biases everything it flows through.

First thank you for the first reply and second what is current spike I search it on google and I didn't find it useful third when the current goes backwards to the circuit what is bad thing can happen because I will make this circuit without the diode to see what's gone to happen

current spike are unwanted instantaneous current that occur when the switch is turned off
if u don't use diode nothing will happen but slowly it will damage your transistor and then microcontroller

BC548 is supposed to be NPN right? the transistor used in ckt diagram is PNP. What am I supposed to use? please help

BC548 is NPN only .
I made a slight mistake which changed the transistor in schematics .
now do u need any thing else

I have a question why you put the diode
Thanks

You're not a big believer in back EMF with the lack of a protection diode across the relay coil I see.

4 replies

this module is built to handle dc
should i have also include a extra diode bcz my line is already having filter circuit ?

Actually, pfred2 is right. If you don't add that protection diode, either your transistor won't survive or your arduino can get damaged.

One more thing. NC terminal on relay means normally open which means that it is connected to the pole terminal when the coil is not getting a supply. NO means normally open which gets connected to pole when the coil gets a supply. You really need to correct that.

saiyam i have use a different terminology here but the meaning is same .
and about relay do i need diode if the line are ready in dc ??

A protection diode is not a rectifier. A protection diode returns current back to the supply when a magnetic field collapses, and generates a current spike. Without the protection diode the current goes backwards in the circuit, and reverse biases everything it flows through. You can do a web search to learn more about what a protection diode is, and how it is used in a circuit.

But for a brief description you put a protection diode reverse to current flow across an inductor. Go look it up, to see what that means.