# How to get (with a fixed range and offset) linearly proportional signal from a variable range on the input?

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:

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:

[EDIT - A test with a possibly solution] Using the following circuit, it was possible to obtain a signal from the variable amplitude input signal:
Setting the input signal to a sinusoidal 0-to-6v, and the 50k potentiometer to 91%, we have both graphs bellow: Setting the input signal to a sinusoidal 0-to-60v, and the 50k potentiometer to 51%, we have both graphs bellow:

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!

• Sounds like you need an AGC (automatic gain control) or some servo feedback. Sep 30, 2020 at 16:24
• @winny, I was thinking how to solve this using a digital potentiometer associated with an AmpOp. The goal is to catch the output voltage with an ADC. Sep 30, 2020 at 16:28
• It's unclear to me why you need a variable gain amplifier - are you saying that when the signal is only 165 mV, that you want it to become 1.65 volts and, when the signal is 1.65 volts you want to leave it unchanged AND, in both cases, you want the output signal to be centred so that its lower level doesn't go negative? Thing is this; if you are interested in the amplitude of the signal then that information is lost by the variable gain amplifier so, please explain what the point is of your requirement. Sep 30, 2020 at 16:36
• @EmanuelM OK, so what are you trying to determine from the "reformed" signal. After all, you've lost amplitude information due to the automatic gain control. I'm asking this because it might be relevant and I can't see a reason why you want to lose amplitude variation information. Sep 30, 2020 at 17:24
• If the signal looks the same then want can reading it by an ADC tell you? Think about it. Sep 30, 2020 at 23:05