How to Connect 2 Potentiometers to 1 Digital Input
on
To read the position of potentiometers or other analog values with a digital device like a microcontroller you need some sort of analog-to-digital converter or ADC. Even though many microcontrollers have an ADC peripheral built-in, they tend to have more digital I/O pins than analog. Therefore, depending on the application, of course, you may want to save the analog inputs for something more important than handling a user interface, and use digital inputs instead.
By applying frequency modulation (FM) and pulse width modulation (PWM) at the same time it is possible to transmit two data signals on one carrier.
Adjust Frequency and Pulse Width With Potentiometers
We will take advantage of the independency between duty cycle and frequency of a PWM signal to transfer the position of two potentiometers with only one rectangle wave. One potentiometer controls the frequency and the other the duty cycle. The microcontroller measures the frequency of the rectangle wave and its duty cycle. It then converts these values back to potentiometer positions in a range from say 0 to 100.
The circuit we use is a classic opamp-based triangle generator together with a comparator. With the given component values the frequency is adjustable from 250 Hz up to 500 Hz. The pulse is adjustable from 10% up to 90%. As a matter of fact, you can use any circuit capable of doing frequency- and pulse width modulation with potentiometers.
In this video we will connect two potentiometers over a single wire to one digital microcontroller input. We can read the position of both thanks to FM and PWM of the input signal.
Discussion (3 comments)