Last time, I showed you a few ways of making your Arduino projects speech controlled 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 . 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.
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.
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.
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).
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:
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 , 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 journey yet?
Image Credit: Shutterstock – power socket,