Go Down

Topic: dimmer circuit idea for ac? (Read 2414 times) previous topic - next topic

I'm almost sure this won't work because someone would have done this before, so I guess I'm mostly asking WHY this wouldn't work..

I've been looking at ways to dim lights with an arduino. It is rediculously complicated (especially for someone like me who is new to electronics) using a triac and zero volt detection and stuff.

And I was also looking at using a mosfet to control them, until I learned that a mosfet will only work with AC.

So I was thinking, what if I had ac mains converted to  dc power (transformed, rectified, and smoothed) ran the dc through a mosfet controled by the arduino (so now I have the dc variable power) and then ran that through an inverter. So the inverter output will be variable because it is getting variable dc input from the mosfet.

What am I missing here? Is there any chance of something like this working?

Runaway Pancake

How would all of that be less "rediculously complicated" than "using a triac and zero volt detection and stuff"?

http://arduino.cc/forum/index.php/topic,134127.0.html
http://arduino.cc/forum/index.php/topic,133921.0.html
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"


How would all of that be less "rediculously complicated" than "using a triac and zero volt detection and stuff"?

http://arduino.cc/forum/index.php/topic,134127.0.html
http://arduino.cc/forum/index.php/topic,133921.0.html


Well I just think triacs and zero volt detection is pretty complicated for people like me who are new to electronics and coding.
My idea only uses 3 simple main parts that are easy to understand their function.
As for the coding, I don't understand at all the coding involved with zero volt detection and then how to send that into a triac etc.
Where as with my idea, the only coding involved is sending variable voltage to the pin of the mosfet
I.e. digitalWrite(pin, output value from 0-255);

Also,  I am using this to dim led christmas lights, so I don't know how well that will work with a triac.

Ill take a look at those links, but in the meantime, could someone shed some light on if my idea has any potential of working?

Runaway Pancake

First, PWM out is not "variable DC" - it is chopped DC.
PWM'ing a MOSFET (viz analogWrite) as the input of an inverter won't result a variable AC output from the inverter.
It's possible that a truly variable DC, within limits, as the input of an inverter might result a varying AC output from the inverter, within limits.

Maybe you should look into X10.  That's Arduino-able. I know that the "lamp dimmer" modules can dim "LED light" strings in 8 (or is it 16?) levels.
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

DVDdoug

Quote
So I was thinking, what if I had ac mains converted to  dc power (transformed, rectified, and smoothed) ran the dc through a mosfet controled by the arduino (so now I have the dc variable power) and then ran that through an inverter. So the inverter output will be variable because it is getting variable dc input from the mosfet.
Full-wave rectified AC through the PWM-driven MOSFET would probably work.   There should be no need for "transforming", "smoothing", or "inverting".   (You will loose a couple of volts across the full-wave rectifier.)

However, you do need to isolate the MOSFET (and the other high voltage stuff) from the Arduino (and yourself!) with an opto-isolator.    And remember, the peak AC voltage is about 1.4 times the RMS voltage.  So make sure your MOSFET and the high-voltage side (output-side) of your opto-isolator can withstand the applied voltage.

I have made a 2-position  dimmer switch for regular 120VAC incandescent lamps with a half-wave rectifier, but I've never tried making a full-range PWM "AC" dimmer.   I don't remember if I've ever connected a lamp to a full-wave rectifier, but there's no reason it won't work.   Of course, these ideas will NOT work with fluorescent lights, or with most AC LED lights which actually require AC (but a regular phase-controlled dimmer wont work with these either).

MarkT


Quote
So I was thinking, what if I had ac mains converted to  dc power (transformed, rectified, and smoothed) ran the dc through a mosfet controled by the arduino (so now I have the dc variable power) and then ran that through an inverter. So the inverter output will be variable because it is getting variable dc input from the mosfet.
Full-wave rectified AC through the PWM-driven MOSFET would probably work.   There should be no need for "transforming", "smoothing", or "inverting".   (You will loose a couple of volts across the full-wave rectifier.)



It could be made to work, it would act as an extremely power source of radio frequency interference and solving that would be more complicated than using a standard solution, a zero-crossing dimmer IC driving a triac.
[ I won't respond to messages, use the forum please ]

#6
Nov 27, 2012, 12:33 am Last Edit: Nov 27, 2012, 12:45 am by Coding Badly Reason: 1

Quote


It could be made to work, it would act as an extremely power source of radio frequency interference and solving that would be more complicated than using a standard solution, a zero-crossing dimmer IC driving a triac.


is there an easy to follow instruction guide that you know of to do this? This would be what I want to do: http://www.youtube.com/watch?v=ztXRjyCQxlE&feature=plcp (but only needing to control 1 light)
but some things in this video confuse me such as any of the coding, and pin connections

Runaway Pancake


Of course, these ideas will NOT work ... with most AC LED lights which actually require AC (but a regular phase-controlled dimmer wont work with these either).


That's interesting. 
My lamps work great, then I tried the two different LEDstrings I have with my dimmer and they were kind of sucky.
I tried them with my X10 and they go on/off OK with a Socket Rocket and an Appliance Mod, but they balked at "full intensity" from the Dimmer module - my dimmer's results were better.

I suspect a couple of issues, with my dimmer:
1) a very narrow range of adjustment, of the conduction angle, before the LEDs cut out.  My dimmer, with lamps, goes from 90-150 deg., and a 40W lamp isn't so bright at 90 where the LEDs were pretty much extinguished
2) there's holding current (below which the TRIAC will cut out irrespective) and LED strings' low current probably forces an early drop out, too
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

redlazer

I have this exact same problem - no easy solution yet, unless you're willing to buy something.

Check out the PowertailSSR I think it's called - you plug something into it like normal, then wire the Arduino into the SSR (solid state relay), and bam, there you go.

I might do it, but I wanted a do-it-yourself solution, so I've stalled while I work out the colour-changing LED lights - I think a coloured dawn might be neater. But I'm going to try be doing the AC version again too - it's just too handy being able to work with AC and DC.

For what it's worth, I think the triac's and Opto-Isolator is the next best solution, and probably what I'll do.

The guy at the electronics shop also told me that, since I'm just trying to dim an incandescent light bulb, I could also just run it with high-voltage DC, which is also something I'm considering, although it seems more practical to learn how to use TRIACS and Opto-Isolator. Opto-Isolator is also the coolest idea ever, so it has that going for it.

Good luck!

Runaway Pancake

#9
Nov 27, 2012, 04:11 am Last Edit: Nov 29, 2012, 03:11 am by Runaway Pancake Reason: 1
OK, more experiment news!
I ran the 40W with a string of LEDlights and had much better results (with both my dimmer and the X10 dimmer).
So, it's the holding current (aforementioned); the 40W draws enough current to keep the TRIAC satisfied.
[Maybe three or four strings together would draw enough to keep the TRIAC happy, the two I have didn't cut the mustard, but the lamp seals the deal.]

Powertail... Yes, I couldn't remember, thinking what was it "free tail" or "zero tail".  (:
I don't know how well that works with the holiday lights.

> > > PowerSwitch Tail. 
Guess what?
What?
They can't do fading.  And they're $26
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Runaway Pancake

#10
Nov 28, 2012, 01:29 am Last Edit: Dec 01, 2012, 01:54 am by Runaway Pancake Reason: 1
So, I had a "great" idea this morning to get around the TRIAC and the holding current.
I couldn't wait to get home to try it out.
What's the deal?
Don't use the TRIAC!    :)
Just use the triac driver.  It can handle the low current demand of one LEDlight string.  Don't push it; it's one each.
And works pretty good it does, I must say.
Before anyone gets too excited, it still needs a zero-cross reference (see my blog.)
And it can't be triggered on like a TRIAC, the logic input must be kept active throughout.
So, I still delay from the zero-cross then I turn on the MOC3023 and hold that for nearly all of the alternation.  Then it goes back and waits for another zero-cross.

Here's the modification

See more at my blog
http://incredulist.blogspot.com/2012/11/ac-phase-control-triacs.html

Here's the youtube demo:
http://www.youtube.com/watch?v=nce830WBTjM

Here's my coarse fading sketch:
Code: [Select]

//   MOC3023_HolidayFade_02
//   re-write, using better names
//   and derived from
//   ***  Triac_03  ***
//   running one light string
//   directly from the
//   output of the MOC3023
//   This works better
//   no TRIAC holding current

byte MOC_logic = 3;  // alias output
byte Intensity;      // conduction angle
byte startPosition;  // delay time till start
int index = 0;
volatile boolean zeroCrossed = false;  // Flag

void setup()
{
 pinMode(MOC_logic, OUTPUT);
 attachInterrupt(0,cueStart,RISING); // Ext_Int on D2
}

// ***** ***** ***** ***** //
void loop ()
{
 if (zeroCrossed == true)
 {
   enableOutput();
 }
}
// ***** ***** ***** ***** //

// ----- The Interrupt -----
void cueStart ()
{
 zeroCrossed = true;   //  !!!
}
// ---- ---- ---- ---- -----
// ---- ---- ---- ---- -----
void enableOutput ()
{
 fade();
 startPosition = (8 - Intensity); // "delay angle"
 // startPosition + Intensity must = 8 (8 msec)
 // because ea. alternation of 60 Hz is 8.333 msec
 // haven't looked at this on the scope yet
 // maybe using delayMicroseconds could drag the end
 // of Intensity closer to the end of the half-cycle
 // what's unknown is "instruction time" usage
 delay (startPosition);
 digitalWrite(MOC_logic, HIGH);  
 delay (Intensity);               // "conduction angle"
 digitalWrite(MOC_logic, LOW);
 zeroCrossed = false;  // Reset
 index ++;
 if (index > 240)
 {
   index = 0;
 }
}
// ---- ---- ---- ----
void fade ()
{
 // not a lot of difference between
 // Intensity = 6 and Intensity = 7
 if (index < 30)
 {
   Intensity = 6;
 }
 else if ((index >= 30) && (index < 60))
 {
   Intensity = 5;
 }    
 else if ((index >= 60) && (index < 90))
 {
   Intensity = 4;
 }  
 else if ((index >= 90) && (index < 120))
 {
   Intensity = 3;
 }
 else if ((index >= 120) && (index < 150))
 {
   Intensity = 2;
 }
 // Intensity = 1 is very low
 // fade up  
 else if ((index >= 150) && (index < 180))
 {
   Intensity = 3;
 }  
 else if ((index >= 180) && (index < 210))
 {
   Intensity = 4;
 }
 else
 {
   Intensity = 5;
 }
}

I'm sure that it could be made smoother by using delayMicroseconds or incorporating millis().
When you guys work that out, please post about it here.

Hey, people, please keep your wits about you and respect the power of the juice always!

> > > Came back and took some lines out, vestigials from my original (TRIAC-rel'd) code.
> > > Modified circuit to direct connect Neutral to socket and bring in Line through 3023
> > > No Replies.  Bummer, Dude.

> > > 30NOV2012 New & improved code, with up/down fade.  New youtube demo.
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Runaway Pancake

I got out my TRIAC circuit and ran it with the sketch above and it worked great.
One low current, same as in the latest demo.
The difference is that it keeps the Gate on throughout the conduction angle, dropping out just before the alternation ends; it does not merely trigger (pulse) the Gate at the beginning of the conduction angle.
A TRIAC can handle more current, so you can do more strings (or bundles, or strands, or whatever you've got.)

http://incredulist.blogspot.com/2012/11/ac-phase-control-triacs.html
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Runaway Pancake

#12
Dec 01, 2012, 05:13 am Last Edit: Dec 01, 2012, 05:21 am by Runaway Pancake Reason: 1

I got out my TRIAC circuit and ran it with the sketch above and it worked great.
One low current, same as in the latest demo.


> > > I have to walk that back some.  I had put the scope away, but I decided to bring it back out and have a look.  Despite improved fading over the way it was before, I saw on the scope that it was only conducting on one alternation, asymmetrical.  Then I plugged the 40W lamp in with it and it looked even better than with the MOC3023.  It's totally textbook with the lamp plugged into it.
So, one "strand" isn't enough to do it with the TRIAC.  My strand takes 20ma.  My TRIAC's (BCR8N) holding and trigger current are both 100ma, which means a load of at least 12w (ballpark). Maybe 5 would do it to it, but I don't have that many to confirm.
Still, the MOC3023's aren't a bad way to go for this application.
"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

Go Up