Hi All,
I have a mains circuit that seems to have an odd behaviour. As you can see the circuit below is a non-isolated AC power supply (AC230 to 24VDC to 5V PIC). It supplies a PIC that generates 3 tones based on its I/O logic fed by C & D on the output of the optos. The PIC has a transistor-assisted 5v zener regulator fed from the 24VDC generated by the circuit below, a single transistor is used to amplify the tones coming from the PIC.
When you power up the circuit the PIC generates the default tone 1, at the same time, if you connect the mains live to S2 or S3 it should change the tone to 2 or 3 depending on if you feed it to S2 or S3. The voltage on C & D is either 4.7V or 0.18V depending on the input of S2 & S3.
Everything works great up to here and is expected, however, if you connect Earth or neutral to either S2 or S3 it will activate tones 2 & 3 when it shouldn't as the design is for mains live to switch stages, not Earth or neutral. I don't understand why this is happening, I can only guess there is some kind of a phase change somewhere. Measuring the voltage between neutral and Earth, its 0.6VAC
Appreciate any input.

I have a mains circuit that seems to have an odd behaviour. As you can see the circuit below is a non-isolated AC power supply (AC230 to 24VDC to 5V PIC). It supplies a PIC that generates 3 tones based on its I/O logic fed by C & D on the output of the optos. The PIC has a transistor-assisted 5v zener regulator fed from the 24VDC generated by the circuit below, a single transistor is used to amplify the tones coming from the PIC.
When you power up the circuit the PIC generates the default tone 1, at the same time, if you connect the mains live to S2 or S3 it should change the tone to 2 or 3 depending on if you feed it to S2 or S3. The voltage on C & D is either 4.7V or 0.18V depending on the input of S2 & S3.
Everything works great up to here and is expected, however, if you connect Earth or neutral to either S2 or S3 it will activate tones 2 & 3 when it shouldn't as the design is for mains live to switch stages, not Earth or neutral. I don't understand why this is happening, I can only guess there is some kind of a phase change somewhere. Measuring the voltage between neutral and Earth, its 0.6VAC
Appreciate any input.
