I have recently learned about schmitt and comparator op amps, and I came up with an idea to build a "frequency comparator" (if it is called like this). The function of this circuit is to maintain an output high or low depending on the frequency of the signal at the input, compared with a preset trigger frequency. What I wanted to accomplish with this circuit was and is a frequency detector independent of the amplitude of the signal at the input.
How I wanted to accomplish this was to first build a non inverting comparator at the input, with a low trigger voltage (something around +/- 0.1V). This way a square wave would be created at the output with a constant amplitude and a frequency dependent on the signal seen at the input only (the comparator triggers only if we assume that all input signals are above 0.1). The output wave would then be taken into a following stage, composed of a lowpass filter at the input and a second non inverting comparator. the trigger voltage is set at approximately -/+ 3.535V, the voltage equal with 0.707*5, when the lowpass filter reaches its cutoff frequency. Any frequency above the cutoff will be of a smaller amplitude than the threshold, resulting in the output being low. And in reverse, any frequency at the input smaller than the cutoff will result in the output being triggered to high. The output will then be probably taken in a next stage where it is rectified and ready to activate a component (be it transistor, LED, relay, piezo driver, motor or whatever). The cutoff frequency can be, of course, controlled with a pot, multiplexer etc. Here I chose a cutoff at approximately 1500H.
My problem is that this circuit misbehaves. Testing the circuit with only the first part works great. The second part misbehaves beyond my undestanding. Putting the circuit together in one piece, the second stage interferes is such a way to create chaos (at times). At low frequencies, the output stays at ground, at frequencies slightly above 1500, the output also stays at ground. And, at higher frequencies, the output stays high. In the middle of low and high, the output oscillates. What is going on? I am not very comfortable with non inverting comparators, but I like their simple and symmetrical threshold and their properties. Is there created a high pass filter somewhere ehich unables small frequencies to trigger the output? Any suggestion is welcomed. Help, please!
[![testing the first stage alone works great]]
Testing the first stage alone works great