enter image description here

I have a speed control circuit for a 230V AC motor. It has a BTA16 TRIAC for phase control and it is driven by an optocoupler MOC3021. The trigger signal is coming from a PIC16F676 microcontroller. The trigger signal is given according to an input event to the microcontroller.

The problem is the TRIAC is getting switched on automatically sometimes when I turn on mains. I found that is because somehow the TRIAC driver gets the drive voltage from the microcontroller. But it is not happening always and I cannot change anything in hardware. I also tried in software not to trigger the TRIAC for 2 seconds from power on but still the problem persists. Is there anything that I should try to get around this problem?

  • \$\begingroup\$ Since you are using an inductive load, a triac can trigger on itself. Add a schematics of your circuit so that other people could comment on that. \$\endgroup\$
    – miceuz
    Apr 22, 2013 at 6:57
  • \$\begingroup\$ I added schematic of triac circuit \$\endgroup\$
    – raforanz
    Apr 22, 2013 at 7:51
  • \$\begingroup\$ Does your uC pin have internal pull-up enabled ? \$\endgroup\$
    – Gossamer
    Apr 22, 2013 at 8:49
  • \$\begingroup\$ It has internal pull ups for the port i use to trigger the triac. But the pull ups of the pins can be individually configured and i disabled it for the pin which is triggering triac (pull ups are enabled for all other pins in that port.) \$\endgroup\$
    – raforanz
    Apr 22, 2013 at 8:55
  • 1
    \$\begingroup\$ If you disconnect R1 does the problem still happen. If not then it is the MCU driver and it's internal pull-up \$\endgroup\$
    – Andy aka
    Apr 22, 2013 at 9:45

1 Answer 1


You already appear to have sufficient snubberring around the TRIAC which should eliminate DV/DT based switching (the TRIAC turning itself on due to noise on the gate lead) which I believe that your issue is on the micro side of things.

I think your issue is as follows. When the micro is in reset, all of its pins are inputs. This isn't quite the same thing as having the left side of R1 disconnected since the micro also probably has internal pullups. These pullups are too weak to drive the opto LED strongly, but I bet if you put a meter across R1 you will see maybe a few dozen to a hundred microvolts. That might be enough to trigger that opto.

I would rework the micro side of your circuit so that the anode of the optocoupler LED goes to +V and the cathode goes to your micro through R1; your micro will then have to drive the output LOW to turn on the TRIAC, but it will eliminate that brief moment where the micro comes out of reset and the pin is an input and drives the LED weakly.

I would also add an external pull-up resistor just because you're working with line voltage and I like the assurance of a stronger pull-up resistor to make sure the opto stays off. I would also investigate the larger TRIAC to see what exactly its switching characteristics are. If it's a sensitive-gate TRIAC and you have a noisy environment you may need to take a closer look at your snubberring.

The other issue I see is that in your schematic you show a zero-cross detecting opto. You won't be able to phase control with that.


Not the answer you're looking for? Browse other questions tagged or ask your own question.