I am trying to work out how to produce an isolated 5 V digital HIGH/LOW of the polarity of a 230 V mains supply.
Basically the aim is to be able to read an amp clamp at a set time interval in order to determine the direction of current flow.
Where I am currently struggling is how to produce the 5 V supply to power the LED of the optocoupler, or maybe the question is how do I power the LED without damaging it or the transistor?
I don't suppose the latency of the changeover detection would need to be particularly accurate as long as it is consistent each cycle.
Would this circuit be safely isolated?
Is there an easier way a 5vm V microcontroller can detect a 230 V polarity change?
Edit: