How to design a 2 way switch using Triac and SPST standard switch?
If I understand correctly you wish to be able to toggle the lamp status from either the wall switch or your micro.







simulate this circuit &ndash; Schematic created using CircuitLab

This would be the easiest way. Use two triacs triggered by seperate output pins on your micro. Make TRI2's trigger the inverted logic of TRI1. Light will be on if switch is up and TRI1 is on OR switch is down and TRI2 is on.

The other option is to use a relay changeover contact.

[Sigh] The things we do to avoid getting out of bed!

[Edit: SPST version]]

Pop a changeover relay into the circuit. Coil needs to be rated for mains voltage and AC. Contacts need to be rated for mains voltage and the lamp current.







simulate this circuit

A simpler method might be ...







simulate this circuit

Use the relay contact to signal the switch status to your micro. Let your micro then keep track of the relay signal and its local signal to determine when to switch the light on.