PDA

View Full Version : Controlling 120VAC with a Propeller?



Microcontrolled
12-19-2009, 06:56 PM
I am wanting to build remote controlled christmas lights for my grandparents so that they don't have to go into the cold to turn them on. I have gotten everything down exept for how to operate the high voltage. How do you control a relay with a Propeller? I've heard of "optoisolators" somewhere but I don't know what they are or what it takes to drive them. Can someone help me with a simple circuit?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.

Robots are microcontrolled.
I am microcontrolled.

But you·can·call me micro.

Want to·experiment with the SX or just put together a cool project?
SX Spinning light display· (http://www.gadgetgangster.com/find-a-project/56?projectnum=200)
My overstock is killing me.
PM me for absolutly FREE 8-pin Mini Din connectors.

Leon
12-19-2009, 08:50 PM
Use an SSR (solid-state relay), they have opto-isolators. You just send it a logic high and it turns on, and logic low to to turn it off.

Something like this should do for 240V AC:

uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=0476652 (http://uk.rs-online.com/web/search/searchBrowseAction.html?method=getProduct&R=0476652)

I like the more expensive ones with an LED which shows when they they are on.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM

Post Edited (Leon) : 12/19/2009 1:57:46 PM GMT

PJ Allen
12-19-2009, 10:19 PM
In cases such as this, I·am a strong advocate for X10 modules.· Can't be accused of pushing the envelope of anyone's expertise with them (UL-listed =·no worries.)· They are very easy to control with Stamps (having XON and XOFF commands.)· You don't have to have a Stamp, you could get the X10 mini-timer cheaply enough or use one of their remotes.· Another member, darco, has written a X10 Propeller object, but another member was recently having difficulty implementing it.·

Anyway, searching [SSR] with this site's button turns up lots of examples of those means.

At this late date you probably won't secure parts in time enough.

DynamoBen
12-19-2009, 11:17 PM
Here is an example of relay relay control with a microprocessor. In this case the micro is a basic stamp but this is easily adaptable to the Prop (only difference is the stamp is 5V and prop is 3.3V).

http://www.rentron.com/Files/Stamp/pc-relay4.gif

The advantage with a relay is the ability to switch very high current loads, and there is no need for isolation which is necessary with an SSR.

Microcontrolled
12-19-2009, 11:32 PM
I like Leons suggestion as the easyest path, I can't search the other link at the moment. However, solid state relays seem to be pricy, if not easy. Any other ideas are appreciated.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.

Robots are microcontrolled.
I am microcontrolled.

But you·can·call me micro.

Want to·experiment with the SX or just put together a cool project?
SX Spinning light display· (http://www.gadgetgangster.com/find-a-project/56?projectnum=200)
My overstock is killing me.
PM me for absolutly FREE 8-pin Mini Din connectors.

hover1
12-19-2009, 11:41 PM
Clap On...Clap Off

DynamoBen
12-19-2009, 11:44 PM
There are commercial RF controlled relays for this purpose. Without understanding the scope of what you intend on doing it seems this might be the most simple solution (beyond running the extension cord into the house or wiring a switched outlet outside).

TinkersALot
12-20-2009, 12:36 AM
I've recently completed a nice lights display using these products:

http://www.efx-tek.com/topics/fc-4.html
http://www.efx-tek.com/topics/rc-4.html

Hid a lot of complexity from my top level control program, because it just had to send commands to these lighting controllers. May be worth a look?

JonnyMac
12-20-2009, 01:23 AM
If you're wanting to do a "dancing lights" type display with several channels the SSR route is the best way to go. SSRs aren't terribly cheap, but their quiet -- both audio (no click) and electrically (they turn on and off at the zero-cross which minimizes EMI). Even though you can find SSRs that will work down to 3v, I would suggest buffering your output pins with a ULN2803; this will let you control up to eight outputs without worrying about the load you're putting on the Propeller pins.

Full disclosure: I'm 1/2 of EFX-TEK.

StefanL38
12-20-2009, 02:53 AM
If you want to have it cheaper you can use TRIACS combinde with optocouplers. But without an extra circuit that switches them on the zero-crossing of the AC you get more EMI

As the propeller is really fast he should be able to detect the zero-crossing right well.

If you switch ON/OFF only after some hours ONCE this doesn't matter.
For something like dancing lights or phase-cutting of the AC you should use a zero-crossing circuit

best regards

Stefan

mctrivia
12-20-2009, 03:17 AM
When doing this I have always used a trial and zero crossing opto isolator. Cheap and the isolator provides the zero crossing circuitry. The prop is fast enough to do 0 crossing but that requires more circuitry and what if switching different phases

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
24 bit LCD Breakout Board now in. $21.99 has backlight driver and touch sensitive decoder. (http://forums.parallax.com/showthread.php?p=848975)

localroger
12-20-2009, 03:42 AM
If you're just turning the lights on and off and not blinking them, by far the cheapest safe way to do this is to use a small NPN switching transistor like a 2N2222 to operate a SPST relay, which you should still be able to get from Rat Shack. The basic circuit for doing this is easy to find; don't forget the reverse EMF diode to keep the relay coil back voltage from frying the transistor. You don't need a 3.3V relay since you can use the transistor to switch a somewhat higher voltage such as 6V or 9V. The relay brand new retail should cost under $5.00. It's also much safer and easier to troubleshoot an iron relay if you aren't sure why it's not working.

SSR's are nice, I use them often, but sometimes you want it to click http://forums.parallax.com/images/smilies/smile.gif and SSR's are a specialty item you'll need to order and start at around $20. They are also prone to leak if they aren't loaded heavily enough. You can test the iron relay by unplugging the 120V and ohming out the high voltage circuitry; that doesn't work with SSR's since they won't act like switches for the voltage put out by a voltmeter.

Dr_Acula
12-20-2009, 06:52 AM
I use a circuit like DynamoBen's/localroger's. One resistor, one transistor, one diode and one relay. I tend to use slightly lower resistors than 10k - usually 2k7. Transistor can be BC547 or 2n2222 or any small signal transistor. Diode =914 (for smaller relays). It may be a bit tricky getting a 3V relay, but usually you can run the relay coil off the high side of the regulator before it goes into the prop regulator. Eg if you have a 9V wall wart running the prop reg, get a relay with a 9V coil. I tend to use 5V, 9V and 12V coils depending on the circuit.

I did once wire up my shed lighting system with a solid state relay. But at night the flouros glowed even when off, and I don't think solid state relays truly turn off. When a mechanical relay is off, it really is off. Plus mechanical relays are cheaper.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller (http://www.smarthome.viviti.com/propeller)

Post Edited (Dr_Acula) : 12/20/2009 12:00:28 AM GMT

Jim Fouch
12-20-2009, 07:01 AM
I've used these (http://www.mpja.com/prodinfo.asp?number=16596+RL) and they can be driven right from a Prop pin and only pull 10-20 mA. And at ~$9 are pretty cheap.

I'm actually thinking of building a wireless device that uses the XBees to control several 120AC devices like xmas lights. Would be cool to only have to run one extension cord and control the lights from inside the house. And with the XBees running only ~$22 it's pretty inexpensive.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jim Fouch

FOUCH SOFTWARE

BTX
12-20-2009, 07:04 AM
Hi microcontrolled.

Check this: http://pdf1.alldatasheet.com/datasheet-pdf/view/5039/MOTOROLA/MOC3041.html

Check the suggested schema at page 4, you can do it by yourself at very low price, and works fine !!

I usually use them to control three phase AC motors with the best results.
Basically is the same as Leon suggested to you.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.

Alberto.

Microcontrolled
12-21-2009, 12:17 AM
Thanks, guys. This has really helped me.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Computers are microcontrolled.

Robots are microcontrolled.
I am microcontrolled.

But you·can·call me micro.

Want to·experiment with the SX or just put together a cool project?
SX Spinning light display· (http://www.gadgetgangster.com/find-a-project/56?projectnum=200)
My overstock is killing me.
PM me for absolutly FREE 8-pin Mini Din connectors.

Nak
12-21-2009, 12:35 AM
Jim Fouch said...
I've used these (http://www.mpja.com/prodinfo.asp?number=16596+RL) and they can be driven right from a Prop pin and only pull 10-20 mA. And at ~$9 are pretty cheap.


Could these be used in a dimmer circuit? IOW can they be switched on and off at 60Hz part way through the AC sine wave?

JonnyMac
12-21-2009, 03:10 AM
Nak said...

Jim Fouch said...
I've used these (http://www.mpja.com/prodinfo.asp?number=16596+RL) and they can be driven right from a Prop pin and only pull 10-20 mA. And at ~$9 are pretty cheap.


Could these be used in a dimmer circuit? IOW can they be switched on and off at 60Hz part way through the AC sine wave?


No, those SSRs have their own ZC circuitry inside and only switch on-and-off at the zero-cross. If you're looking for circuitry, www.doityourselfchristmas.com (http://www.doityourselfchristmas.com) is a good resource.

Nak
12-21-2009, 03:37 AM
JonnyMac: Thanks!