(not sure if this belongs here or in Beginners)
I'm quite familiar with digital logic and microprocessors, get lost in the analog part...
I'm working with a prototype sensor that changes impedance when environmental conditions change (sorry, can't provide too many details on the sensor itself).
Currently the sensor is read by generating a 10kHz sine wave, and measuring the phase difference using two fast comparators and a digital 12 bit counter with a 2MHz clock. The comparators generate a pulse on zero crossing, one starting and one stopping the counter. The sensor value is read as a 12 bit value from the counter. I did not work on that circuit
I'm now trying to use a microprocessor to, as much as possible, duplicate the entire functionality. Everything runs at 1.8V. I can generate a PWM sine wave at 10kHz (albeit with only 40 values, and 40 steps to define the wave). I plan to use an active lowpass filter to generate as clean a sine signal as possible, 0.9V centered (1.8V Vpp). Then the sine wave is used to excite the sensor, which behaves like a variable inductance, and the excitation signal is fed into the microprocessor differential comparator 1, using 0.9V as a reference to detect zero crossing. That event will automatically start a 16MHz timer, no software needed.
The other end of the sensor is fed into another differential comparator, and the zero crossing there will stop the timer and generate an interrupt so that I can read the value in my code. The timer value is directly proportional to the phase difference, which is directly proportional to the sensor value, in turn reflecting an environmental value.
I tried using a basic lowpass RC filter to clean up my sine, with poor results and a very low Vpp as a result of the filtering. Please note that I don't really need a super-clean sine in the top and bottom part, which from everything I know it's the hardest to achieve. I need the cleanest possible signal at zero crossing, where the curve slope is almost linear and should be the easiest to achieve with a lowpass filter.
I've tried to explain my idea in the drawing below. I used a "mystery opamp filter", because I think that an active filter will help me achieve the best results, and help get a sine as close to 1.8V as possible. I can use up to 3 individual opamps and as many passives as needed, but keeping to BOM simple is a nice to have. One of the opamps in the quad opamp is needed to create a 0.9V reference for the sine wave/sensor. I might need to amplify further the sensor signal, if the sensor/resistor results in a too small signal. If not, probably I could use a dual opamp, not a quad one.
Please note that I'm aware that there is a logical circuit simplification: since I'm controlling the PWM signal, in theory I don't need the first comparator. I could start the timer for the phase difference when the PWM signal generator starts the wave from the 0 point. But I know that filters add a phase offset, so I plan to build the circuit, use the first comparator to get a reading of the offset, and use that in the future to calculate the actual phase difference due to the sensor. So the final circuit will only have one comparator. I designed it with two, to clarify better.
In any case, a clean 10kHz sine wave is a requirement. Can you please help me figure out a good active filter and help pick the passive values for my frequency? A single PWM pulse is 16MHz, and I use 40 pulses to represent values 0 to 40. So the PWM frequency is 400kHz. I have a 40 items LUT, to build the sine
Any type of input is appreciated