The two images below are the simple circuit I developed. It consists of a pre-amplifier, a filter, an RC circuit that acts like an exponential average circuit, a peak detector and perhaps I still need to do another amplifier in order to use the entire range of the ADC I intended to connect.
Here are the signals at some of the nodes:
Everything works ok till it reaches that RC circuit. I have a time constant of 30ms and the signal just comes horizontally with no significant variation. What's happening? If I zoom in it's the equal to the input wave but just much smaller.
The peak detector just does what it does, the input of the peak is a straight line so the output will also be one.
The RC circuit I used was inspired by this:
I initially wanted to do a true RMS circuit but I just couldn't find a way to do the square circuit with a 5 volts supply so I just did an "averaging" circuit, good enough for my application I hope.
If I were to connect this circuit to an ADC, how exactly would I build an amplifier that goes to the input range (0V to 3.3V) of the ADC? I could use an op-amp in non-inverting configuration but then what?