Logic signal generation from sine wave or clipped sine wave

Thread Starter

gunrunnerjohn

Joined Jun 8, 2014
6
I have an application where I have a 18 VAC sine wave that I need to generate a logic signal for a PIC processor input port for.

The sticking point is the sine wave is controlled by a triac, and depending on the external system mode of operation, it can either be a full wave, a clipped waveform with only the positive half or only the negative half of the sine wave. It's not a problem to generate the logic signal from the full wave or positive clipped waveform, but I haven't cracked the code of how to do it with the negative alternation.

My current solution is an AC opto-coupler and a couple of resistors, that solves the problem, but the board footprint is larger than I like, and they are also more costly than a few discrete components if I can come up with a scheme that will work.
 

crutschow

Joined Mar 14, 2008
34,452
If you AC couple the waveform, then it will always go through 0V and you can use a comparator to detect that zero crossing.
 

Thread Starter

gunrunnerjohn

Joined Jun 8, 2014
6
What happens if I have only the positive side of the sine wave? Inverting that loses the signal input.
Right now, I have this which I've been unable to improve on, maybe it's as good as it gets. I'm feeling like I'm swimming upstream trying to minimize this, maybe it's not worth the effort. Obviously, this outputs negative logic, low is an active signal.

AC Waveform To Digital Input.png
 

Thread Starter

gunrunnerjohn

Joined Jun 8, 2014
6
Right, there's just too many components. I'll probably stick with my opto-isolator, I wanted to optimize the footprint. I still have to filter the output to get the steady logic signal after the comparator which will add several more components.
 

Bordodynov

Joined May 20, 2015
3,180
Right, there's just too many components. I'll probably stick with my opto-isolator, I wanted to optimize the footprint. I still have to filter the output to get the steady logic signal after the comparator which will add several more components.
A dual diode (BAT54S) and a resistor with a capacitor- Is it too much?
Give me your full schematic and I'll do it simulation.
 

Thread Starter

gunrunnerjohn

Joined Jun 8, 2014
6
Those four parts are the whole input circuit, the AC waveform feeds the 1K resistor, and the PIC port is connected to the collector of the opto-isolator.
 
Top