Sunday, May 15, 2011

Automatic night light circuits

I've been googling and the half dozen designs or so of automatic night light circuits I've seen have been very basic--low parts count and usually use only discrete transistors--and, more critically, are prone to at least two conditions:

1. "Chattering", whereby when ambient light level is at or is crossing the trip point for the load switching, the relay/load can rapidly turn on and off, the reason being that there’s no hysteresis built into the circuit. Hysteresis in this case means that the ambient light level at which the load is turned on is slightly lower than the level at which it is switched off. This difference in trip points eliminates any oscillations when the trip point is crossed, specially considering that sunlight / sky light level increase/decrease extremely slowly relative to electronic switching speeds.

2. A transient, high amplitude and fast rising/falling ambient light level will make the circuit switch the load on/off (depending on whether the light level change is positive or negative). For example, at night, lightning and head lamps of passing vehicles can fool the circuit into interpreting the brightness as indicative of daytime and turn off the load for the duration of the high ambient light level. In light of this (pun intended), there’s a need for a low pass filter so that the circuit rejects such transients. An RC network of sorts will thus be necessary.

The very first viable automatic night light switch (ANLS) I designed back in 2002 already incorporated both these features. That is, it had hysteresis and a low pass filter. The circuit is based on a quad NOR CMOS IC, with two of the gates configured as an RS flip flop. Another gate is used an inverter and the other hooked up to the output of the flip flop and functions as an inverter buffer. NAND gates would function just as well. I chose NOR because they were slightly cheaper. All circuits that I've installed (controlling the perimeter lights of my home) which use this flip flop design employ NOR gates.

I used CMOS instead of TTL for the very important reason that CMOS gates have very high input impedance [Note 1]. Given that the LDR voltage divider will have a very high impedance (Mohms) it is necessary that the gate not load it down. The essentially open circuit of CMOS inputs accomplishes this well. CMOS also has an elegant feature--its output changes state when the voltage at the input is exactly half the supply voltage [Note 2]. This makes designing and calculation of the voltage divider a breeze.

In 2003 I wrote a couple of papers documenting the circuit. I'm reproducing both below with slight editing.


1. "The inputs to all [CMOS] devices are open circuits." (Lancaster, D., and H. M. Berlin. CMOS Cookbook. 2ed. Indianapolis,Ind.: Howard W. Sams, 1988. p.11.)

2. "The output of the [CMOS] inverter will change state whenever Va [voltage of the voltage divider] crosses the (V+)/2 point [V+ = Vdd]." (Carr, Joseph J.. IC User's Casebook. Indianapolis, Ind. USA: Howard W. Sams, 1988. p.235.) "The logic changes from high to low exacly halfway up to the supply voltage." (Lancaster p.11.)


Design of Ambient Light Activated Switches
January 2003

The following document describes the operation of a circuit first designed in May 2001 as well as derivatives of that circuit. All the circuits are designed to switch a load on when ambient light condition drops to a certain level, and turn off the load when light condition rises to a certain level. The level at which switching occurs is variable. The circuits can be used to automatically switch on outdoor lights at dusk and switch them off at dawn.


CMOS 2-input NAND or NOR gates are used to create a simple RS latch and inverters. Two gates are used as voltage comparators whose outputs toggle high or low. CMOS gates (CD4000 series) are inherently referenced to 50% of supply voltage such that an input greater than 50% of supply is interpreted as a high, while an input less than 50% is detected as a low.

By using a light dependent resistor (LDR) in series with fixed value resistors a voltage divider can be formed. Since the resistance of an LDR varies in proportion to incident light, we set up the resistor network such that LDR resistance will be 50% of total series resistance at the light level at which the load should be switched on.

To create a practical circuit and one wherein the RS latch does not enter into oscillation, we build hysteresis into the circuit by setting the switch-on light level to be different from the switch-off level. This can be accomplished by adding a small resistance in series with the LDR so that switch-off resistance value (and, therefore, voltage value) is greater than for switch-on.

The only feasible simple circuit with hysteresis is one that turns the load on when ambient light level drops to less than L and can only be turned off when light level becomes greater than L. The difference between these two light levels is the hysteresis band. A representation of the hysteresis curve is given below. Assuming load is off the circuit will switch it on only when light level drops to Lon and thereafter will be on as light level decreases further. When light level increases load will not be switched off until ambient conditions reaches point Loff after which the load will remain off as long as light level does not drop below Lon. It is not possible to build a simple circuit wherein the load is switched on a certain light level and then switched off at an even darker condition.

Below is a basic sense and control circuit of a light activated switch using CMOS gates (NOR gates in this case). A voltage divider network formed by reference resistance RR, hysteresis resistance Rh, and LDR.

Given the above voltage divider, reset point is given by the equation:

V_{off} = \frac {R_h + R_L} {R_R + R_h + R_L} > 0.5


RR = Reference resistance
Rh = Hysteresis resistance
RL = LDR resistance

But because of NOR.a is configured as an inverter, NOR.b actually senses a low when Voff is greater than 50% voltage.

Set point is the voltage at which the load is turned on and is given by:

V_{on} = \frac {R_L} {R_R + R_h + R_L} > 0.5

Because of inverter NOR.a set input of the latch will be low when reset input is high and vice versa, except when ambient light conditions fall within the hysteresis band. In that transition period both inputs will be low. Thus, the latch outputs will be locked and cannot change.

By increasing the value of Rh the difference between light level at which the circuit turns on and off increases, i.e., the hysteresis band widens. However, this also means that the load will be switched off at higher ambient light conditions. Because of this Rh would be, for practical purposes, less than 10% of RR, with a value between 1% to 5% being sufficient.

By increasing RR the circuit is forced to turn on at darker ambient condition. For outdoor ambient lighting detection RR may take on a value between 500K to 1Mohm given the particular LDR used. Other types of LDRs may necessitate different RR values. By using a variable resistor, field adjustment of the circuit is possible.

IMPORTANT: RR should be such that ambient light has not reached its minimum level, else the circuit will become too sensitive to slight increases in ambient conditions (even with Rh) which may then trigger the circuit to turn off the load.

One important consideration in building a practical outdoor ambient light-activated switch is the occasional occurrence of large and abrupt but transient variations in light level. For instance, such phenomena as lightning may trigger the circuit to turn on for the duration of the lightning flash and then turn off again immediately thereafter. It is, therefore, necessary to shield the circuit by adding an RC network to buffer such changes. This is the purpose of capacitor C3 in the circuit below. C3 is charged via RR and remains at a voltage level determined by Rh + RL. As LDR resistance varies with light level C3 charges/discharges. When light condition changes gradually (the normal state) C3 charges/discharges only by a small amount and so voltage across C3 follows that across Rh + RL nearly instantaneously. But during an abrupt change--say, LDR resistance changes by a factor of 10 or more in a fraction of a second--voltage across C3 will not immediately drop or increase. There will be a time lag before voltage across C3 will settle. This lag prevents the voltage at NOR.a input from changing immediately.

The problem with the above design is that it creates a much greater time lag for the load to be turned on again than for it to be turned off. Thus, during, for instance, a lightning flash at night, LDR will drop to a low value such that LDR + Rh resistance will be a fraction of RR. This means that capacitor discharge RC time is shorter than charging RC time. Yet what we require is for discharge time to be significant to prevent the circuit from reacting to sudden increases in ambient light level.

To remedy this lopsided (and undesirable) response/performance of our circuit we need to find a way to increase the amount of resistance through which C3 is discharged without affecting the voltage divider and without increasing (if possible) the resistance through which C3 is charged. This can be accomplished by using the setup below.

A resistor and a signal diode in parallel have been added. In this arrangement C3 is charged via RR but discharges through Rd + Rh + RL. Hence, the minimum resistance by which C3 can discharge is Rd + Rh. By simply increasing Rd we can "desensitize" our circuit to large, abrupt and transient increases in light level however much we want to.

Here is how the circuit works:

When light level has settled C3 is neither charged nor discharged. When light level decreases C3 is charged via RR. Because of diode D2 Rd is shunted. Therefore, the time for C3 to charge is a function of RRC3. When light level increases LDR resistance decreases forcing C3 to discharge. In this case D2 is reverse biased and so C3 discharges via Rd. The discharge time is a function of (Rd+Rh+RL)C3.

When there is a sudden increase in ambient light conditions LDR will dip to a very low resistance level. Without Rd capacitor discharge would be very fast since the only resistance left would be Rh; hence, the load will be turned off soon thereafter if ambient condition does not return to "normal" quick enough. Without Rd and with C3 = 100uF load turn off occurs within a second or two when light level condition varies from very dark to very bright. By choosing Rd to be approximately equal to RR the charge and discharge times of C3 can be made roughly equal. Or by making Rd very large the circuit can be made insensitive to ambient conditions suddenly getting very bright for a long period of time. For example, given C3 = 47uF and Rd = 1Mohm and a sudden transition from near total darkness to midday light level, tests show that the circuit will not turn off the load until after around 30 seconds of continual exposure to the light source. With such capacitor and resistor values the circuit will be totally immune to false turn-offs even during the severest lightning storms.

While the circuit above uses NOR gates, NAND gates may also be employed to the same end. When using NOR gates the inputs to the RS latch must both be low when within the hysteresis band. In a NAND-based circuit on the other hand both must be high when ambient light conditions are within the dead band. These conditions are necessary for these two respective latches to operate properly. Inputs to a NOR latch cannot both be high simultaneously, while inputs to a NAND latch cannot both be low at the same time. In the circuit above such a condition cannot arise because of NOR.a inverter and Rh.

Operation of NOR-Based Circuit

The operation of the NOR-based switch has been covered in detail above. To recapitulate: RR, Rh and RL form a resistor network and, hence, a voltage divider. NOR.a is used as an inverter. NOR.b and NOR.c gates form an RS latch. Assume that output of NOR.b is initially low (load is off). When light level falls such that LDR resistance is just over 50% of RR+Rh+RL (= Rtotal) NOR.c output goes low and forces NOR.b to output high, thus turning the load on. NOR.b output will remain high as light levels decrease. Thereafter, when ambient light level begins increasing LDR resistance will decrease to below 50% of Rtotal. Output of NOR.b, however, will not go low until Rh+RL goes below 50%. Therefore, a higher light level is necessary for load turn-off than for load turn-on. This hysteresis is necessary to avoid latch race conditions and to prevent rapid switch on-off of load during the 50% mark crossover.

Operation of NAND-Based Circuit

A NAND-based switch is analogous to a NOR-based circuit but a NAND latch needs low inputs to force output latch high, while race condition occurs when both inputs are low simultaneously. Because of these characteristics the inverter is connected to the LDR instead and output is drawn from NAND.c when an NPN transistor is used (output of NAND.b can be used if a PNP transistor is used).

In the circuit below RR, Rh and RL form a resistor network and, hence, a voltage divider. NAND.a is used as an inverter. NAND.b and NAND.c gates form an RS latch. Assume that output of NAND.c is initially low (load is off). When light level falls such that LDR resistance is just over 50% of RR+Rh+RL (= Rtotal) NAND.a output goes low and so NAND.c output goes high, thus turning the load on. NAND.c output will remain high as light levels decrease. Thereafter, when ambient light level begins increasing LDR resistance will decrease to below 50% of Rtotal. Output of NAND.b, however, will not go high until Rh+RL goes below 50%. Therefore, a higher light level is necessary for load turn-off than for load turn-on.

Load Switching

Output of either NAND or NOR gate based circuit is used to turn on a transistor which then triggers a triac to turn on. Attention should be paid to the required gate trigger current of the particular triac used. Enough current should be delivered to the triac gate to assure full switch-on of the triac even in the 4th quadrant which usually requires a much higher gate current. Transistor should be a high gain type so as not to unduly load the CMOS gate if output is obtained from one of the gates that form the latch.

One important consideration when using triacs is the quadrants in which the triac will be operating (see diagram below). With triac optocouplers the triac is triggered by alternating positive and negative currents. This is called "in-phase triggering" since gate polarity with respect to MT1 always follows that of MT2 polarity vs. MT1. Therefore, the triac operates in Quadrants 1 and 3.

With DC triggering, gate voltage with respect to MT1 will either be always positive or always negative. If positive, the triac will be operating in Quadrants 1 and 4. If gate to MT1 voltage is always negative then triac will be working in Quadrants 2 and 3. In other words, when the gate is sourcing current (trigger current always flows from gate to MT1) then the triac is operating in Quadrants 1 and 4. When the gate is sinking current (current flows the more positive MT1 to gate) then the triac is operating in Quadrants 2 and 3.

We can design our ambient light-activated switch to trigger the triac with either positive or negative DC gate current. The circuits below show how an NPN and a PNP transistor can trigger a triac given a logic high or low respectively. With a logic high the collector to emitter junction of the NPN transistor conducts and triggers the triac. With a logic low the emitter to collector junction of the PNP transistor conducts and triggers the triac. Because the gate in either configuration is always positive with respect to MT1 the triac in both circuits will be operating in Quadrants 1 and 4.

According to Teccor's data sheet its Q401E3 1A 400VAC triac needs typically 50mA for Quadrant 4 operation. Our transistor must thus be able to source at least this much current, preferably more. In the circuit S9013 and S9012 transistors are assumed to have an hFE of 100 at collector currents less than 100mA. Therefore, a minimum base current of 0.5mA is required for collector to source at least 50mA. R1 is chosen to provide this minimum base current. R2 on the other hand limits the actual current that is fed to the triac gate.

Because triacs require substantially greater gate current in Quadrant 4 it is best to operate a triac only in Quadrants 1, 2, and 3. Current requirements is of great concern in our circuit because the power supply can source only around 80mA maximum. Therefore, operating the triac in Quadrants 2 and 3 via negative DC gate current is very much preferred. This can easily be achieved by making the positive side of the DC supply the common leg for DC and AC supplies and tying MT1 to it. The net effect is that triac gate will be sinking current to trigger the triac instead of sourcing it--the reverse of the preceding circuits. The circuits below illustrate how this can be achieved using transistors. Using an NPN transistor a logic high will trigger the triac. With a PNP transistor a logic low will trigger it.

Any triac may be used which requires a maximum gate trigger current of less than 80mA--the approximate upper limit of the power supply. TO-220 packaged triacs may need a heat sink.

The Teccor Q401E3 needs a maximum of 25mA gate trigger when the triac is operated in Quadrants 1 to 3. This must be the minimum current supplied to the triac to ensure proper turn-on. Supplying a current greater than this is preferred.

The relationship between collector and base current is given by the following equations:

I_C = I_B h_{FE}

I_B = \frac {V_S - V_{BE}}{R_B}


I_C = \frac {V_S - V_{BE}}{R_B} h_{FE}


IC= collector current
IB = base current
hFE = minimum transistor current gain
RB = current limiting resistance for base
VS = input voltage at base, usually power supply voltage
VBE = voltage across base and emitter with base saturated

Assuming collector current provided by base current is greater than current needed by load, current limiting resistor for fixed-voltage load that requires a current source (e.g., the triac gate) is derived as follows:

I_L = \frac {V_S - V_{CE}}{R_L}


IL = current required by load
VS = power supply voltage
VCE = voltage across collector and emitter with base saturated
RL = current limiting resistor in series with load

Given a S9013 NPN or S9012 PNP transistor as output amplifier to switch the triac on, we can derive the necessary resistor values.

To make 50mA available to the triac gate we choose the base current limiting resistor as follows:

IC = 50mA
S9013 minimum hFE = 60
VS = 5.6V
VBE = 1V

Using the above equations base resistor RB = 5.5Kohm. We choose a standard 5.1Kohm resistor

To limit the actual current supplied to the triac gate to 50mA we choose the collector current limiting resistor as follows:

IL = 50mA
VCE = 0.6 (max.)

Using the above equations RL = 100 ohms

LED's are shown in the circuit but are optional. They provide visual feedback as to the state of the RS latch. Since NOR/NAND gates can only source or sink very small currents, the current limiting resistors for the LED's must limit current to less than 2mA.

Power Supply

The circuit utilizes a half-wave transformerless power supply with one leg of the AC line common with DC positive supply.  Filter capacitor C2 must be large enough to supply enough gate trigger current to the triac during the negative half cycle.  The working DC voltage should be above 3V for the CMOS gates to work properly but should be low enough so that Zener diode Z1 does not dissipate too much power during the positive half cycle when it is reversed biased, during daytime when load is turned off and practically all current is being dissipated by the Zener.

It is important to note that when reverse biased D1 is blocking the full AC line voltage. Therefore, for a 240VAC line it must have a peak inverse voltage (PIV) rating greater than 340V. A 1N4004 will suffice. But using a diode with a much higher PIV rating--600V 1N4005, for example--may be a better idea to provide added protection for the other devices in the circuit from voltage spikes during the negative half cycle.

Adding a fuse in series with the AC line offers added protection in case of overload, shorts or breakdown of C1.


Triac Operation:
Motorola Thyristor Device Data, 2ed. Motorola Inc. 1988.
Teccor triac catalog

Transistor as Switch:
David A. Bell. Solid State Pulsed Circuits, 2ed. Reston. 1981.
Robert Boylstad & Louis Nashelsky. Electronic Devices, 4ed. Prentice-Hall. 1987.


Mathematics of CMOS NOR Latch Based Auto Night Light Switch
July 2003

The design of an auto night light switch based on CMOS NOR gates was discussed in a January 2003 paper. The mathematics involved in the voltage divider is discussed in further detail here.

The following circuit shows the voltage divider network and the latch composed of 2-input NOR gates. NOR.a is used an inverter, while NOR.b and NOR.c are wired as a latch. Rd, D2 and C2 form a dampening RC network that prevents the circuit from reacting to abrupt and transient changes in light levels.

We will determine the LDR resistance at which the output of NOR.b goes high and low, i.e., when the load is turned on (output high) and when NOR.b output goes low, i.e., when the load is switched off (output low). We will also determine the hysteresis band between turn on and turn off.

We know that the inputs of the 4000 series CMOS gates are referenced to 50% of supply voltage (V+), meaning that voltages < 0.5V+ are interpreted as low, and voltages > 0.5V+ are interpreted as high.

In the above circuit RR, Rh and LDR form a voltage divider.

RL = resistance of LDR
RLon = resistance of LDR at the instant RL = 50% of total  resistance (load is switched on)
RLoff = resistance of LDR at the instant RL + Rh = 50% of total resistance (load is switched off)

Because NOR.b and NOR.c are wired as a latch the circuit will turn on the load (NOR.b output goes high) when voltage at the input of NOR.c becomes greater than 50% V+, or in other words RL is greater than 50% of total resistance (input of NOR.b must be low or a disallowed state ensues). The transition point is therefore:

\frac {R_L_{on}} {R_R + R_h + R_L_{on}} = \frac {R_R + R_h} {R_R + R_h + R_L_{on}} = \frac {1}{2}

R_L_{on} = R_R + R_h

On the other hand, the circuit will turn off the load (NOR.b output goes low) when input at NOR.a (used an inverter) goes below 50% V+, or in other words RL+Rh is less than 50% of total resistance (input of NOR.c must be low or a disallowed state ensues). The transition point is thus:

\frac {R_L_{off} + R_h} {R_R + R_h + R_L_{off}} = \frac {R_R} {R_R + R_h + R_L_{off}} = \frac {1}{2}

R_L_{off} = R_R - R_h

The hysteresis band is the difference between and RLon and RLoff :

h = R_L_{on} - R_L_{off}

h = 2R_h


Note: LaTeX math code was embedded using mathcache


  1. Hi!

    I tried the first simple circuit above with a NPN transistors(BC639) emmitor connected to the TRIAC(BT139) gate and it doesn't work. I checked the current flowing to the gate and it's about 100mA. The AC voltage is 12VAC.

    Any help would be appreciated!


  2. Hello Matic. I checked the datasheets of the BC639 and BT139 and they seem fine for the job and voltage and currents you used. Is the triac's MT1 connected to DC ground? Gate current needs a return path. MT1 is common to both DC and AC sides of the circuit.

    Just to be sure the circuit works I breadboarded it just right now. I don't have the part numbers you're using. Instead I used a S9013 NPN and Q6004 triac. I hooked up a 12VAC transformer and used a 12V 20W halogen lamp as a load. R1 (current limiting resistor to NPN base) = 1K. R2 (triac gate current limiting resistor) = 100 ohms. Vdd = 5VDC. Thus giving a gate current of approximately 5V/100ohms = 50mA. According to the Teccor datasheet typical current for Quadrant 4 = 50mA. According to the NXP datasheet maximum required gate current for the BT-139 G series is 100mA so your setup should be fine.

    I didn't use a logic gate to switch the NPN. I simply used a short length of wire to act as a switch. To turn load on I plugged the wire into Vdd, and removed it to turn the load off. To prevent the NPN base from floating (not connected to Vdd or ground when I pull the wire off the breadboard) I placed a 100K pull down resistor (to ground) at the base.

    Update me on how it goes on your end. Am curious what the problem might be.

  3. Just a postscript. I used this NPN triac (quadrant 1 and 4 operation) circuit in an application for about 2 years (installed it back in 2003) and then replaced it with one using a PNP instead. The latter is still in service.

  4. Hi again. Thanks for the quick reply!

    I tried the exact values of resistors and Vdd that you mentioned and even used the same lightbulb(12V/20W halogen), but still nothing!
    I tried a smaller resistor on the NPN collector and got a current to gate 75mA!

    Is it possible that the BT-139 cannot be controlled in this way?


  5. That's strange. Try the first configuration in the following schematic: That'll put the triac into Q2 and 3 operation. It has to work. It has much less gate current requirements. If it doesn't work I'd begin to suspect something's not right with the triac.

  6. Still nothing!

    Let me describe how i tested your last suggestion(Q2 and 3):

    I have a LM7805(5V) stabilizer that powers the NPN(BC639). The stabilizer is powered from a separate 12VDC supply(no connections between the 12V transformer and this supply!).
    On the base i have a 1-kOHM resistor that is connected to 5V from the stabilizer.
    The emmitor is connected to 0V of the stabilizer
    The collector is connected to the TRIAC(BT139-800) over a 100-OHM resistor(the current is 45mA when the circuit is powered).
    On the TRIAC side i have MT1 connected to the lamp and the other side of the lamp to on terminal of the 12Vac transformer.
    MT1 is also directly connected to the 5V pin of the stabilizer.
    MT2 is connected directly to the other 12Vac terminal of the transformer.

    Am i missing something or is something wired wrong???

    I tried lowering the collector resistor to 33-OHM so that i get about 75mA of current(resistor gets quite HOT!), but still the lamp doesn't turn on.


  7. PS.:
    I tested the TRIAC. It turns on when i connect 12Vac to MT1 and MT2 and then bridge MT2 and GATE with a 33-OHM resistor!

  8. PPS.:
    Above i said that 12Vac was connected between MT1 and MT2 when i tested the triac. The lamp was between MT2 and 12Vac and it turned on when i put the 33-OHM resistor between MT2 and GATE!

  9. "Above i said that 12Vac was connected between MT1 and MT2 when i tested the triac. The lamp was between MT2 and 12Vac and it turned on when i put the 33-OHM resistor between MT2 and GATE! "

    Yes, that should indeed turn on the triac. If you were using a triac optoisolator such as the MOC302x series that would be how the optoisolator's triac would switch the power triac (you can look at the MOC302x datasheet for a schematic).

    What I don't understand is why using a DC signal won't turn on that BT139.

    According to the datasheet the BT139 is rated at 16A. I was wondering whether high power triacs may have some idiosyncracies. So I got the biggest triac I have in my junk box and tried it out. It's a Teccor Q4025. 25A rating. It turns the lamp on even at just 30 to 35mA DC gate current. I tested both circuits--for Q1&4 and Q2&3 operation. The latter performed better though--load was fully turned on.

    Maybe you can try some other triac model

  10. You may want to check out the following app note It has schematics and discussion of various triac triggering options including the ones I discussed above. The pertinent circuits start on page 119.

  11. Thanks for your commitement Edwardson!

    The last thing i tried was to use the schematic for working in Q1 and Q4(emmitor connected to TRIAC gate). Just to be sure i used a collector resistor of 33-OHM, so i got 360mA flowing into the gate!
    It still did nothing.
    Is it possible that you have to pulse the current on the gate at zero crossing or something?

    I will buy a few other triacs and try again, the only thing is i have a couple of these BT139-800 laying around and i thought i might be able to use them for simple on/off switching of a lamps without anything other than transistors and resistors.

    Thanks for your time!

  12. 360mA continuous current is a lot! You can pulse the gate at or near zero crossing but having continuous gate trigger (what we've been trying to do) should really work.

    If you get the circuit to work do tell me.

  13. Hi, me again with an update!

    I had time to play around a little more and found something out!

    I connected the TRIAC to 12Vac the standard way, by connecting MT2 to the 20W lamp and the other end of the lamp to LINE of 12Vac. MT1 was connected to NEUTRAL. I used a separate 12Vdc supply and connected GND of the 12Vdc supply to 12Vac NEUTRAL. Then i started connecting resitors from 100R down to 25R and measuring the current. At 33R i measured 360mA and still the lamp was OFF as i said before, then decided to go lower with the resistance.
    At 25R i measured 470mA and guess what, THE LAMP TURNED ON! Not fully, about 75%.

    Is there maybe something with the gate voltage that is reached only when the gate resistor is lowered enough with this TRIAC.
    I checked the marking on the TRIAC and it is BT139-800E. That E says in the datasheet that it is a gate sensitive triac with a maximum gate threshold current of 30mA in any quadrant!

    Please give me some advice!


  14. P.S.
    Also at this current(460mA), the heating of the gate resistor is very high(12V*460mA=5W). after a few second it becomes untouchable!

  15. P.P.S.
    The 12Vdc supply and 12Vac supply were connected together on TRIAC MT1 pin!

  16. Hello again Matic! 470mA to partially turn on the triac? That's unbelievable. Did you connect the resistor directly to the 12VDC, without using a transistor? If so, good. That eliminates one component we need to worry about. You said you connected the negative terminal of the 12VDC to MT1. How about trying to reverse the polarity and connect the positive terminal to MT1. Check the minimum current needed to get that triac to turn on. I'll cross your fingers. Sorry I can't be of better help. I'm stumped as you are.

  17. I finaly found the problem!

    The TRIAC i was using for testing has a partially fried gate! The TRIAC still works(I don't know how), but the gate currents have to be greater than those specified by a factor of at least 10!

    How i found that out? When i ran out of options, i switched my testing TRIAC with another one i had(same model: BT139-800E).
    The new one works perfectly with your above schematic for Q1 and Q4!
    I have no idea how the previos TRIAC gate got fried? If you have any ideas of how you can partially fry the gate on a TRIAC let me know!

    Thank you for your assistance and letting me bounce ideas of of you!


  18. Hey that's great. Problem solved :) I don't think static electricity can fry a triac. One thing I know will do so is exceeding the maximum rated current.

  19. That Z1 is a Jedi !