Merry Christmas! This circuit is supposed to detect a mains zero crossing so that a PIC can count them and use it as a timkeeping oscillator.
My thinking (since the rest of my circuit is isolated from the full mains voltage anyways) is that after the mini stepdown transformer it shouldn't be too dangerous to work with the signals. The transformer only steps down the voltage to 6Vrms and the comparator can only accept ~4V or so max so the resistive divider is supposed to reduce step down that voltage again. I can't seem to make the resistive divider symetrical (two m's?) since I need (or want to) ground one output terminal of the transformer (to the DC supply) so that the common mode voltage doesn't exceed the comparator input range. At the same time though, I want to connect the - terminal of the comparator to that same ground to use the "zero voltage" as the comparator's threshold, so I can't separate the bottom terminal of the comparator and transformer in any way (like a resistor to make the divider symmetrical). If I do it the way shown, both Rs have to be the same or the reduction will be lopsided. Can anyone think of a better approach (assume I can't get another transformer to step down the voltage more)?
If the output of the comparator is unipolar it's all good. But the diode and resistor is because I'm assuming the comparator is bipolar. The diode is to clamp out the negative voltage before it gets read into the microcontroller's "change of state interrupt" pin and the pulldown resistor is there to allow a LO to be signalled since the diode stops the comparator from outputting a low.
Does anyone see anything wrong or improvements for this circuit? Like currents from the transformer flowing into the rest of the DC system through the ground or anything like that?
Thanks.
My thinking (since the rest of my circuit is isolated from the full mains voltage anyways) is that after the mini stepdown transformer it shouldn't be too dangerous to work with the signals. The transformer only steps down the voltage to 6Vrms and the comparator can only accept ~4V or so max so the resistive divider is supposed to reduce step down that voltage again. I can't seem to make the resistive divider symetrical (two m's?) since I need (or want to) ground one output terminal of the transformer (to the DC supply) so that the common mode voltage doesn't exceed the comparator input range. At the same time though, I want to connect the - terminal of the comparator to that same ground to use the "zero voltage" as the comparator's threshold, so I can't separate the bottom terminal of the comparator and transformer in any way (like a resistor to make the divider symmetrical). If I do it the way shown, both Rs have to be the same or the reduction will be lopsided. Can anyone think of a better approach (assume I can't get another transformer to step down the voltage more)?
If the output of the comparator is unipolar it's all good. But the diode and resistor is because I'm assuming the comparator is bipolar. The diode is to clamp out the negative voltage before it gets read into the microcontroller's "change of state interrupt" pin and the pulldown resistor is there to allow a LO to be signalled since the diode stops the comparator from outputting a low.
Does anyone see anything wrong or improvements for this circuit? Like currents from the transformer flowing into the rest of the DC system through the ground or anything like that?
Thanks.
Attachments
Last edited: