Help with MCU controlled TRIAC

Thread Starter

snail71

Joined May 19, 2017
10
I am trying to design a circuit that allows an ESP32 module to control an AC output. I basically want to dim the output by cutting off part of each phase. I have a circuit that feeds the signal back to the MCU to detect zero crossings. I have verified this is working and I'm generating interrupts based on this input to the MCU. I also have a timer that is running and I count so many ticks of this timer before turning on the TRIAC output. The output gets turned back off at zero crossing event.

Here is my circuit:
 

MaxHeadRoom

Joined Jul 18, 2013
28,682
MOC3061 are zero crossing opto's so they will turn on AT the zero crossing point, the MOC3021 are correct for phase control.
See Fairchild AN-3006 Picmicro also has application notes on it.
Pic AN958 covers zero crossing burst control.
Max.
 
Last edited:

philba

Joined Aug 17, 2017
959
I suspect that your LED current in the opto is too low. The ESP32 outputs are 3.3V or so. The datasheet says that MOC3021 LEDs need 15mA and you're giving it around 6 ( (3.3 - 1.1)/330 ). I'd change R5-R8 to something in the range of 120-150 ohms.
 

Thread Starter

snail71

Joined May 19, 2017
10
I changed the resistor for the opto to 100 ohm and connected the circuit up to an Arduino instead of the ESP32. The Arduino operates on 5V so that should be supplying 39 mA to the opto which is within the spec 15 - 60. The Arduino can handle 40 mA per pin so this right at the upper limit. I have only one of the TRIAC circuits wired to the Arduino. You can see here:



For now I just have the Arduino firing a 75uS pulse with every falling edge of the zero cross input. You can see the two signals below. Green is zero cross input to the Arduino and yellow is the signal to fire the OPTO/TRIAC. I am still getting no output out of the circuit.
 

Dodgydave

Joined Jun 22, 2012
11,302
I'm not getting any output from the TRIAC so I'm kind of looking for a review.
You won't until you swap Mt1 and Mt2 round, to make the triac fire G has to be taken to Mt2, you will also need pull down resistors on the gates to Mt1 say 1K to prevent false triggers.
 

Thread Starter

snail71

Joined May 19, 2017
10
You won't until you swap Mt1 and Mt2 round, to make the triac fire G has to be taken to Mt2, you will also need pull down resistors on the gates to Mt1 say 1K to prevent false triggers.
Thanks. Don't know how I overlooked that. I modified that board to swap pins 1 and 2 on the triac and it now fires and generates output. I have made a few changes to schematic:

1. Changed the MOC3021 to MOC3023 because it will fire at lower opto current (5mA).
2. Changed the opto resistor to 220R which generate about 10mA. The ESP32 pins will drive 12 mA.
3. Added 1K pull down resistor between G and MT1 of the triacs.
 
Top