DIY Smart Home

Control Appliances From An Arduino: The Start Of Home Automation

James Bruce 15-02-2013

arduino home automationLast time, I showed you a few ways of making your Arduino projects speech controlled 3 Ways To Add Speech Control To Arduino Projects I'm really starting to love my Arduino lately; having gone through the basic tutorials and even made an LED cube, I was ready to tackle something far more complex. Fortunately, speech controlling an Arduino project... Read More via SiriProxy, OS X’s built-in speakable items, and some Automator scripting, or even a dedicated voice recognition hardware chip. I left you with a quick demo of me turning on my lights, but didn’t explain how I achieved that on the hardware side. Let’s look today at how you can control high power devices – like your kettle, or some floor lamps.


Warning: Messing around with a household mains electrical supply is not something to be undertaken lightly. A 9V battery can make your tongue tingle, but 120-240V can fry it, and potentially kill you. If you die from doing any of this, I accept absolutely zero responsibility. If you don’t accept that, stop reading now.

If you’re new to this, make sure to check out our beginner’s Arduino guide Getting Started With Arduino: A Beginner's Guide Arduino is an open-source electronics prototyping platform based on flexible, easy-to use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. Read More . Also, I wouldn’t suggest trying to control specifically your kettle (for example) due to the high current pull – a 1500W kettle will use around 12.5 Amps (depending on your national voltage level).

Solid State Relays

Relays are electrically controlled mechanical switches; apply a voltage to the trigger side, and the magnet inside will flip the switch mechanically.

They come in a variety of sizes and ratings, so it’s absolutely essential that you check the total current and voltage you’re going to switch; if you try to put 240VAC through a relay rated for just 5VDC, then bad things are going to happen.

The characteristics of a relay also mean you can’t just plug them directly to the Arduino – you need to isolate them somewhat using a transistor, and provide a “flyback” diode. Relays contain magnets, which are inductive, so they hold a charge of electricity. When you suddenly drop the charge, the inductive load escapes back to the circuit it came from, in the reverse polarity; the flyback diode protects the circuit.


arduino home automation

Relays can be wired up as either normally open, which means “off unless you turn them on”; or normally closed, which mean “on unless you turn them off”.

If this is the route you wish to go, be aware it’s the most dangerous one as there will be bare live wires. You can purchase a relay kit from SparkFun for $20; it includes a small circuit board and all the necessary additional components to switch up to 240VAC 8A loads.

arduino home projects


“PowerSwitch Tail”

If the idea of touching any kind of live wires scares you but you still want a reliable wired approach, these pre-made relay tails [Broken URL Removed] are probably your best bet, retailing at around $25 each. You just jack these into the connection between the wall socket and the device, then run your Arduino’s power supply and a digital IO into the side.

arduino home projects

These are suitable for 120vAC in the US, but for the UK’s 240v and elsewhere they only produce a kit form [Broken URL Removed], and you’ll need to add your own plugs. Be careful with the kits though, as mistakes could mean frying your Arduino or yourself, so these aren’t 100% safe. For total piece of mind, you should look at the next option.

Hack Some Remote Controlled Sockets

Nowadays you can get a remote radio controlled mains socket for as little as $10-$20, and they typically all use exactly the same 433mHz frequency to control things and probably the same chip. If you’re prepared to sacrifice the remote, or at least make a few holes for some wires in the case, you can easily connect it to an Arduino.


Start by opening up the remote and identifying the chip used; the following diagram explains the pin you’re looking for if you have an SC5262 chip (HX2262 and PT2262 are also compatible with the same pin used). Connect that pin to a digital output on the Arduino, and you can even bypass the remote battery by using the 5v power supply and ground (or just keeping using the supplied battery, whatever).

arduino home automation

Next, you’ll want to download and place into your Arduino/Libraries folder the RFSwitch library from Google Code – this gives you access to some simple functions for activating devices and leaves out the nitty-gritty of command signals. Start by creating a new instance of the class:

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

In your setup() function, instantiate it on the relevant output pin (10, in this case):


And in your main logic, use:

mySwitch.switchOff(3, 1);  
mySwitch.switchOn(3, 1);

(where 3 is the channel, and 1 is the device number) to turn on and off devices. Typically there are 4 of each channel and 4 devices, giving you 16 unique addressable devices to switch on and off.

The best part about hacking these existing consumer products is that you won’t be touching any high voltage wires; everything is self contained in the socket module.

Now, combine this with a little Arduino internet control How To Set Up Arduino Web Control Without An Ethernet Shield For the last few weeks, I handed over control of the mood lighting in my studio to viewers during the live broadcast of Technophilia Podcast - you can see the results of that in the... Read More , and you’ll be able to turn on your appliances from your mobile anywhere in the world. I’m fairly certain I don’t want to hand over control of anything much to the internet, but each to their own. Can your Arduino home automation dreams finally be realized? Have you begun your Arduino journey yet?

Image Credit: Shutterstock – power socket,

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Jeff
    February 23, 2015 at 7:02 pm

    Well done, Martin - just what I need for my project - Thanks!

  2. Martin Temmink
    February 16, 2013 at 1:18 pm

    Please take a look at
    it's in dutch but google translate will work for this website.

    It's an open source version of an domotica (Hardware and Software).
    It has a lot of possibilities and use the 433Mhz band (RF).

    • muotechguy
      February 18, 2013 at 9:54 am

      Thanks Martin; I tried to decipher it, but I'm afraid the translation was pretty bad. It looks like a very nice shield, and seem to handle lots of different com methods including IR? An actual English version would be very popular I think...

  3. Guy McDowell
    February 15, 2013 at 6:25 pm

    Too coincidental. I was just talking with someone the other day about having an opensource home automation system. The brand name ones out there discontinue parts way to quickly. Using an Arduino and generic relays and switches would be a much better way to go, if your technologically inclined.