I'm trying to measure (with a 3.3 V ADC) a low frequency (about 20 Hz), low voltage (± 160 mV) ripple that is superimposed on a 12 V signal (so 12 V ±160 mV). I need to determine both amplitude and phase of the voltage ripple (and also react to the zero-crossing of the ripple component), so I'm planning to measure the whole signal and process it in the microcontroller. To do that I'd like to remove the 12 V component (replace it with a 1.65 V component) and amplify the low frequency ripple to at least ±1 V (preferably with a 500 Hz-ish low-pass filter as well).
It's complicated slightly by the fact that the 12 V signal is occasionally pulled down to 0 V, although I won't need to measure the ripple during this time.
The circuit has a 12 V power supply and a 3.3 V power supply; no negative rails.
If the frequency of this ripple signal were high (kilohertz rather than hertz), I'd use a DC blocking capacitor to get rid of the 12 V DC and then amplify the signal around 1.65 V to get a decent signal for measuring with the ADC. However, the low ripple frequency makes that impractical so I'm looking for other approaches and that's where I'm struggling.
I've been playing around (in a circuit simulator) with using resistors to reduce the DC voltage but allow me to amplify the AC, but I'm struggling to get something that feels robust (and that I understand - most of this was putting resistor values in that I thought should work and then changing them dramatically when they didn't). If I try to add any LP filtering for noise immunity, the output seems to be garbage so I'm showing my lack of understanding of single-sided supplies and how to handle this sort of situation.
(the bit highlighted in blue is just for the purposes of this post to give an indication of what the signal I'm trying to measure is: 12 V with a 160 mV 20 Hz ripple superimposed and occasionally pulled down to 0 V).
Are there better ways of doing this that will give me a robust 1.65 V ± 1 V at 20 Hz output that can easily be measured with an ADC on a 3.3 V microcontroller?