How To | Using GPIO configured as an analog input to control a Gain block

Learn how to use a GPIO-configured analog input to adjust the gain of a signal.

Updated at May 9th, 2023

Procedure


When using the GPIO configured as an analog input to control gain with a potentiometer, you might find that the Gain knob only sweeps between the low and high voltages being input.

For example, on a CX-Q amplifier, the GPIO configured as an analog input controls the analog input level up to 3.3 V. This means that this knob will sweep between the values 0 and 3.3. If you try to wire that directly to a Gain control, you will find that the potentiometer will only control the gain from 0 to 3.3dB!

To control the full range of the gain knob using the potentiometer, simply wire a custom percent knob between the GPIO input and the Gain control. This will translate the GPIO analog input knob to a positional value rather than a numerical value.

gpio.PNG