Maker Pro
Maker Pro

is there a such thing as a "variable relay"

plasmaninjaa

Nov 16, 2012
5
Joined
Nov 16, 2012
Messages
5
I am trying to build a circuit that flashes lights on and off that will be controlled by a microprocessor. The lights will be connected to 120v ac, but will be switched on and off with a relay. My question is, is there a type of relay that when more dc power is sent into it, it will let more ac power through the other side. So if I send half power into the relay, the lights will only be half power. I guess this is almost more like a potentiometer controlled by a microprocessor. any help would be really appreciated! thanks
 

Scook

Oct 13, 2012
12
Joined
Oct 13, 2012
Messages
12
If you're using a micro-controller where you can fluctuate the the voltage, then a BJT or MOSFET would work well.
With the MOSFET you can control a channel (like a valve) by providing a voltage on the gate pin, The more voltage you give it, the wider the channel opens letting more voltage to supply your light.
(Now, I don't know if you have MOSFET knowledge or not so please don't take offense in my explanation of it's function)

-Steve
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,771
Joined
Nov 17, 2011
Messages
13,771
A BJT or MOSFET require some additional circuitry to operate on AC.
Look here.
 

plasmaninjaa

Nov 16, 2012
5
Joined
Nov 16, 2012
Messages
5
If you're using a micro-controller where you can fluctuate the the voltage, then a BJT or MOSFET would work well.
With the MOSFET you can control a channel (like a valve) by providing a voltage on the gate pin, The more voltage you give it, the wider the channel opens letting more voltage to supply your light.
(Now, I don't know if you have MOSFET knowledge or not so please don't take offense in my explanation of it's function)

-Steve

ok, i have used MOSFETs before but only in a schematic i didnt understand. What values do i need to look for when choosing one? Obviously one that can handle 120v and atleast 10 amps. are there values for the input voltage?
 

Scook

Oct 13, 2012
12
Joined
Oct 13, 2012
Messages
12
In your case the values you need to look for when choosing an N-channel Mosfet are
VDSS: 120V +
ID: 10A +
Since you are going to be running these light for extended periods of times (Im assuming) then overshooting your expected voltage and amperage is a must, which is why i put +'s. so + 15-25, because it's not like more Voltage and amperage handling can hurt ya know?

Another thing you need to consider when running this kind of power through a mosfet is a heat sink.
Mosfets come with a metal tab on the back and there's a hole on the top of this tab so you can screw the mosfet to a heat sink.
when adding a heat sink to your mosfet you need to use thermal compound too. It's a thick pasty substance that comes in a syringe (Radio shack sells a couple brands of it), you apply this paste in between the heat sink and the metal tab then screw the mosfet and heat sink togethor. This thermal compound insures that the heat from the mosfet is properly transferred to your heat sink.
i know this sounds like a lot but it really is not that hard and if you decide on this, I would gladly walk you through it, if you'd like.

Also, I forgot to ask an important question. what "lights" did you want to use? (i.e) incandescent, led...ect, and how many?
 
Last edited:

plasmaninjaa

Nov 16, 2012
5
Joined
Nov 16, 2012
Messages
5
In your case the values you need to look for when choosing an N-channel Mosfet are
VDSS: 120V +
ID: 10A +
Since you are going to be running these light for extended periods of times (Im assuming) then overshooting your expected voltage and amperage is a must, which is why i put +'s. so + 15-25, because it's not like more Voltage and amperage handling can hurt ya know?

Another thing you need to consider when running this kind of power through a mosfet is a heat sink.
Mosfets come with a metal tab on the back and there's a hole on the top of this tab so you can screw the mosfet to a heat sink.
when adding a heat sink to your mosfet you need to use thermal compound too. It's a thick pasty substance that comes in a syringe (Radio shack sells a couple brands of it), you apply this paste in between the heat sink and the metal tab then screw the mosfet and heat sink togethor. This thermal compound insures that the heat from the mosfet is properly transferred to your heat sink.
i know this sounds like a lot but it real is not hard and if you decide on this, I would gladly walk you through it, if you'd like.

Also, I forgot to ask an important question. what "lights" did you want to use? (i.e) incandescent, led...ect, and how many?


basically i plan on using this to control the brightness of christmas lights. So the part i dont understand is what value on choosing a mosfet tells you what the gate voltage range is (i.e. 0v is off and 5v is max power or something like that)
 

plasmaninjaa

Nov 16, 2012
5
Joined
Nov 16, 2012
Messages
5
alright so pretty much I just need a mosfet rated at atleast 120v and 15 amps and 5v, hook up the source and drain to the lights and whatever voltage i send to the gate from the microprocessor will control the brightness of the lights? And the mosfet can run on ac?
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
For 120V AC there will be a peak voltage of 120*SQRT(2) = 170V. There will also be spikes to take care of. I would suggest a 400V fet.

A fet can not be used on AC.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,771
Joined
Nov 17, 2011
Messages
13,771
A single MOSFET will not suffice. It has an internal body diode backwards between drain and source. An N-channnel MOSFET will be conducting if the source is psoitive with respect to drain. You will need two MOSFETs in series, connected drain to drain as in a PhotoMOS relay (example here).

For safety reasons you should isolate the microcontroller from the mains side of the circuit. Check whether the current required by your christmas lights is small enough to be driven directly by a photoMOS relay. In that case you have isolation and control in one chip.

Also you will need to synchronize the control signal of the microcontroller to the mains frequency. Otherwise you will possibly be rewarded with a visible beat frequency. So you will need a zero crossing detector like e.g. this one.

Harald
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The method being discussed is a terrible way to control AC power. You need to use the type of circuit an AC dimmer uses, which is a triac. For AC interfaced to a microprocessor you would use am opto-isolated triac. The input can be safely operated from the micro and the output can control line level AC. You should be able to find examples of usiing a triac and the programming to make a microprocessor controller dimmer.

Basically, the trick is to detect when the AC waveform crosses zero on the micro then delay the time that you turn on the triac by anywhere from 0 to one half-cylce of the AC (you have to do both half cycles). The triac automatically turns itslef off when current stops flowing at the next zero crossing. You can dectect the zero crossings by using a large value (like 1M) from the AC hot line to a micro input and grounding the micro to the AC ground. DO look this up, though, prefereably on the micro manufacturers site to determine the exact circuit to use for safe operation.

Bob
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
The method being discussed is a terrible way to control AC power.

Nevertheless, it is the method employed by solid state relays.

You need to use the type of circuit an AC dimmer uses, which is a triac. For AC interfaced to a microprocessor you would use am opto-isolated triac. The input can be safely operated from the micro and the output can control line level AC. You should be able to find examples of usiing a triac and the programming to make a microprocessor controller dimmer.

I can't argue with this. It's generally easier to find circuits to control triacs.

The triac automatically turns itslef off when current stops flowing at the next zero crossing.

This is only for resistive loads. For capacitive or inductive loads the triac will turn off either before or after the next zero (voltage) crossing when the current falls to zero.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I agree completely with BobK. Using an active device in its linear region is a crazy way to control a lighting load that's running from AC and I doubt it has ever been done like that. The AC waveform gives you a perfect opportunity to use PWM, effectively, by turning the triac ON at a specific point in each half-cycle and having it turn off automatically at the end of each half-cycle. Because the triac is always either ON or OFF, it dissipates very little power, so it is efficient and requires little or no heatsinking. It does however generate some mean interference, which should be suppressed with inductors and capacitors, which should be included in any triac-based design.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,771
Joined
Nov 17, 2011
Messages
13,771
I have given the PhotoMOS relay only as an example for the back-to-back configuration of the 2 MOSFETs.
I troo agree that a triac is the better solution.

Here is a complete application of a microcontroller controlling a triac on mains power.

Harald
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
And just to reinforce that, I was not suggesting that anything would be used in its linear region. (gsap)
 
Top