Electrical – small sine wave with dc bias – translate to logic time signal

biasingschmitt-triggersignal

I have a time varying pressure sensor output signal from which I would like to obtain the cyclic frequency. The signal originates from a reciprocating gas compressor therefore the voltage signal is a smooth and slightly distorted sine wave, frequency varies slowly from 0-10Hz, but is generally in a steady-state.

The sensor signal is 0-10Vdc, the amplitude is around 0.5V and the dc offset can be anywhere from 0.5 to 9.5v.

I would like to translate the small sine signal into a logic level square wave signal to be received by a microprocessor board (Arduino Uno) for frequency counting.

The approach that I'm thinking of is to shift the ac signal mean to 2.5Vdc, amplify the wave and feed through a Schmitt trigger (I have SN74HC14N)comparator.

I'm sure that this is a very common situation but I haven't found a book chapter to spell it out for the electronics novice.

Best Answer

A simple voltage comparator can do what you need in one step:

schematic

simulate this circuit – Schematic created using CircuitLab

The LM339 (and comparators like it) has an open-collector output, so it can drive a logic input on your MCU with the assistance of a simple pullup.

On the input side of the comparator, a simple low-pass filter produces the average of the input signal, isolating the DC bias. This is fed to the - input as a reference. Therefore, the output of the comparator switches high and low as the original signal (connected to the + input) swings above and below this average.

Note that the input signal (AC + DC) must at all times be between the supply rails of the comparator, with some margin required at the top end. See the "common-mode input voltage range" specification in the datasheet. Adjust as needed.

If the circuit doesn't work reliably at the lowest frequencies you want to detect, try increasing the time constant of the filter — i.e., larger values for C1 and/or R1.

Related Topic