For my project, I need to connect a 240V mains live connection wire to a PIC input pin to detect the zero crossing of the sinusoidal waveform. Is there a safe way to do the connection since it is 240V?
use a diode to clip the negative half then feed this to optocoupler (dont forget to use resistor). Now you can interface it with ucontroller. That is all.
If you are using a linear power supply for your PIC then you can use the low voltage AC on the secondary of the transformer.
This will not require an opto-isolator, just a resistor to a zenner diode. The zenner will clamp the positive half cycles and remove the negative half cycles. You can add a small capacitor to avoid spurious transitions.
You do NOT need to use full-wave rectified AC, but if you do, remember that the frequency will be doubled.
Hi, connect IO through 1M resistor to 240VAC directly, it is OK for MCU since there are 2 diodes built inside, which can limit the voltage at IO from -0.7 to VDD+0.7, however, the system is hot, and can not touch directly.
it is a wide use solution, let me know any doubts.