can anyone help me with an ac switching circuit design.i want to control light and fan using a microcontroller. are DIAC and TRIAC must for this type of circuit??
Use off-the-shelf solid-state relays (incorporate zero-crossing detector, optocoupler and triac) which can be controlled directly from microcontroller pins, or use discrete components such as optocouplers (MOC-series, for instance) and triacs to build one .. see picture below ..