What you have there is a good safe option.i think to do something like this
You may need to add some de-bouncing circuitry to the input to the micro.any modification ?
I use a 5 volt wall wort. (cell phone charger) We all have boxes of them laying around.i think to do something like this
I simulate the circuit the output was 5v .C1 is the crucial component, it MUST be a special capacitor rated for this use - it must be X-rated.
R3 should probably be a fusible type, as it's there as a fuse - R1 and R2 are just to discharge the capacitor.
BTW, this circuit provides AC pulses on the output, not a DC voltage.
I have a switch already connected to neutralWhy are you switching the neutral?, normally never done.
Live side only.
yes i used DMM and i check the output on the oscilloscope it was as you say..How were you checking the output? A DMM will average the signal and show it as very close to 0V, whereas in fact it is a series of very brief 5VDC pulses (one pulse per half-cycle).