Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

AC Dimmer Circuit - Microcontroller Controlled

Status
Not open for further replies.

Village_Idiot

New Member
I wanted to run my design by everyone here before I buy the parts; as I still have a lot to learn. The intended use is to control a 1.5kw heater element. I would hope to have very wide range of control with the dimmer.

The basic logic is: H11AA1 to generate zero cross signal --> 555 timer in monostable operation interfaced with digital pot to trigger MOC3022 --> trigger gate of triac.

What type of capacitor should C1 and C3 be ideally and what should the ratings of R7 and R8 be?

Thanks.
 

Attachments

  • dimmer-parts.jpg
    dimmer-parts.jpg
    50.7 KB · Views: 11,828
Last edited:
Hello,


Did you simulate this circuit already or not? It looks a little unusual in that the output may be turned on when you dont intend it to be on. I havent simulated it but it looks suspicious. Does the 555 operate as a monostable? If so, the output may be turned on even when the 555 is not triggered.
 
carmusic: I don't quite understand what you are saying, the load can pretty much be placed anywhere, so long as the triac is wired in series with it. This setup is in accordance with the MOC3022 data sheet.

The main part of this schematic that I would like a second opinion about, is the interface between the H11AA1 - 555 timer -- MOC3022.
 
Mr. Al: I responded earlier today, but I noticed my post never showed up.

I did not simulate the circuit, and have no experience doing so. I will research that further.

About, the output being turned on when the 555 is not triggered; I do not see how this could occur. It is true that with no trigger to the 555, the 555 will sink the power across the MOC3022 causing the triac gate to be continuously triggered. This being said, I cannot fathom a scenario in which the 555 will not be triggered. After all, the 555 is being triggered by the H111AA1, therefore the only time the 555 would not be triggered would be in a case of power outage, or malfunction by the H11AA1.
 
Village_Idiot; Use the 555 as current sorce for the MOC3022. Use the triac on the hot side as well. Andy
 
If the 555 is the current source, immediately when the zero cross signal is given, the 555 will give power to the MOC3022; which will cause the triac to latch. Therefore there will be no possibility of phase angle control.

About, the orientation of the triac, I don't see how the operation of the circuit would be effected either way, though now that I think of it, the orientation you mention is better from a safety standpoint. If the triac were in a state where it wasn't triggering, and I touched load, I would get zapped by my orientation. By orienting HOT->TRIAC->LOAD->NEUT, I would not get zapped.
 
Last edited:
Mr. Al: I responded earlier today, but I noticed my post never showed up.

I did not simulate the circuit, and have no experience doing so. I will research that further.

About, the output being turned on when the 555 is not triggered; I do not see how this could occur. It is true that with no trigger to the 555, the 555 will sink the power across the MOC3022 causing the triac gate to be continuously triggered. This being said, I cannot fathom a scenario in which the 555 will not be triggered. After all, the 555 is being triggered by the H111AA1, therefore the only time the 555 would not be triggered would be in a case of power outage, or malfunction by the H11AA1.

Hello again,


Ok let me see if i understand your intent for this circuit first...

Do you intend to control the output power of the heater or just turn it on and off?
I assumed that you wanted to be able to control how much heat the heater put out as well as turn it on and off as needed.

Assuming that, you will note that the circuit posted so far keeps the trigger input to the 555 low for a long time, yet the 555 requires a low going trigger pulse to operate. You'll also note that on the data sheet for the 555 there is a note and i quote:
"In monostable operation, the trigger should be driven high before the end of timing cycle."
That's not what the circuit posted is doing. What happens when the trigger input is held low for extended periods of time is the output is held high while the timing cap charges up, and after the timing period is over the output is still high, so in effect there is no timing being done there. The trigger has to, as a minimum, be brought back high, but that's just to get the 555 to operate properly. To get the circuit to operate properly there would have to be other changes because of that. We could explore some other changes or additions to the circuit if you like.
Another problem seems to be that the timing network RC is not long enough.
 
Last edited:
The intended use is to control a 1.5kw heater element. I would hope to have very wide range of control with the dimmer.
You will get minimal range of control with your 'dimmer' circuit. If the monostable time is too small (and turns off before the TRIAC has sufficient line voltage to conduct), the load won't turn on. Otherwise the triac will be turned on at the zero-crossing and remain on for the rest of the half cycle; so it will be fully on.

A more conventional dimmer can be seen here: Google Image Result for https://www.circuitstoday.com/wp-content/uploads/2008/04/lamp-dimmer-circuit.JPG
 
Hi dougy,

I dont see the original circuit working at all really, except maybe to keep the triac turned on all the time or something. The circuit you posted is conventional yes, but a bit outdated too. The problem with those kind of circuits is they usually dont allow operation down to the smaller conduction angles so there is a limit on the adjustment from the start. A more modern approach is similar to what the original circuit is like, being able to control the conduction angle from almost 0 to almost full 180 degrees, however a more modern approach should also work in the first place :)


Im going to do a simulation just to see what happens. If the timing cap is made bigger there is a chance this could actually work.

Later:
Ok, it seems that if C2 is increased to 1uf we start to get good operation with the original circuit. Since the input goes high again (assuming it is soon enough) the 555 can operate normally as long as the delay is longer than the period the input trigger is low. Here is a pseudo simulation:
 

Attachments

  • 555_TriacTrigger-01.gif
    555_TriacTrigger-01.gif
    16.4 KB · Views: 922
Last edited:
Oops, I read the circuit wrong (assumed the 555 output drove the MOC when high; didn't notice the MOC was tied to vcc). The circuit should be fine, so long as component values are in the correct ranges...
 
Hello again,

Yes, take a look at my previous post where i posted a quick simulation. It works with C2 around 1uf or a little lower.
 
Last edited:
Oh gosh. Actually the component list in the schematic is wrong. C1 and C2 are flip-flopped. C2 should be 820 nF and C1 should be 10nF. By my calculation 820nF gave about a 9ms max trigger time with a 10 kohm rheostat.

Now I understand why no one understood my circuit! lol.

And yes, Mr. Al this is definitely for phase angle control. Thank you very much for taking the time to review/model it! Another poster asked why I did not use a more conventional circuit; the reason I did not want to do that is because I want to be able to interface this dimmer with a computer, and no digital potentiometer is rated to work at anything CLOSE to AC mains voltage.

Now, Before I order the parts, I was wondering:

1. What type of capacitor should C2 and C3 be.

2. Also what is the minimum resistance I can set the rheostat to? I see lot of schematics with a resistor in series with a rheostat in 555 circuits.

Thanks everyone for the input.
 
Last edited:
Hi again,


Oh that sounds much better now.
The min value for that resistor is probably about 500 ohm, but the worst that could happen is you will turn the pot down lower and lower and get more and more heating effect until you get down to 500 ohms and any lower than that and it wont change anything. The circuit wont be able to trigger any less than that anyway because of the conduction of the two opto LEDs. It could be a bit less than that however, like 300 ohms, because the voltage of the two LEDs come into question a little bit and that's what really determines the min turn on delay. As long as you dont go over the 9ms or so you're ok, because anything greater than 10ms (assuming 50Hz line) will start missing half cycles so you'll get a half wave rectified output which is not a good idea even with just a resistive heater.
The 0.01uf cap can be a regular ceramic disc, while the timing cap depends on how you run the system...
If you do not use feedback from the output back to the controller and you need a good stable heat setting then a silver mica cap would be nice, but if you dont require super stable heat settings then ceramic, or if you monitor the output with some sensor feeding back to the controller then ceramic is good enough too.
 
Last edited:
You raise good points Mr. Al. One thing i overlooked is that the max current of most digipots is rather low (~2.5mA) so that will be my limiting factor. Because of this I am now opting for a 100Kohm/.082uF RC circuit (and a series resistor to ensure the max current is never reached).

One last thing before I order. I would like a way to (via software) stop the triac from ever triggering. With my current circuit I am not sure I will be able to quite achieve this (though I will probably be able to get VERY close). While looking at the data sheet of the Digi-pot I plan to use (MCP4261) i noticed it has a feature where you can disconnect the the A, Wiper or B terminals from the resistor network. Therefore with this I could disconnect the RC timing network from Vcc. I believe this would keep the output of the 555 high indefinitely. I have attached a schematic depicting this operation (notice R5 is disconnected from 5v rail).

Will this work as I intend (keep output of 555 HIGH)?

P.S. Of course there are more straightforward ways of doing this, but what is great about this method is I don't need to waste another output pin on the controller.
 

Attachments

  • dimer-timing.png
    dimer-timing.png
    9.3 KB · Views: 1,927
Hi again,


Yes i see what you mean, but i cant find a leakage spec for the pins you are using so it's hard to say what will happen. One pin looks like it would source some leakage current and the other looks like it will sink some leakage, but again it's very hard to say without some specs on the data sheet. What this means is that you may find you have to connect a 10 megohm resistor across that capacitor in order to keep it discharged when the pot is disconnected, although it is very hard to say what value this will need to be to get this to happen. It could be anything from not needing any resistor to maybe 10 megohms to as low as 1 megohm. You'll have to check though to make sure if you use 1 megohm it doesnt interfere with normal operation of the circuit.

Another idea might be to connect the arm to the upper pot terminal instead of lower, then connect that new resistor to the arm. When powering off and disconnecting the top pin from power, the new resistor, through the arm, will keep the lower part of the resistor conducting at least some current to ground which will keep the cap discharged.
With the top connected for regular operation, the circuit should work normally even with a 1 megohm resistor. As long as the arm and the bottom of the pot still connect to the rest of the circuit when the top part is disconnected this should work ok.
 
Last edited:
P.S. Of course there are more straightforward ways of doing this, but what is great about this method is I don't need to waste another output pin on the controller.
What type of controler are you using? Is it a PIC? Andy
 
Mr. Al. I am glad you considered the current leakage from the digi-pot, I had completely overlooked this. I will first try implementing a resistor across the cap, as you recommended. If that doesn't work well I will use a transistor to ground the DISCH and THRES with each trigger pulse (see first attachment). Your Idea to use the extra terminal of the digi-pot is a good one but I have other plans for that terminal (details follow).

4pyros: That's is a good question...I don't know :) For the time being everything will be controlled via a PC parallel port, which I have used to control other SPI devices. I am not sure which micrcontroller I will eventually end up using because I have no experience with them. The PP has lots of I/O pins, but I try to reduce the number used in my projects wherever reasonably possible, especially because in this case I still haven't designed the temp. feedback circuit. Of course, I feel pretty old fashioned using the PP to control my projects, and have put off buying a micro-controller to play with for a couple of years now. I am leaning to an arduino type controller but all I really want is something that is nearly throw-away (cost wise), I can program in C and can easily interface with the computer for data collection.

Anyways, I have attached a final(ish) schematic, and will go ahead and order everything tonight.
Changes:
1. I opted for the SFH620A-2 for ZC detection b/c it is cheaper than the H11AA1 and has a higher CTR (also less pins to confuse me while I solder, haha).
2. I hooked up the MCP4261 with a transistor which can sink the MOC3022. This will keep the triac latched no matter what, allowing the load to receive nearly the full power of the AC mains (the original design could come close, but would not be able to deliver full power).
3. I changed the values of the RC timing circuit, to R=100K max and C=0.082uF, to reduce current demands on the digipot, and put a series resistor with the digi-pot to ensure no setting would exceed the 2.5 mA max current.
4. I implemented a circuit which allows the MCP4261 to float the RC timing circuit, as well as showed the optional bleeder resistor across the timing cap. This was all to implement a completely off feature.

Looks good? I'll report back when I get this thing built.
 

Attachments

  • missing-pulse.png
    missing-pulse.png
    58.6 KB · Views: 873
  • dimmer-revised.png
    dimmer-revised.png
    69.4 KB · Views: 2,619
Last edited:
I am leaning to an arduino type controller but all I really want is something that is nearly throw-away (cost wise), I can program in C and can easily interface with the computer for data collection.
You can look into PICaxes thay can replace the 555 and the digipot in this circuit and control the dimming better. Good luck with this project and have fun. Andy
 
update

I am going to resurrect a pretty old thread here. I was helping a friend with a project, and had to email him some schematics of my AC dimmer circuit; I figured I would post them here as well.

I tried to get the circuit working as discussed previously, with the 555 timers, but couldn't get it working. Then I tried things out using an arduino, at first the circuit didn't work either. The problem was, too much current was being delivered to the SFH620A-2 (optocoupled-transistor) so the zero-cross was never being detected. By doing some experimentation, I was able to find a nice current to give to the SFH620A-2 such that sharp zero-crosses were detected.

I never got around to re-integrating my 555 timing circuit, but the microcontroller circuit is nice (although, 3 dimmer channels is the max you can go, before the lights connected start flickering while receiving serial inputs).

While the schematic I have attached seems pretty simple, I think it is SOOO much better than the more common H11AA1 ZC circuits, because they generally require currents of ~4ma (.5W) to get good zero cross; this zero cross circuit uses only 0.35ma (0.04W)! I can get good dimming between 3.5-120v with this circuit, with no flicker.

Code:
//This program allows digital dimming of AC resisitive loads.  It has two dimming channels,
//which share a common zero-cross detector.  Power levels are set by 2 byte serial inputs,
//the first byte controlling channel0 the second byte controlling channel1.  A key feature
//of this program is a nearly linear relationship between byte input and dimmer output voltage.
//Thus the output voltage from an input byte of 63 is about 50% of that from an input of 127
//etc.


//Initialize zc and triac pins
const int zc = 8;
const int triac0 = 9;
const int triac1 = 10;

unsigned long trigger0; //trigger0 is the time the triac0 will be triggered
unsigned long trigger1;
unsigned long epoch;    //Time of last zero cross
unsigned long now;      //ca. current time
unsigned long delay0 = 7500; //This ensures that, until first serial input is recieved,
unsigned long delay1 = 7500; //power to load is essentially off 
unsigned short byte2microsec[]={8333.3886729122842, 8001.597423429539, 7863.8580842646543, 7757.9562806851836, 7668.4994629994653, 7589.52948065694, 7517.9925604055315, 7452.0757200753233, 7390.5983933087982, 7332.7410209745321, 7277.9072147096867, 7225.6469885375391, 7175.6109272900385, 7127.5212965621176, 7081.1530170752394, 7036.3206753543082, 6992.8693833325297, 6950.6681786914987, 6909.605152795405, 6869.5837837973704, 6830.5201295068127, 6792.3406458278387, 6754.9804684199426, 6718.3820427867295, 6682.494020171237, 6647.2703588340928, 6612.6695858796284, 6578.6541859203016, 6545.1900909265651, 6512.2462515231045, 6479.7942743868625, 6447.8081137053123, 6416.2638071624187, 6385.139248844258, 6354.4139929459352, 6324.069083324548, 6294.0869048580216, 6264.4510532952891, 6235.1462208625217, 6206.1580953556395, 6177.4732708257761, 6149.0791682706213, 6120.9639649949713, 6093.1165315097933, 6065.5263750092727, 6038.1835886066365, 6011.0788056273659, 5984.2031583571434, 5957.5482407249128, 5931.1060744715069, 5904.8690784137416, 5878.8300404643996, 5852.982092111637, 5827.3186850983166, 5801.8335700734624, 5776.5207770153838, 5751.3745972495981, 5726.3895669052072, 5701.5604516710937, 5676.8822327288426, 5652.3500937527742, 5627.9594088793683, 5603.7057315586735, 5579.584784209499, 5555.5924486081904, 5531.7247569479077, 5507.9778835116367, 5484.3481369076999, 5460.8319528215243, 5437.4258872418095, 5414.1266101231877, 5390.9308994509393, 5367.8356356765325, 5344.8377964954861, 5321.93445194166, 5299.1227597742782, 5276.3999611360859, 5253.7633764628372, 5231.2104016260037, 5208.7385042920896, 5186.3452204832747, 5164.028151325374, 5141.7849599701922, 5119.613368680386, 5097.5111560658443, 5075.4761544614757, 5053.5062474370134, 5031.5993674301899, 5009.7534934952391, 4987.9666491592861, 4966.2369003797103, 4944.5623535960658, 4922.9411538705772, 4901.371483111654, 4879.8515583752451, 4858.3796302391829, 4836.9539812460207, 4815.5729244101149, 4794.23480178503, 4772.937983087535, 4751.6808643747454, 4730.461866771122, 4709.2794352422943, 4688.1320374127972, 4667.0181624250199, 4645.9363198367964, 4624.8850385552241, 4603.8628658044163, 4582.8683661250179, 4561.9001204034394, 4540.9567249288466, 4520.0367904760551, 4499.1389414125533, 4478.2618148279798, 4457.4040596844243, 4436.5643359860214, 4415.7413139663404, 4394.9336732921665, 4374.140102282272, 4353.3592971398793, 4332.5899611975155, 4311.8308041730188, 4291.0805414354863, 4270.3378932799915, 4249.6015842099041, 4228.870342225694, 4208.142898119112, 4187.4179847716405, 4166.6943364561421, 4145.9706881406446, 4125.2457747931721, 4104.5183306865911, 4083.7870887023819, 4063.0507796322941, 4042.3081314767992, 4021.5578687392672, 4000.7987117147695, 3980.0293757724057, 3959.2485706300131, 3938.454999620119, 3917.6473589459442, 3896.8243369262646, 3875.9846132278603, 3855.1268580843057, 3834.2497314997327, 3813.3518824362309, 3792.4319479834385, 3771.4885525088462, 3750.5203067872671, 3729.5258071078688, 3708.5036343570605, 3687.4523530754891, 3666.3705104872661, 3645.2566354994883, 3624.1092376699917, 3602.926806141164, 3581.7078085375401, 3560.4506898247496, 3539.1538711272556, 3517.8157485021707, 3496.4346916662648, 3475.0090426731017, 3453.5371145370405, 3432.0171898006311, 3410.4475190417083, 3388.8263193162188, 3367.1517725325748, 3345.4220237529994, 3323.6351794170464, 3301.7893054820952, 3279.8824254752722, 3257.9125184508093, 3235.8775168464408, 3213.7753042319, 3191.6037129420934, 3169.360521586912, 3147.0434524290108, 3124.650168620195, 3102.178271286281, 3079.6252964494479, 3056.9887117761991, 3034.2659131380065, 3011.4542209706256, 2988.5508764167989, 2965.5530372357534, 2942.4577734613463, 2919.2620627890988, 2895.962785670476, 2872.5567200907617, 2849.0405360045856, 2825.4107894006484, 2801.6639159643773, 2777.7962243040952, 2753.803888702786, 2729.682941353612, 2705.4292640329172, 2681.0385791595113, 2656.5064401834434, 2631.8282212411909, 2606.9991060070779, 2582.014075662687, 2556.8678958969012, 2531.5551028388222, 2506.0699878139694, 2480.4065808006485, 2454.5586324478854, 2428.5195944985435, 2402.2825984407791, 2375.8404321873727, 2349.1855145551417, 2322.3098672849196, 2295.2050843056486, 2267.8622979030124, 2240.2721414024918, 2212.4247079173133, 2184.3095046416638, 2155.9154020865094, 2127.2305775566456, 2098.242452049763, 2068.9376196169969, 2039.3017680542644, 2009.319589587737, 1978.9746799663499, 1948.2494240680278, 1917.1248657498663, 1885.5805592069737, 1853.5943985254223, 1821.1424213891803, 1788.1985819857202, 1754.7344869919832, 1720.7190870326565, 1686.1183140781927, 1650.8946527410476, 1615.0066301255563, 1578.4082044923432, 1541.0480270844459, 1502.8685434054719, 1463.8048891149153, 1423.7835201168796, 1382.7204942207857, 1340.5192895797557, 1297.0679975579774, 1252.2356558370457, 1205.8673763501677, 1157.7777456222468, 1107.741684374746, 1055.481458202599, 1000.6476519377538, 942.79027960348685, 881.31295283696249, 815.39611250675364, 743.8591922553461, 664.88920991282055, 575.4323922271011, 469.53058864763085, 331.79124948274608};
                            // ^^ is a lookup table it has 256 entries, entry 0 is the delay time for 0% power
                            //entry 127 is delay time for 50% power and entry 255 is delay time for 100% power
                            //see the byte2ms function in python code to see how this lookup table was calculated
void setup() {
  pinMode(zc,INPUT);
  pinMode(triac0,OUTPUT); 
  pinMode(triac1,OUTPUT); 
                        //next 2 lines set triac0 and 1 to off; remember, data pins SINK optotriacs
  digitalWrite(triac0,HIGH);
  digitalWrite(triac1,HIGH);
  Serial.begin(115200); //initialize serial, high baud rate is REQUIRED for relaiable operation
}

void loop() {
  if (Serial.available() > 0) {  //if a new serial command is available....do stuff
    delay0 = byte2microsec[Serial.read()];  //computer will send 2 bytes; first byte --> triac0 power
    delayMicroseconds(75);                            //this delay gives time for serial buffer to fill with next byte 
                                                      //If baud rate is low second byte is unreliably read b/c buffer
                                                      //does not have time to be updated
    delay1 = byte2microsec[Serial.read()];  //second byte is triac1 power.  Delay is simply taken from the lookup table
                                            //delay is in microseconds                                              
    //Serial.flush();                       //Not necissary if all bytes are read from buffer
    //Serial.print(delay0);                 //these functions are useful for debugging serial communications
    //Serial.println(delay1);               //but cause poor operation of dimmer b/c serial writes take a long time 
  } 
  if(digitalRead(zc) == LOW) {  //if True, we are at zero cross
    epoch = micros();           //epoch is the time at zero cross
    trigger0 = epoch + delay0;  //trigger0 is the time the triac0 will be triggered
    trigger1 = epoch + delay1;  //trigger1 "" triac1 ""
    unsigned int repeat[] = {1,1}; //This is for the while loop; a 1 indicates the triac hasn't been triggered
                                   //triac0 is first value of list triac1 is second
    while (repeat[0]+repeat[1] > 0) { //while loop is exited when repeat[] = {0,0}
      now = micros();                 //this is current time
      if (now >= trigger0 and repeat[0] == 1) {  //To satisfy, we must be after time trigger0 
                                                 //AND triac0 must not have been triggered in this current half cycle
    
        digitalWrite(triac0,LOW);  //triac0 is triggered; this has been shown to be nearly instantanious, 
                                   //no delay is needed to ensure the triac latches; it always does 
        repeat[0] = 0;             //set repeat[0] to 0 indicating to the while loop that triac0 has triggered in this cycle  
        digitalWrite(triac0,HIGH); //stop triggering the triac, it has latched for the rest of this half wave
      }
      if (now >= trigger1 and repeat[1] == 1) { //like the previous if statement just everything for triac1
        digitalWrite(triac1,LOW);
        repeat[1] = 0;
        digitalWrite(triac1,HIGH);
      }
    }
  }
}
 

Attachments

  • Arduino_dimmer.png
    Arduino_dimmer.png
    94 KB · Views: 1,697
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top