I recently built an AC fan speed control circuit using Atmega8a using Triac and ZCD method.I am attaching the necessary circuit regarding the triac firing and ZCD.The Atmega is configured to drive the MC3021 on falling edge detection.Please take a look.The fan speed is controlled in 5 different steps(namely-0,1,2,3,4).In 0,the micro is switching off the MOC3021 completely so the output is 0.Also in '4',the output of the micro is continuously giving '1',so that the MOC3021 stays on and the fan rotates in full speed.The speed control is done in 1,2 & 3.The speed control works perfectly on pure sine wave AC.But whenever electricity goes off and Inverter power takes place,the speed control malfunctions(Either the fan stops or it generates great hum and rotates very slowly).I saw with a DSO that the inverter is giving nearly square wave output.My question is,is this normal for the circuit to malfunction in square wave(zero cross is happening in square wave also so why is it malfunctioning??)or I am missing something??There is also external snubber attached using 39R and .01uF.In addition,when the circuit gives 0 to MC3021 i.e all off(while running on inverter),the square wave output of the inverter is stable.But whenever the circuit tries to control speed in either1/2/3,the square wave of the inverter gets distorted.The triac i used is BTA16.
Any hep is appreciated.Please reply soon.