loading
Picture of Computer control of AC devices
30 outlet.jpg
If you have ever wanted to control electronic devices from your computer to control or regulate your environment, this instructable will guide you. In this example of computer control, a USB relay device (USBmicro http://www.usbmicro.com - U451) will control two 60 watt light bulbs from a PC program.
 
Remove these adsRemove these ads by Signing Up

Step 1: Safety First!

Picture of Safety First!
First off - Any time that you work with 120V voltages, safety is paramount. If you are not comfortable working with mains power, please seek the assistance of someone who is.

This instructable is intended only for someone experienced and confident in wiring high voltages. Do not attempt to do this if you are not. Household current can kill or badly injure you if you who do not understand the danger.

Only the U451 relay contacts should be used for control/connection to 110V AC. The relay screw terminals are isolated from the other circuit connections. DO NOT touch the U451 when there is 110V AC present.

Step 2: Major parts

Picture of Major parts
The major components used for this example instructable are:
  • USB relay interface USBmicro U451
  • two light bulbs
  • lamp sockets
  • 110V AC cord
The example project will control two independent 110V AC lights with the two relays on the U451. The U451 and lights will be mounted on a wooden plank.

Step 3: Project mounting board

Picture of Project mounting board
The lamp sockets are placed on either side of the wooden plank used for this project. The location of the lamps are copied to the plank and traced with a pen. A center line is drawn through the circle to aid in mounting the lamps.

Step 4: Board parts

Picture of Board parts
Four adhesive-backed felt pads are added to the bottom side of the board. This will prevent the board from scuffing the surface that the board is placed upon.

The lamp sockets in this example setup will rest on some washers to provide some space for the wires that lead out from the under side of the socket and to the U451.

Step 5: Mounting lamps

Picture of Mounting lamps
The lamp sockets are positioned and the screw locations marked with a pen. The screws and two washers are added and partially screwed in place. The lamp sockets loosely mounted as a "dry fit" just to see that they fit in place nicely.

Step 6: Mounting the U451

Picture of Mounting the U451
The U451 is mounted next to the lamps with small standoffs and #4 screws. Pictured are the two 3-screw headers - one for each relay.


Step 7: Wiring parts

Picture of Wiring parts
Because of the high voltage and current involved with this example, you must use a wire of sufficient diameter. In this case 16 gauge will suffice.

Step 8: Hot wire connection to the U451

Picture of Hot wire connection to the U451
The pair of wires from the two-wire plug consists of "hot" and "neutral" represented by black and white respectively.

Hot connects to each of the two common "c" terminals on the U451. This example project uses a wire nut to make the connection from the single source hot/black wire to the two pigtail wires that lead to the U451.

Step 9: Connections to lamp.

Picture of Connections to lamp.
The neutral/white connection is split into two wire pigtails that connect to the lamp socket (silvered connection).

One black wire connects from the N.O. (normally open) screw terminal connection on relay 1 to this lamp socket (brass screw on socket) while the other lamp socket connects in a similar way to the N.O. connection for relay 2.

Step 10: Lamps and bulbs.

Picture of Lamps and bulbs.
Mount the lamp sockets, tighten the screws. Install the light bulbs. These test bulbs were incandescent. Other more energy sensible light bulbs could be used.

Check your wiring. Once you are sure about the 110V AC connections, attach the USB cable to the U451 and your PC. Plug the AC plug into an outlet.


Step 11: Very simple PC programming

Picture of Very simple PC programming

This project is brought to you by the magic of RobotBASIC. RobotBASIC (RB) is a free programming language and IDE (integrated development environment). It has support for controlling the USBmicro U451.

RB is free. FREE! You can write a program in the RB IDE and then save it as an .exe - a stand-alone executable that doesn't need the IDE to run. The USBm.dll is needed to go along with that file, but that is free, too.

I'm not going to get into the details of the program in this instructable. The entire program is the 35 lines in the image below. The program is easy to copy into the IDE and simply run. Here is the program as text: (note the spacing gets screwed up.)


// U451 relay control program

// If the DLL is found...
if usbm_DllSpecs() != ""

// And the device is found...
if usbm_FindDevices()

// Initialize the U451, outputs
n = usbm_DirectionB(0, 0xFF, 0xFF)

// Create title and two checkboxes for the relays
xyText 10,10,"Relay 1 Relay 2","",20,fs_Bold
for i = 0 to 1
addcheckbox "" + i, 10 + 120*(1-i), 60, " "
next

while true
for i = 0 to 1
if getcheckbox("" + i)
n = usbm_SetBit(0, i+8)
else
n = usbm_ResetBit(0, i+8)
endif
next
delay 100
wend

else
print "There are no Devices"
endif
else
print "The USBmicro DLL is not installed"
endif

 

Step 12: Running the program

Picture of Running the program
2010-06-17_175324.jpg
2010-06-17_175351.jpg
When the program runs you are presented with two boxes that you can click on or off. If everything works the bulbs follow suit!

Step 13: Let there be light!

Picture of Let there be light!
0 computer control of AC.jpg
You now have control of two lights in this example instructable.

This setup could easily be modified to control the power to almost anything that plugs in. And RobotBASIC (www.robotbasic.org) can be used to make much more complex programs that, for instance, turn on electric devices based on a complex PC schedule.

Let there be light bulbs. :-)

Step 14: Updated: Instead of wiring the lamps directly...

...wire the relay into your own outlet.

Please see the specifications for the U451 for limits to the current for the devices you control.
1-40 of 52Next »
jonA46 months ago

Just a heads up. The plastic covers used are intended to be flush mounted against a wall since they aren't structural. For exposed boxes you need the metal covers that don't extend past the junction boxes themselves.

Jumprocks1 year ago
wHi, what woudl I need if i wanted to control 4 lights??
rusjane3 years ago
who is the person that make that device
amalkady4 years ago
what sholud i use if i want 220 v??
staniagas4 years ago
Here No steps are given about how to connect this with computer? Can you explain this!!!!!!!!!!!!!
shortw5 years ago
How much power can you put through the board?
indestructable (author)  shortw5 years ago
The U451 is limited to about 2 amps at 110V. So at most each relay could control about 200 watts.
then why does the usbmicron site say the relays are rated to 125v 10 amps ??
ToddR whiplash5 years ago
From their website:
PCB trace widths limit the connections to the relays to about two amps - this should not be exceeded.

The board is what's limiting it, not the relays. Probably not that hard to work around if necessary.
reoozeit ToddR4 years ago
My general knowledge of relays tells me that the 120v side is the side being switched on and off by the relay- essentially making it the same as the standard single pole switch in your house. And if those relay contacts are rated at 10 amps, they should be able to handle around 10 amps. The relays in components are typically purchased from other manufacturers and integrated into products by the electronics manufacturers. When they say differently about the connection to the relays being limited to 2 amps and are talking about the pcb, the 120v connection to the relays has some pcb trace going out to a separate terminal block- and that is true in this case (which would be a not-so-smart way to design a relay because it creates confusion about ratings, limits uses, and it could be done with terminals integrated into the relay to avoid all of this! ). In that case, a direct soldering of your wires to those contacts bypassing that pcb connection should suffice as described by author in comment below. Good luck, have fun, void your warranties, and BE CAREFUL! Don't hurt (enter your name here)!
indestructable (author)  ToddR5 years ago
A reasonable work around is to use a heavy gauge wire to connect to the soldered relay connections on the bottom of the U451 USB relay board (in pictures above). You make direct heavy connections to the relays themselves to overcome the limits of the printed circuit board.
maewert4 years ago
Very nice instructable.

Similar to mine at:
http://www.instructables.com/id/Yet-Another-Arduino-110v-Power Controller/

Mine does not use a relay board, so it is not for the faint of heart :-)


Best Wishes
maewert maewert4 years ago
sry for the broken link:
http://www.instructables.com/id/Yet-Another-Arduino-110v-Power-Controller/
rohan98695 years ago
How do u add the USBm.dll and the program to the U451?
indestructable (author)  rohan98695 years ago
What are you asking? The program and the DLL don't get "added" to the U541 - the program runs on a PC.
rohan98695 years ago
From where can we download the software robot ide??
indestructable (author)  rohan98695 years ago

RobotBASIC comes from http://www.robotbasic.org
ckundo5 years ago
Awesome! This might be interesting to you: we created an inverse of this idea where you can use the A/C device to control the computer. Some documentation here: http://itp.nyu.edu/~sz590/blog/2010/05/23/api-for-the-world/
Hey nice!! Can you think of a way to add current load monitoring to this... It would be cool to be able to create software to mon current load and control lighting and other circuits based on time of day and power consumption??? Any thoughts would be appreciated!
You can build your own current sensor with this instructable: http://www.instructables.com/id/2-Carabiner-split-core-AC-transducer/.
Buzzsushi5 years ago
Where can I buy one of these controllers? I cant find out lol
indestructable (author)  Buzzsushi5 years ago
ludionis5 years ago
I could see hooking a few house lights up to a system like this, and when I'm on vacation, use RDP to remote into my home server, turn lights on/off to make people think house is occupied, or wire to a garage door opener and remotely open it from anywhere I have internet....so many fun possibilities!!!
drresearch5 years ago
Nice instructable, I voted for it and for your other instructable "eMail Light: LEDs show new e-mail". I finally bought the U451 and am waiting for it to arrive.
ipodgeek5 years ago
I just made the plug version of this project a few days ago after seeing this instructable. It is awesome. I've tried it with some lights in my house as well as a fan a sander and a metal polisher. It's very cool to turn on and off devices using your computer. I will post a few pics of it later.
indestructable (author)  ipodgeek5 years ago
That is great to hear! I'm glad that this instructable has helped you - I look forward to your pictures.
databoy5 years ago
I am a qualified licensed electrician. The electrical industry uses PLC's. (programmable logic controllers). You can buy a PLC off the shelf. They are dedicated stand alone micro-controllers and far superior for electrical switching applications than using micro-controller boards and writing software. The cost factor is about equal.
BTW my email is Stevens_Carl@hotmail.com
Hey I am semi familiar with PLC's... Connecting them and wiring them. That said I follow the schematic provided by the engineers. Now i can figure out the schematic but I do not know how to spec the hardware. i have been trying for some time to set up a PLC to monitor the load on all forty circuits in my breaker panel and shut some off due to load, power consumption,( both peak, and cumulative,), or by remote. If you would be willing to assist me in the defining what hardware to purchase ,(PLC Lingo is greek to me,), I would greatly appreciate it.
insmac databoy5 years ago
An Ardweeny and a opto isolated triac for less than $15 USD and free software. Is there a PLC available for near that? Besides who wants to program in ladder logic...a language that was obsolete 30 years ago, but refuses to die? ;-)
mani5225 years ago
wat is d relay for 220 volt
Thenwcp mani5225 years ago
look for one with a rating larger than 220V
ipodgeek5 years ago
Great instructable! I really like it. I think I'm going to make something like this when I have the time. Thank you very much for posting it!
stackerjack5 years ago
I would love to make this project, but where, on my computer, do I enter the program?
indestructable (author)  stackerjack5 years ago
You would download RobotBASIC from robotbasic.org and use that for program entry.
fly_boy_bc5 years ago
How to buy somethng and use it. This is an instructible? If you had to buy relays and a microcontroller it would be an instructible. If I show you how to build something using Mindstorms is that an instructible? NO IT IS NOT. Very very dissapointing. I was hoping to learn how to build something. I was not expecting "go out and BUY a controller and hook it up as per instructions".
thaCrab5 years ago
just wondering if it would be at all poss to hook a spare cell ph to your computer so you can turn on lights etc via txt or call when you're on your way home ???
Sagacity615 years ago
This is an advertisement from Dontronics perhaps?
munkey9065 years ago
I thought about doing something like this, and then found that the Insteon and other home automation equipment will end up being similar in price (when it's all said and done for a useable and professional install). Plus many of the home automation equipment will carry the on/off signal over the house wiring (no need for USB) and there are even options to hook them to your router and control from an iPhone or other web device. Very cool though... and handy if you don't want to drop cash on home automation stuff..
DAG10305 years ago
Very cool! I have a lot of application for this. Thanks for posting it.
1-40 of 52Next »