Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Microprocessor controlled light dimmer?

  1. Jan 29, 2009 #1
    Hi folks :smile:

    At the moment I'm rebuilding my room, and now I want to make a programmable, remote controlled light dimmer. The remote isn't my problem.
    I already have a dimmer with a built-in potentiometer. My AVR Mega16 processors output is digital - either 0V or 5V.
    I thought of using a DAC (Digital-Analog Converter), which I will then connect to a MOSFET (i.e. TIP120). Could I just directly replace the potentiometer with a MOSFET which I then control from my micro processor?
    Or isn't it that simple? :biggrin:

    Thanks in advance,
  2. jcsd
  3. Jan 29, 2009 #2
    I'm kinda not clear on what you have and what you don't have. Assuming you want to control it using RF, I would buy an RF rx and tx module on ebay and interface the RX module to your AVR. The RF modules are easy to interface with. When you press "on" on the TX module, the RX module output goes high. Then program your AVR watch for the "high" signal from the RX module and send out the appropriate PWM signal to your mosfet which switches your light.

    It will be relativity complicated if you use DAC to control the brightness of your light instead of PWM.
  4. Jan 29, 2009 #3
    The remote controlling should be no problem receiving, I already programmed this and made the processor understand certain commands from the remote I want to use :smile:

    I'm quite new to this subject, so excuse me for any dumb questions :-) But how would a MOSFET "understand" a PWM signal? Wouldn't it just turn on and off?
  5. Jan 29, 2009 #4
  6. Jan 29, 2009 #5
    Also, nevermind about the GND symbols.
  7. Jan 29, 2009 #6
    Is this AC lighting we are talking about? If it is you can't treat it like you would with a DC LED. A reverse bais mosfet controlled by a PWM is not something you can use to control the voltage or current of a 120VAC light.
  8. Jan 29, 2009 #7


    User Avatar
    Science Advisor

    There's a potentiometer in your dimmer, but that's usually not what controls the brightness. You usually have a thyristor (triac) whose firing angle is controlled based on the potentiometer setting. It is similar to PWM chopping, but you pass, for instance, 40% of the AC wave form through to achieve 40% light (it's not always one to one like this, but I'll use that to illustrate the point).

    There's a nice animation on the Wiki that illustrates what I'm talking about:

    EDIT: And you can use the microprocessor to control the thyristor's firing angle.
    Last edited: Jan 29, 2009
  9. Jan 29, 2009 #8
    The potentiometer controls the triac, the triac controls the firing angle.

    A Mosfet will conduct equally well in both directions. Still, the FET source will tie to Neutral. Either you have to run the control circuit hot, or isolate it with an opto-isolator, for one. Linearity may be a problem. The Fet channel resistance is exponential in the gate-source voltage. You're uController needs to compensate for this. Because it's so nonlinear your uC needs a 16 bit counter, or two in series, or you could do it in software. You can find a uC with a D to A output, or pulse width modulate, then smooth it with a low pass RC arrangement. The FET gate capacitance may serves to some of this purpose.
  10. Jan 29, 2009 #9
    Oh alright, I get the idea. So how would you suggest that I solve my problem best?
  11. Jan 29, 2009 #10
    If this is a one-off use a J8 (edit: your favorite microcontroller) and bias it off the line with a resistor and shunt regulator, I guess. What's your total current burden?
    Last edited: Jan 30, 2009
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook