**Ask:** How to get (with a fixed range and offset) linearly proportional signal from a variable range on the input? **Conditions:** There's a signal (to simplify, consider a sinusoid) with variable amplitude (min. 165mV to max. 1.65V) and variable offset so that the signal's lower value is above and close to 0. I need a circuit to catch the signal no matter what amplitude and then get an output linearly proportional signal that goes from 0 to 3.3v, as shown bellow: [![enter image description here][1]][1] An AmpOp may be used in association with a digital potentiometer, to vary digitally it's gain. In this configuration, for the max. amplitude, gain should be 1. For the lower amplitude, the gain should be around 10. P.S.: Said that, the actual signal is a trapezoidal signal that comes from a DC brushless motor phase, like bellow: [![enter image description here][2]][2] [EDIT - A test with a possibly solution] Using the following circuit, it was possible to obtain a signal from the variable amplitude input signal: [![enter image description here][3]][3] Setting the input signal to a sinusoidal 0-to-6v, and the 50k potentiometer to 91%, we have both graphs bellow: [![enter image description here][4]][4] [![enter image description here][5]][5] Setting the input signal to a sinusoidal 0-to-60v, and the 50k potentiometer to 51%, we have both graphs bellow: [![enter image description here][6]][6] [![enter image description here][7]][7] Both situations were simulated to 1.0kHz signal on the input. I would like to know if you guys have any advice or any real question which simulation doesn't take into account. Thanks! [1]: https://i.sstatic.net/asqdf.png [2]: https://i.sstatic.net/tslpB.png [3]: https://i.sstatic.net/Priqz.png [4]: https://i.sstatic.net/3s1qO.png [5]: https://i.sstatic.net/rNkkU.png [6]: https://i.sstatic.net/VLC00.png [7]: https://i.sstatic.net/V9iNM.png