# is there a such thing as a "variable relay"

Discussion in 'General Electronics Discussion' started by plasmaninjaa, Nov 16, 2012.

1. ### plasmaninjaa

5
0
Nov 16, 2012
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

2. ### Scook

12
0
Oct 13, 2012
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

3. ### Harald KappModeratorModerator

12,455
2,984
Nov 17, 2011
A BJT or MOSFET require some additional circuitry to operate on AC.
Look here.

4. ### plasmaninjaa

5
0
Nov 16, 2012
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?

5. ### Scook

12
0
Oct 13, 2012
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: Nov 16, 2012
6. ### plasmaninjaa

5
0
Nov 16, 2012

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)

7. ### Scook

12
0
Oct 13, 2012
Oh ok, that is the VGS (voltage gate to source)

for instance, if a mosfet has a VGS of 20V that means the channel will be completely open at 20V.

This is a quick and extremely informative lesson on mosfets, you should give it a quick look.
http://www.wisc-online.com/Objects/ViewObject.aspx?ID=SSE2202

8. ### plasmaninjaa

5
0
Nov 16, 2012
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?

5
0
Nov 16, 2012
10. ### duke37

5,364
772
Jan 9, 2011
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.

11. ### Harald KappModeratorModerator

12,455
2,984
Nov 17, 2011
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

12. ### BobK

7,682
1,689
Jan 5, 2010
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

13. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,505
2,852
Jan 21, 2010
Nevertheless, it is the method employed by solid state relays.

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

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.

14. ### BobK

7,682
1,689
Jan 5, 2010
But the relay is either on or off. He is talking about a variable control.

Bob

15. ### KrisBlueNZSadly passed away in 2015

8,393
1,272
Nov 28, 2011
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.

16. ### Harald KappModeratorModerator

12,455
2,984
Nov 17, 2011
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

17. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,505
2,852
Jan 21, 2010
And just to reinforce that, I was not suggesting that anything would be used in its linear region. (gsap)