Introduction: Make Any Extension Cord Radio Controlled!

Picture of Make Any Extension Cord Radio Controlled!

Picture this; it’s the middle of December and cold; real cold outside and you’ve been reading in bed. You want to go to bed but you need to turn off the lamp across the room. You weigh out the possible solutions of achieving your goal. The most obvious ones are: walking over and turning off the lamp or taping a couple of long poles together and swatting at the power button from the comfort of your bed. Unfortunately, history has proven that the latter option has resulted in some broken lamps.

So what should we do? We’ll get out of bed and build some wirelessly controlled extension cords!

Before we begin, it’s interesting to note that you aren’t modifying the lamp itself but an extension cord. Therefore you could wirelessly control anything that plugs into the extension cord. Lastly, this project involves AC / main power and can be extremely dangerous – please take all the necessary precautions to protect yourself.

Step 1: Materials

Picture of Materials
1. Two arduinos
  • I used an Arduino Uno and an Arduino Pro Mini because that is all I had lying around
  • cost ($7 + $2 = $9)
2. 433 MHz transmitter and receiver module
  • they usually come in a pair, you can find them on eBay for $1

3. 5V Control relay module

  • Ideally, I would have purchased a single channel module, but at the time, I could only find dual channel. these go for about $3.50

4. Hook up wires

5. Extension cord

  • I was really picky with this item. I didn't want a super long extension cord as it would be too much clutter. I shopped around and was ultimately able to find a 12 inch extension cord from Dollarama which was exactly what I was looking for.

6. A push button and a 10k resistor

7. Power

  • I used a 9V battery with a battery adapter because that was all I had lying around . For future revisions I would use 5 double A batteries

8. Two bread boards

All the parts were sourced off of eBay.

Step 2: Soldering on an Antenna for Your RF Modules

Picture of Soldering on an Antenna for Your RF Modules
  • Wrap the solid core 20AWG wire around a pen, I used a papermate pen to get 12 twists
  • when you're done, pull it off the pen and strip off one of the ends and solder it to the RF modules
  • Solder the antenna to the locations as shown in the pictures.

Step 3: Building the Transmitter

Picture of Building the Transmitter

I've drawn out the breadboard and included a schematic view of the set up. After you finish, upload the code in the next step.

***About the code****

I ended up building a couple of these and had to rework the code to include a specific password for each transmitter. The reason for this is to prevent one transmitter from controlling all my receivers. However, should you want to control multiple receivers with one remote, you could use the same password on all of them.

You will also need to download and install the avr and virtual wire libraries.

Step 4: Code for Transmitter

You can download the transmitter.ino file or right click and select "open in new tab" and copy the code into a new Arduino sketch.

//Created by William_L
//Transmitter Code
//
//Purpose: 
//        The transmitter emits a specific code that is user defined by the variable pass[],
//        when the receiver detects that specific signal, an action is carried out
//        on the reciever end.
//Date: 23/12/2015

#include <VirtualWire.h>
#include <avr/io.h>//Button is hooked up on pin 10
//Transmission data is attached to pin 11 const int transmission_pin = 12;
const int button = PD3;
const char pass[]="home"; //change the value here to change the signal password

void setup() {
    //data directions
    DDRD &= ~(1<<button)   //initialize serial monitor
    initUSART();
} ......

Step 5: Building the Receiver

Picture of Building the Receiver

**WARNING**

DO NOT PLUG IN THE EXTENSION CORD UNTIL YOU HAVE READ EVERYTHING

1. Do not plug in the extension cord while you are working on it. Even after you've finished working on the extension cord, make sure you build an enclosure for the control relay! The control relay I received from eBay had exposed pins on the bottom. If you touch those pins while the extension cord is plugged in the wall, you will get seriously injured! For visibility, I removed the box I built to surround the control relay.

2. DID I MENTION, DO NOT PLUG IN THE EXTENSION CORD WHILE YOU ARE WORKING ON IT

How does a control relay work and why do we need it?

A control relay is essentially a switch that isolates one voltage level from another. By energizing or de-energizing the coils, we can switch the relay from normally closed(NC) to normally open(NO).

In order to turn a device that is connected to the extension cord on and off, we need to be able to allow or stop the current from flowing inside the cord. We can do this by introducing a control relay which opens or closes the circuit when it is energized or de-energized. In order to energize or de-energize the control relay we use an Arduino.

Step 6: Code for the Reciever

You can download the receiver.ino file or right click and select "open in new tab" and copy the code into a new Arduino sketch.

Step 7: Have Fun!

The last step requires you to build an enclosure for the control relay to prevent the contacts from touching. I purchased a cheap plastic box from Dollarama as a temporary solution.

You do not need to plug in the extension cord to check if you've wired everything correctly. To test if your receiver is receiving a signal from the transmitter, power both Arduino's and actuate the button. If everything is working correctly, you should hear the control relay making an audible click every time the button is actuated. The clicking noise is the physical switch inside the control relay switching between normally open to normally closed.

The range is pretty impressive and it does not require line of sight. I've noticed that I have been able to turn on my bedroom lights a couple of rooms away with a couple of walls in the way as well.

Comments

john2hh (author)2015-12-30

Hi there, the Sketch for the 'Receiver.ino' appears to be half missing. Can you please re-publish or send to me? Thanks.

William_L made it! (author)john2hh2015-12-31

Hey john2hh, I've uploaded both files again and double checked, can you let me know if your problem is fixed. You can view the whole file by right clicking on the .ino file and opening it in a new tab. Let me know if your problem is solved!

john2hh (author)William_L2015-12-31

Hi William_L, thanks for your help. It looked like it was a browser issue. After you kindly updated the sketches I still could only download part of the Receiver sketch. All was ok once I tried a different browser. Thanks once again for your help. Johnhh.

About This Instructable

484views

8favorites

License:

More by William_L:Control your lights through a webpage!Ryerson MEC830 Mechbot Custom Serial CommunicationMake any extension cord radio controlled!
Add instructable to: