small sine wave with dc bias - translate to logic time signal
A simple voltage comparator can do what you need in one step:







simulate this circuit &ndash; Schematic created using CircuitLab

The LM339 (and comparators like it) has an open-collector output, so it can drive a logic input on your MCU with the assistance of a simple pullup.

On the input side of the comparator, a simple low-pass filter produces the average of the input signal, isolating the DC bias. This is fed to the - input as a reference. Therefore, the output of the comparator switches high and low as the original signal (connected to the + input) swings above and below this average.

Note that the input signal (AC + DC) must at all times be between the supply rails of the comparator, with some margin required at the top end. See the "common-mode input voltage range" specification in the datasheet. Adjust as needed.

If the circuit doesn't work reliably at the lowest frequencies you want to detect, try increasing the time constant of the filter &mdash; i.e., larger values for C1 and/or R1.