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?