Introduction: How to Make a Cheap Home Automation System

Picture of How to Make a Cheap Home Automation System

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

Step 1: Circuit Diagram

Picture of 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 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

Picture of IR Communication

IR communication has been made so easy thanks to Ken Shirriff

Download the library for the ir module or sensor.


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




int RECV_PIN = 11;// data reception pin

int relaypin=8;// To relay 1

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {


irrecv.enableIRIn(); // Start the receiver



void loop()


if (irrecv.decode(&results))




case 33444015:// for 1 button on remote



case 33478695:// for 2 button on remote


break; }

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

} }


Step 4: Working

Picture of 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


PaulWheeler (author)2016-07-12

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.

pasaal (author)2016-06-13

What is the brown board with holes in it called?

Hearto (author)pasaal2016-06-23


Zeeshan_Saiyed (author)2015-07-16

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

Samiran (author)Zeeshan_Saiyed2015-08-26

Not an issue. The circuit will 100% work for your 89S52 or 89C51. The code will be as you like.

Zeeshan_Saiyed (author)2015-08-09

can u please help me pious

AhmedA27 (author)2015-07-03

I have a question why you put the diode

geekrex (author)AhmedA272015-07-03

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.

AhmedA27 (author)geekrex2015-07-04

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

geekrex (author)AhmedA272015-07-04

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

AhmedA27 (author)geekrex2015-07-04

thanks a lot pious123

geekrex (author)2015-07-03

wat is the problem ??

sainathyarra (author)2015-07-03

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

geekrex (author)sainathyarra2015-07-03

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

AhmedA27 (author)2015-07-03

I have a question why you put the diode

pfred2 (author)2015-06-20

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

geekrex (author)pfred22015-06-20

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

Saiyam (author)geekrex2015-06-21

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.

geekrex (author)Saiyam2015-06-21

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 ??

pfred2 (author)geekrex2015-06-21

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.

geekrex (author)pfred22015-06-22

i already did the update is it ok now ?

pfred2 (author)geekrex2015-06-22

You need to return current to your power supply. Examine this schematic to see two schemes for protecting your circuit.

Your best bet is to use the left hand method, and move your relay before your transistor in your circuit. The way you have it now your back EMF is going through your whole circuit.

geekrex (author)pfred22015-06-22

Thank you pfred i did it :)

pfred2 (author)geekrex2015-06-22

Here, I doctored up your schematic a little

pfred2 (author)pfred22015-06-22

Whoops, take out the short on the left hand relay. I did the edit too fast in an image editor.

PedroP8 (author)2015-06-20

Just a light correction to the terminology: On a relay, N.O. stands for Normally Open; N.C. stands for Normally Closed; and they reflect the regular status of the relay
If no power is being applied to the coil, the N.C. is connected to the common pin (thus, this pin is normally closed or connected to common)
If power is being applied to the coil, the N.O. is connected to the common pin and disconnected from the N.C. (thus, this pin is normally open or disconnected to the common).

I would also try to buy relays that have built-in free rolling diodes. It will help to the life of the controller against voltage spikes when the coil is de-energized
Great post pious123

geekrex (author)PedroP82015-06-20

I saw a little different terminology
whatever the connection is same as yours
Thanks for the knowledge

braytonlarson (author)geekrex2015-06-21

The NO and NC. Are pretty crucial to get right. Make sure you use "Normal open" and "Normally Closed" in the future That way people don't get confused and blow their circuit. Nice instructable otherwise though!

geekrex (author)braytonlarson2015-06-22

Okk I will update it soon :)

kavish laxkar (author)2015-06-21

in ur programme ....the receiver pin and relay pin does not match ur schematic.
i did the same changes but still not help.

geekrex (author)kavish laxkar2015-06-21

what are the changes you did ??

geekrex (author)2015-06-20

yes there is ready made circuit available but my hand made cost less than 2$

About This Instructable




Bio: So basically i am a crazy person, who loves to think the most odd way ever possible,who makes what he thinks and also let ... More »
More by geekrex:DIY 3D Printed Desk Lamp$200 DIY 3D Printer Build$1 DIY Fidget Toy
Add instructable to: