I have two signals one is sine wave, other one is square wave. I am giving it to one demodulator (nothing but switch). square wave is a switching signal so the output of switch is only positive sine wave. which is, I am passing it through the resister(12kohms) and then a parallel resistor and capacitor. I have attached circuit diagram as shown below.![circuit diagram][1]
I have checked output at node out1 (after switch), which will be like this. In the image positive cycles of both blue and yellow signals are override.
![signal][2] The positive cycle is there but negative cycle has to clip totally but i have some D.C voltage at negative cycle of sine wave. I don't know why i am getting that?
After that I am passing that signal through one resistor as well as parallel resistor and capacitor. Finally at the input of ADC i am getting D.C signal. But i am not sure the circuit i have added after switch is converting existing positive cycle of sinewave into D.C voltage or what I have some D.C signal at negative cycle of sine wave.
The main concept is, Here the sine wave signal is in phase with switching signal but normally there will be some phase shift in sine signal because it is the output of Capacitive sensor. So to get maximum voltage of sine signal I am varying phase from 0 to 360 degree of sine signal, here switching signal phase is constant. both are at same frequency. If i change phase from 0 to 360 of sine signal i will get maximum voltage at some phase then I want to convert that max voltage into D.C before giving to ADC. How to do that.
Normally I have done simulation in circuit lab for the above circuit, I am getting Zero D.C voltage at the input of ADC. But I want to get maximum peak of positive cycle of existing sinewave after switch as D.C voltage at the input of ADC. What changes i have to make?
View attachment 68616