Controlling a 220V light bulb with a relay

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Controlling a 220V light bulb with a relay

Post by zener »

First, do you understand that any relay has a coil voltage specification? You keep saying "220V relay", well there are a lot of different kinds. What is the coil voltage???

Put a flyback diode on the relay. The flyback power can be significant. Stick a crow bar in your wallet, pry out 10 cents and buy a 1N4007 and put it on there.

User avatar
stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Controlling a 220V light bulb with a relay

Post by stinkbutt »

Now now, Zener, be nice. He's new. He's not cheap. BANNED, the chip he's talking about is probably ten times the cost of a transistor/resistor/diode. He's just looking to simplify. (I think.)

It's not a complicated circuit to build, urig. The flyback goes in like this:

Image

Don't worry about the 0.01 ohm resistor they've got there. The relay's got more internal resistance than that, as does the rest of your circuit, probably. As for the resistor going to your transistor, which switches your relay, just stick it before the base of the transistor to limit the current. Easy-peasy, lemon-squeezy.

urig
 
Posts: 16
Joined: Tue Mar 16, 2010 9:13 am

Re: Controlling a 220V light bulb with a relay

Post by urig »

Hi Zener and stinkbutt

As stinkbutt says, for me It's not about the cost, it's about simplicity. The Darlington Bridge might seem like overkill but would save me some soldering. Plus it's only a buck and a half I think: http://efx-tek.com/topics/uln2x03.html

As for the coil voltage, I assumed that because the Arduino outputs 5V then I'd be using a relay with 5V for coil voltage. Do I understand correctly now that in fact the transistor will increase the voltage and that I should aim for 12V coil voltage? Based on an article I've found in Hebrew, I'm looking for something like this: http://parts.digikey.com/1/parts/749207 ... 12v-f.html

Is the only reason I'm using a transistor (in or out of the Darlington Bridge) that a relay with 5V coil voltage demands more current than the Arduino can supply? For example, this: http://parts.digikey.com/1/parts/749215 ... c5v-f.html has a 60mA coil current which is higher than the Arduino's estimated 50mA

Either way, I appreciate both of you helping me out. And thanks stinkbutt for the diagram. I'm starting to get it :). I'm not sure how the bridge performs the same trick but I'm trying to.

Thank you for your patience!
urig

User avatar
stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Controlling a 220V light bulb with a relay

Post by stinkbutt »

urig wrote:Hi Zener and stinkbutt

As stinkbutt says, for me It's not about the cost, it's about simplicity. The Darlington Bridge might seem like overkill but would save me some soldering. Plus it's only a buck and a half I think: http://efx-tek.com/topics/uln2x03.html
Assuming that your relay uses 60 mA, then yes, the part you're linking would work. It wouldn't work well because it's overkill, but it'd work.
urig wrote:As for the coil voltage, I assumed that because the Arduino outputs 5V then I'd be using a relay with 5V for coil voltage. Do I understand correctly now that in fact the transistor will increase the voltage and that I should aim for 12V coil voltage? Based on an article I've found in Hebrew, I'm looking for something like this: http://parts.digikey.com/1/parts/749207 ... 12v-f.html
A transistor increases the amount of current, not the voltage. The voltage is just whatever voltage you're supplying.
urig wrote:Is the only reason I'm using a transistor (in or out of the Darlington Bridge) that a relay with 5V coil voltage demands more current than the Arduino can supply? For example, this: http://parts.digikey.com/1/parts/749215 ... c5v-f.html has a 60mA coil current which is higher than the Arduino's estimated 50mA
Yes, that's precisely the reason. An Arduino can only source 50 mA, and probably less if other pins are working.

I still recommend to you that you go get a TO-220 (that's just the form factor of the transistor - A TO-220 transistor can dissipate more heat - thus more current - than a TO-92) transistor and just wire in the bypass diode. It's not that terribly complicated, it's cheaper than a darlington array, and you end up understanding the point of the circuit.

urig
 
Posts: 16
Joined: Tue Mar 16, 2010 9:13 am

Re: Controlling a 220V light bulb with a relay

Post by urig »

Hi,
Assuming that your relay uses 60 mA, then yes, the part you're linking would work. It wouldn't work well because it's overkill, but it'd work.
Why would it not work well (referring to ULN2803A)? Issues of heat dissipation? Something else?
A transistor increases the amount of current, not the voltage. The voltage is just whatever voltage you're supplying.
So if the transistor doesn't increase the current, how is it that my Arduino - sourcing 5V - can work well with the 12V relay? What does this imply concerning the voltage of the relay's coil? Is it insignificant? Can I use a 5V or 24V relay just as successfully?


Thanks!
urig

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling a 220V light bulb with a relay

Post by adafruit_support_bill »

Why would it not work well
It will work fine. I think SB's point was that it was more than you need. If you were designing something for mass production that would be an issue, but for a one-off project, a little overkill is not such a bad thing.
So if the transistor doesn't increase the current, how is it that my Arduino - sourcing 5V - can work well with the 12V relay?
Technically, it is a high-gain current amplifier. But in this application you can think of it as a switch. For a relay with a 12 coil, you would need a 12v source with enough current to drive the relay coil. Your darlingtons will switch that 12v using the low-current 5v signal from the Arduino digital pinas the control signal.

If you can find some relays with a 5v coil, you can use the output of the Arduino 5v regulator (~500 mA max). But again, the darlington will be switching high-current 5v to the coil, using the low-current (~20 mA) 5v signal from the Arduino digital pin as the control signal.

urig
 
Posts: 16
Joined: Tue Mar 16, 2010 9:13 am

Re: Controlling a 220V light bulb with a relay

Post by urig »

Hi,
If you can find some relays with a 5v coil, you can use the output of the Arduino 5v regulator (~500 mA max). But again, the darlington will be switching high-current 5v to the coil, using the low-current (~20 mA) 5v signal from the Arduino digital pin as the control signal.
To verify that I understand - The darlington/transistor will take the low current 5v from the Arduino and augment it to 5v high current? And the 5v high current is enough to operate the 12v relay coil? So why is it called "12v" anyway? LOL.

And as the plot thickens - what is the "Arduino 5v regulator" and is it a viable option for me to control 3 relays? :)

Many thanks!
urig
Last edited by urig on Wed Nov 17, 2010 8:15 am, edited 1 time in total.

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling a 220V light bulb with a relay

Post by adafruit_support_bill »

And the 5v high current is enough to operate the 12v relay coil?
Not quite. If you read carefully, I said:
If you can find some relays with a 5v coil
Those should not be too hard to find.
what is the "Arduino 5v regulator" and is it a viable option for me to control 3 relays?
This is an on-board voltage regulator connected to the DC jack on the Arduino. A common way to power the Arduino is with a 9v wall-wart. The voltage regulator regulates that down to 5v for use by the Arduino and any attachments. It is capable of supplying much more current than a digital output pin.

User avatar
stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Controlling a 220V light bulb with a relay

Post by stinkbutt »

As a rule if you don't have access to a 12V power supply you shouldn't use a 12V relay. If you've only got the 9V from the wall-wart or 5V from the Ardunio power supply (not coming directly off an Arduino pin) then you should use a matching relay.

The magnetic field generated by a relay's coil, is a function of the current, so if you cut the voltage from 12V to 5V you're going to get less than half the current running through the thing. Maybe that's enough to close the internal relay switch, maybe not. Oh, and DEFINITELY don't use a 5V relay with 9V or 12V as it's VCC. These things have very low internal resistance. You use a higher voltage on it and it might overheat.

User avatar
stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Controlling a 220V light bulb with a relay

Post by stinkbutt »

Actually I've reconsidered. You've gotten Arduwino's attention at this point. Please disregard my posts and do whatever he sez.

jcarroll
 
Posts: 11
Joined: Tue Oct 12, 2010 10:02 pm

Re: Controlling a 220V light bulb with a relay

Post by jcarroll »

Install the flyback diode. It costs a few cents and will prevent failures.

Better yet, go to ebay and find the SSR you need. This one will control 25 amps for less than $7 delivered.

http://tinyurl.com/25f6xna

It was made to be controled by an arduino.

urig
 
Posts: 16
Joined: Tue Mar 16, 2010 9:13 am

Re: Controlling a 220V light bulb with a relay

Post by urig »

Hi Arduwino, stinkbutt et al,

Thanks very much for your help. I've successfully setup my prototype where I control a 220V relay with a 12V coil from my Arduino (using a ULN2803A Darlington Bridge). I plan to blog about my project when it reaches completion. When I do - I'll link to it here.

Many thanks!
urig

pstemari
 
Posts: 310
Joined: Sun Mar 21, 2010 6:10 pm

Re: Controlling a 220V light bulb with a relay

Post by pstemari »

FWIW, I made something similar for the office, and used six high-intensity LEDs (15,000 mcd or thereabouts) for each lamp. I ran them in strings of three, controlled them with an Arduino and a ULN2803A, and all powered by a 12v wallwart. The LEDs were a lot brighter than CFL's, and only draw 20 mA.

If you've got a Fry's nearby, the traffic light they have over by the lava lamps is what I used for a housing. I just ditched the control board and the wimpy stock LEDs.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”