Introduction: Arduino Home Automation

Picture of Arduino Home Automation

This is a relatively simple controller for controlling equipment in your home.

At the moment I control my central heating, security and lighting.
By sending commands from my home computer.

My homeeasy central heating controller hack.

I am also able to login remotely from the internet to control the equipment at home connected to this controller.

This project is built around an Arduino board.

The arduino board is a hardware interface allowing you to control and monitor hardware devices with your computer.

And the homeeasy home automation controllers available from B&Q.

These are basically plug-in module which allows you to switch devices on and off using a remote control.

The idea behind this project was. I wanted to be able to login to my home computer and send commands that would allow me to turn lights on remotely.
Or have the computer do it automatically at a set time or when it gets dark.

Step 1: Parts Needed

Picture of Parts Needed

1 arduino board.
1 homeeasy controller - part number HE300
1 prototype board - Vero board
10 resistors - 47 ohm
10 led's
4 opto isolators - RS part 308-613
Some ribbon cable.
a strip of pins to connect to the headers on the arduino board.
1 box - to put it all in.
some HE302S - remote control socket


Soldering iron

Step 2: Basic Principle

Picture of Basic Principle


Basically the arduino board when programmed will switch the digital outputs high.
Which will send 5 volts through the resistor and light the led's.
Which will activate the opto isolator which will connect the contacts on the remote control.
which will send the comand to the remote control sockets
And turn on or off the lights, heating or anything you want.

this circuit shown is for the first on and off switches.
just repeat the circuit for the following channels


I programed the software so when I pressed (H) in the terminal the arduino board will send a 1 second pulse to my remote control and switch my heating on.
when I press(h) the board will send a 1 second pulse my heating switches off.
(S) for security on
(s) for security off
(G) garden lights on
(g) garden lights off

and so on this can be changed to any button you want

Step 3: Building the Board

Picture of Building the Board

The board I built on some prototype project board available from most electronic stores.

It was just a matter of soldering on the components as show in the circuit diagram.
And making sure there were no short circuits.

the first led connects to pin 1 on the opto isolator, led 2 connects to pin 4 on the opto isolator.
pins 2 and 3 are then connected to ground. which is next to digital pin 13 on the arduino board.

opto isolator pins 6 and 7 are connected together and go to the center contact on the remote control for the first on off buttons.
opto isolator pin 8 goes to the left track on the remote.
pin 5 goes to the right track on the remote.

and then it's just a matter of repeating the circuit for the other channels.

Step 4: Modifying the Remote Control

Picture of Modifying the Remote Control

I unscrewed the screw under the rear label. And carefully prised open the case.

When open you will see the PCB.
On the PCB there is one track on the left which when connected to the centre contacts will switch devices on.
And there is a track on the right which when connected to the centre contacts will switch equipment off.

I just attached the contacts to my circuit as shown in my diagram.

and soldered on a link in place of the remote switch.

Next I attached the battery to the 3v output on the arduino board.
You don't have to do this. But I did it so I wouldn't need a battery in the remote control.

Step 5: The Software

Picture of The Software

the arduino board is controlled from it's own software this can be downloaded from here.

you can then copy and paste this code in to the arduino software and upload it to the board.

char val; // variable to receive data from the serial port
int ledpin = 2; // LED connected to pin 2 (on-board LED)

void setup()
pinMode(ledpin = 2, OUTPUT); // pin 2 (on-board LED) as OUTPUT
pinMode(ledpin = 3, OUTPUT); // pin 3 (on-board LED) as OUTPUT
pinMode(ledpin = 4, OUTPUT); // pin 4 (on-board LED) as OUTPUT
pinMode(ledpin = 5, OUTPUT); // pin 5 (on-board LED) as OUTPUT
pinMode(ledpin = 6, OUTPUT); // pin 6 (on-board LED) as OUTPUT
pinMode(ledpin = 7, OUTPUT); // pin 7 (on-board LED) as OUTPUT
pinMode(ledpin = 8, OUTPUT); // pin 8 (on-board LED) as OUTPUT
pinMode(ledpin = 9, OUTPUT); // pin 9 (on-board LED) as OUTPUT
pinMode(ledpin = 10, OUTPUT); // pin 9 (on-board LED) as OUTPUT
pinMode(ledpin = 11, OUTPUT); // pin 9 (on-board LED) as OUTPUT

Serial.begin(9600); // start serial communication at 9600bps


void loop() {
if( Serial.available() ) // if data is available to read
val =; // read it and store it in 'val'

if( val == 'h' ) // if '2' was received

digitalWrite(ledpin = 2, HIGH); // turn ON the LED
delay(1000); // waits for a second
Serial.println("h = Heating off");
digitalWrite(ledpin, LOW); // sets the LED off

if( val == 'H' ) // if '3' was received
digitalWrite(ledpin = 3, HIGH); // turn ON the LED
delay(1000); // waits for a second
Serial.println("H = Heating on");
digitalWrite(ledpin, LOW); // sets the LED off
if( val == 's' ) // if '4' was received
digitalWrite(ledpin = 4, HIGH); // turn ON the LED
delay(1000); // waits for a second
Serial.println("s = gate off");
digitalWrite(ledpin, LOW); // sets the LED off
if( val == 'S' ) // if '5' was received
digitalWrite(ledpin = 5, HIGH); // turn ON the LED
delay(1000); // waits for a second
Serial.println("S = gate on");
digitalWrite(ledpin, LOW); // sets the LED off
if( val == 'g' ) // if '6' was received
digitalWrite(ledpin = 6, HIGH); // turn ON the LED
delay(1000); // waits for a second
Serial.println("g = Garden lights off");
digitalWrite(ledpin, LOW); // sets the LED off
if( val == 'G' ) // if '7' was received
digitalWrite(ledpin = 7, HIGH); // turn ON the LED
delay(1000); // waits for a second
Serial.println("G = Garden lights on");
digitalWrite(ledpin, LOW); // sets the LED off
if( val == 'b' ) // if '8' was received
digitalWrite(ledpin = 8, HIGH); // turn ON the LED
delay(1000); // waits for a second
Serial.println("b = Bedroom light off");
digitalWrite(ledpin, LOW); // sets the LED off
if( val == 'B' ) // if '9' was received
digitalWrite(ledpin = 9, HIGH); // turn ON the LED
delay(1000); // waits for a second
Serial.println("B = Bedroom light on");
digitalWrite(ledpin, LOW); // sets the LED off
if( val == '9' ) // if '9' was received
digitalWrite(ledpin = 10, HIGH); // turn ON the LED
delay(1000); // waits for a second
digitalWrite(ledpin, LOW); // sets the LED off
if( val == '0' ) // if '9' was received
digitalWrite(ledpin = 11, HIGH); // turn ON the LED
delay(1000); // waits for a second
digitalWrite(ledpin, LOW); // sets the LED off


Step 6: Testing

Picture of Testing

After I had set up the homeeasy module to respond to the remote.
(You can find out how to do this in the instructions for the modules.)

I loaded the software on to the arduino board.
And ran the command (H)

And my heating switches on.
I tested the other commands for the lights and security and they all responded as planned.

Step 7: Final Assembly

Picture of Final Assembly

the last job was to fix all the boards in a plastic box and made a hole for the USB to plug in to the arduino board.

You may find when the boards are in the box the range at which they work is shortened.
If this happens you can mount the remote antenna on the out side of the box as I have done this to solved the problem I had with range. But you will have to keep the leads short or they will effect the frequency at which the antena transmits at.

Step 8: Controlling Remotely From the Internet Method 1 and 2

Picture of Controlling Remotely From the Internet Method 1 and 2

The computer I have connected to the arduino board is running Linux ubuntu.
But this board will work with windows, mac and Linux.

I have 3 ways of remotely controlling the board from the internet at the moment.

The first way will work with any computer. And that is using VNC to remotely login and control the board from the desktop. There are other software alternatives to remotely login.

Such as windows remote desktop.

And log me in

The second way which I use most of the time because of security.

Is to login using the Linux SSH terminal from windows using a program called putty.

you can also you do it this way using a mac.

When logged in

You can find out which device the arduino board is, by typing this command.

ls /dev/tty*

You should get a screen like this.

My device is USB0 but this can be different.

Then you can send the command.

screen /dev/ttyUSB0 9600

to open the tty terminal.

When the tty terminal is open you can then type the command to turn the device on or off. I.e. G or g for garden lights.

And that is about it.

if you have any problems here are some more usefull commands.
these comands will show you which tty services are running.
ps -lt ttyUSB0
ps ax | grep tty

this command will stop the service running.
kill (job number)

Step 9: Controlling From the Internet Method 3 (using a Script)(even From My Phone)

Picture of Controlling From the Internet Method 3 (using a Script)(even From My Phone)

This is a new update I have just set up to alow me to control the arduino board from any web browser.

I wanted to control my home automation from my phone but this was not very easy using VNC or SSH.

So installed webmin on my server this will give me full control of the machine from within a web browers.

In web min there is a page called command shell that will allow me to run commands from the web browser.

I original tried to run the comands I was using in the SSH terminal. but they didn't work in webmin.

So with help from my brother we wrote a script.

so now all I have to do is send a command like "home_auto h1" and the heating will switch on. or "home_auto h0" to switch the heating off.

so now it can all be controlled from my phone

here is a copy of the script.


_usage () {
echo "gl1 it will run this comand echo G > /dev/ttyUSB0 9600 and turn my garden lights on"
echo "gl0 it will run this comand echo g > /dev/ttyUSB0 9600 and turn my garden lights off"
echo "s1 it will run this comand echo S > /dev/ttyUSB0 9600 and turn my gates on"
echo "s0 it will run this comand echo s > /dev/ttyUSB0 9600 and turn my gates off"
echo "h1 it will run this comand echo H > /dev/ttyUSB0 9600 and turn my heating on"
echo "h0 it will run this comand echo h > /dev/ttyUSB0 9600 and turn my heating off"
echo "b21 it will run this comand echo B > /dev/ttyUSB0 9600 and turn my bedroom 2 lights on"
echo "b20 it will run this comand echo b > /dev/ttyUSB0 9600 and turn my bedroom 2 lights off"
echo "N it will run this comand echo N > /dev/ttyUSB0 9600 and turn next bank of outputs on for 5 seconds"
echo "R it will run this comand echo R > /dev/ttyUSB0 9600 and turn the Relay on"
echo "r it will run this comand echo r > /dev/ttyUSB0 9600 and turn the Relay off"


case "$1" in

#garden lights on
/bin/echo G > /dev/ttyUSB0 9600 && echo "Lights On"

#garden lights off
/bin/echo g > /dev/ttyUSB0 9600 && echo "Lights Off"

# gates on
/bin/echo S > /dev/ttyUSB0 9600 && echo "Gates On"

# gates off
/bin/echo s > /dev/ttyUSB0 9600 && echo "Gates Off"

#heating on
/bin/echo H > /dev/ttyUSB0 9600 && echo "Heating on"

# heating off
/bin/echo h > /dev/ttyUSB0 9600 && echo "Heating Off"

# bedroom 2 lights on
/bin/echo B > /dev/ttyUSB0 9600 && echo "Bedroom 2 Lights On"

#bedroom 2 lights off
/bin/echo b > /dev/ttyUSB0 9600 && echo "Bedroom 2 Lights Off"

#Next Bank on
/bin/echo N > /dev/ttyUSB0 9600 && echo "Next Bank on for 5 seconds"

#Relay on
/bin/echo R > /dev/ttyUSB0 9600 && echo "Relay on"

#Relay off
/bin/echo r > /dev/ttyUSB0 9600 && echo "Relay off"

#echo $0 ": Not a valid command";
echo "Please retype command";


Step 10: Updates and Upgrades


I have now added the option of switching to the next set of button. It was just a matter of wiring in a spdt relay.

so when the relay is off the first bank of buttons are selected.

and when the relay is energised the second bank of buttons are selected.

I have also added a second relay incase I want to conect anything up in the future.

Step 11: Future Upgrades

I am now in the process of connecting light and tempiture sensors to the arduino board.
which can help automate devices.


rkarjagi (author)2015-07-02

I am trying to do this project but i am stucked at a point..
I am not getting how to connect it to my home lights,tv and fridge with the circuit you have made above..
Please reply as soon as possible..
Thank You..

prabodhab1 (author)rkarjagi2017-03-02

just connect the lode in realy

sanjukta2211 (author)rkarjagi2016-09-08

You need to connect the switches of your home devices to the arduino pins.

mohammed zaki (author)rkarjagi2015-09-18

connect the switch boards using relay

kipgendio (author)2017-02-13

How many relay can be connected to arduino uno? Can anyone help?

shayneg (author)2016-03-06

This seems very long winded and expensive as those home plugs aren't cheap.

I've just automated a lot of things but using a WIFI shield for the arduino. It also acts as a web server and puts out a nice graphical front end to turn things on/off. Additionally instead of using all those components you have I simply bought an 8 ch relay controller for around £5. Now I can turn many things on/off from the web and it works great on any mobile phone too. I've also purchased a £4 RF remote kit which can also turn the volume up/down on things but again you can send signals to this over WIFI as it will be going through the Arduino 1st :)

chimelowhite (author)shayneg2016-12-28

Hello Shayneg,

I would like us to connect via my mail privately. I need you to put me through some things as I am about working on my final year project.

You can access me on or you could still drop yours. I would contact you.


sanjukta2211 (author)shayneg2016-09-08

So via your project can we switch on/off the devices even from a great distance of about 5 or 6km??

AliA430 (author)2016-05-31

Dear, Can you please specify from website , which arduino board have you used to be specific?

I'm taking up this as my graduating project , please help me

Can we have a telephonic contact?

JunezRiyaz made it! (author)2016-04-29

I made it in Simple Manner... Anyone can check in following link.

themuffinman22 (author)2015-12-03

Your project introduced me to arduino's and is awesome. I however am using Blynk to control this from my phone. I also connected a DHT11 to send me temperature and humidity. You can expand this by using an arduino mega. My question is: how do you choose the proper optoisolator?

shilafarhah (author)2014-03-11

Hai Admin!

My name is Shila.

Ive 1 question.

why you choose arduino instead of raspberry pi to control home appliance?

Thanks ;)

pcooper2 (author)shilafarhah2015-06-09

The Arduino is more like an industrial programmable controller, while the Raspberry Pi is more like a personal computer. For automation with simple LED and pushbutton interfaces the Arduino is more cost-effective and can deliver better performance in direct control of hardware. However, in recent years bridge devices have appeared, allowing one to combine an Arduino board with a Raspberry Pi, providing the advantages of both.

ronopotomus (author)2014-12-07

Fantastic. Thank you for your time and instruction.I will be using this guide.

77777777 (author)2012-10-19

i want to prepare it, but

if i try to control 10 system with this project than ,can i do it??????

dmartin64 (author)777777772014-06-17

your only limited to the number of pins on the arduino, you could, however by two arduinos and connect pin 0 (or the RX pin) of each board to each other and set one to respond to one list of commands and ignore others wile the other one responds to the commands the first one ignores.

dmartin64 (author)2014-06-17

how do you get the computer to atomaticly send commands to the bord? PLZ reply!

henrikekblad (author)2014-04-23

If you want to make your Arduino sensors wireless, try out MySensors.


Tbus (author)2014-02-03

This was a great project to complete after I took an entry-level learn at home course. ( It's nice having a lab to complete after learning about home automation installation techniques and apply what I learned from my course! Thank you.

andylphillips (author)2013-05-16

I am interested in building a temperature controller for heating the mash water for brewing beer. I bought the HomeEasy HE300 and a HomeEasy socket, but the design of the HE300 circuit board has changed and I can't figure out how to connect it to the Arduino board. Has anyone out there used the newer HE300 and can identify the connections to make?
Thanks Andy

Christ on a cookiesheet! That is going to turn out to be a difficult project for you, guaranteed. There are easier & cheaper ways of putting together a temperature controller. Check out this baby from amazon: Thats right, $25 gets you PID control...! (youll have to buy a $6 thermocouple, and a $5 solid state relay, plus what ever heaters you want to use.

D_Ghost01 (author)2013-05-15

Could anyone email the document regarding Arduino Home automation to me please?

Thank you,

77777777 (author)2012-10-19

thats so good i can prepare it for my home.....

Matrixis (author)2010-03-07

 Doing a home automation project myself using these sockets and an arduino.

The main differences are that my project uses the ethernet shield and is controllable via some custom software on my mobile phone over the internet
Plus that I use a 433Mhz AM transmitter and a library I created by researching other peoples work that reverse-engineered the protocol.
I can transmit the code for the old simple protocol(sockets  have dial on back) and the advanced protocol (socket have small button on front).  So i can actually control millions of sockets all from 1 pin on my arduino.

I have timers for turning on and off electric heating, water and even my electric blanket on my bed , plus I have an output for controlling my electric door lock so I can actually let in a friend when I'm not there if they call me.

Code is getting rather big now as I keep adding things and might have to upgrade to a mega just for the extra space :p

Who knew such a small device could take up most of my free time. ( I own 2 and probably more soon).

With regards to your own project, great work and if ya want to upgrade your project to using a dedicated 433Mhz transmitter, just give me a shout and can send you my library with instruction on how to use it.

gsalerni (author)Matrixis2012-03-19

Hi Matrixis,
I'd love to extend the home easy setup using Arduino to create a low cost main controller and low cost input devices which seem to be missing from the range (temp sensors, light sensors etc.)
Would you mind sharing your library and transmitter design?
many thanks

mojud (author)Matrixis2012-02-26

Hi Matrixis,

Do u mind sharing the library with me too?


Teknopuppy (author)Matrixis2011-04-11



i insterested in your project , can u share it with me.



squirrelsnuts (author)2011-06-30

Holy crap! This is awesome! I've been researching X10, Insteon, misterhouse, arduino, thermostats, lights ad naseum to start doing something like this. I was focused on the Insteon PowerLinc modem to hook up to my computer, but I never thought of hooking into a remote... genius! Opens all kinds of possibilities!

Question though.... why the opto isolators? I don't know electronics very well (but I'm learning!)

mbainrot (author)squirrelsnuts2012-01-28

Opto Isolator (aka opto coupler) provide optical isolation from the mains circuit. The idea behind it is if something goes wrong your micro doesn't get fried and protects the micro from EMF noise.

When you working with noisy loads (such as heavy mains switching via relays) the opto will usually prevent the micro from spazzing out (due to it switching, copping an emf whack, crashing, then rinse and repeating)

jimmer22 (author)2011-10-30

This is amazing in terms of smart home products. I came across the other day and saw some cool and useful products for home automation as well

Teknopuppy (author)2011-04-11



can i use different remote control.



TOCO (author)2010-09-03

Where can I get the block of 10 leds? I have looked for them but I cant find them anywhere. Can you post a link or something?

mman1506 (author)2010-07-17

thank you !! i was looking for months to find a alternative to transitors and power hungry relays i never thought of using opto-isolators

Yakumo (author)2010-03-30

Thank You for this wonderful idea. I'm using a different remote system but everything works fine thanks to you :)

i seriously need to add some flat cables to my next project...its works but it looks very ugly ^^'

purpulhaze (author)2010-03-05

Can  you explain in a lil more detail of how to communicate via SSH. I have freeSSH server running on my windows xp machine. I can connect but none of the commands are recognized. Am I missing something here?

purpulhaze (author)purpulhaze2010-03-05

I think I'm missing something here but I'm not sure. I don't think it can be done without something else.

purpulhaze (author)2010-02-27

Kinda new to scripts just want to make sure. I add this script somewhere in my arduino sketch?

flemron (author)2009-10-28

if( val == 'B' ) // if '9' was received
if( val == '9' ) // if '9' was received
if( val == '0' ) // if '9' was received

is this correct?

killersquirel11 (author)flemron2010-01-23

Technically, no, but it will work since its just the comments that are screwed up.  Should read
if( val == 'B' ) // if 'B ' was received
if( val == '9' ) // if '9 ' was received
if( val == '0' ) // if '0 ' was received
but the code will still compile the same either way

rk24 (author)2009-12-13

 Thanks a lot!!!!!

look this: ""

Can you make more digital outputs for that?

T_T please I need  a web controlled pcb with 8 outputs...

I've tried but

simon72post (author)2009-12-07

 Hi the server software I used was webmin.

rk24 (author)2009-12-07

can you post your web server? please

WillTheRescue (author)2009-10-01

Why does your Arduino programing interface have a space to input a letter and mine doesn't?

in the arduino software click the button on the right to open the serial terminal.

get to da parakeet (author)2009-05-02

Hey! i got somthing for you. the cheaper,quicker way is to use relays :P

Hi I was going to use relays originally. But I had these bits laying around. This is all powered from the arduino board. running relays from the arduino board could overload it if there are a few on at the same time.

Well, That REALLY all sepends on where you get them.
in the USA, theres this thing called a hamfest for/and computer show where you can get alot of cheep stuff.

i controll my relays with the dc controller shield found on arduino's website =P

Or you can control the relays with another low power relay...

haha, this i would like to see. some guy just randomly re-wiring his house using relays. that is a fire wating to happen. plus the fact this is already wireless, if you were to use relays you would need to either 1. run wires across your house or 2. find a wireless alternative. if you use wireless, it will either be cheap and unreliable or really expensive. either way this method here seems like a better choice to me really.

raathi2009 (author)2009-05-31

Sir! I need the detailed schematic. please help me sir. Or any other ways to get it.

About This Instructable




More by simon72post:Arduino powered bluetooth remote relay switchHow to back up your usb stick or camera to your android phoneHow to back up memory cards without a computer
Add instructable to: