Founder interviews, pre-release product design, hand crafted inventions.
Get the digest of our best ones, straight in your inbox. Every month.
Founder interviews, pre-release product design, hand crafted inventions.
Get the digest of our best ones, straight in your inbox. Every month.

Controlling Remote Control Plug Sockets with Arduino

Techmog is a liquid network of engineers, programmers, designers and entrepreneurs in and around London who report on the industry we work in, from an insider's view. We're always looking for Londoners with something interesting to say. Send an email to info@techmog.com if you would like to contribute to the website.

Peter Bailey

Freelance Wordpress Developer in London (peabay.xyz) @peabay
Share on Google+
Post to Reddit
Share on Linkedin
Sponsored by
HonestBrew
HonestBrew has kindly sponsored this post. Discover the best beers from around the world, delivered to your door. Join today & receive a Taster Kit for half price.

Check out: Arduino Day 2015

A remote control light was a really good idea when I bought the RF plug sockets. But having to fumble around finding the remote in a dark room was annoying and dangerous (once knocked over a glass of water onto a power outlet). Luckily, the signal can easily be hijacked with an Arduino letting you do great things like controlling them with your mobile phone. Here’s how I controlled them with a simple motion sensor.

IMG_9796s

Imitating the Remote

When a button is pressed on the remote a binary signal code is transmitted. The code is unique to that button. We can simply copy that binary code and use our own RF transmitter to broadcast it.

Ray from Rayshobby.net goes into detail about how you might record this code. He creates a small circuit to sniff RF signals using his computer’s audio-in. It’s a really interesting read and you can literally see how the remotes work, but there is an easier way.

RCSwitch is an Arduino library which helps you send and receive RF signals. The library contains every example you might need, including ReceiveDemo_Advanced which displays the signal from any 315/433MHz AM transmitter.

The binary code for one of my ‘on’ switches was 010001010100010101010101, and it was simply a case of using the library to send out that code using an RF transmitter.

Sensors

I used a PIR sensor to detect motion. They’re easy to hook up and code with. Arduino.cc has a very nice example sketch you could use, but I found a simple if(digitalRead(pirPin) == HIGH){ to work just as well.

Turning on during the day became a problem. I would leave my room in the morning and the light would turn on, so I needed to add a condition to only turn it on during the night. I used an LDR to do this. LDRs, or ‘Photo Resisters’s output a range of numbers depending on the light level. With some tweaking you can activate the light at just the right level of brightness.

Find the fully working code below.

View Code

Posted 14th Feb 2015
Share on Google+
Post to Reddit
Share on Linkedin
Sponsored by
HonestBrew

Comments