I'm looking for some inspirations/references as to how I might go about designing a switch powered by a microcontroller, switching a mains powered device . My ultimate objective is to create a zigbee controlled switch that simply switches the mains power on and off. This device would be controlled by another microcontroller able to communicate wirelessly via zigbee. My key requirement is for the inline switch to be simple to connect, allowing the mains line to enter one side and exit the other, allowing it to be fitted in any existing scenario where a device might be powered by a traditional switch. My questions are:
• In my design, what approach might I take to split off the the AC power and transform to DC allowing my microcontroller to operate without needing an independent low voltage DC power supply?
• How do I integrate a relay into my design to switch the mains power from the same mains source?
I appreciate there are many considerations about safe design when handling mains voltage. It strikes me there must be some very similar open source hardware designs out there that would help me learn how to best achieve this.
Grateful for any advice or references.
Many thanks, Greg