1

Is it possible to have two rotary potentiometers read from a single analog input pin?

The analog input is 10 bits (0-1023), so each pot would have 5 bit precision (0-15).

Least significant bits for pot 1 and most significant bits for pot 2.

A SPI/I2C ADC IC (eg. MCP3008) is an option if this is not possible.

Edit:

The two pots do not need to be read at the same time. It seems full 10 bit precision could be achieved if I use a digital pin to enable each pot before it is read.

4

There are a few ways of doing what you want. One would be to use an analog multiplexer as in this answer: Expanding analog inputs to the Arduino

Another would be to use digital I/O pins to control the power and ground to the potentiometers. Note that both sides of the pot need to be controlled, not just one, since any connection of one will interfere with the other.

So you will need four IO pins - one for the +5v and one for the GND of each potentiometer.

enter image description here

In this example set D3 to OUTPUT and HIGH, D4 to OUTPUT and LOW, and D5 and D6 both to INPUT. You will now be reading from the top pot.

Then change D3 and D4 to both be INPUT, and D5 to be OUTPUT and HIGH and D6 to be OUTPUT and LOW. You will then be reading from the bottom pot.

A bit wasteful of IO pins though.

2

Building on @Majenko's answer, I think you could do the same thing, using 1 analog pin (as shown in his answer) and one digital pin.

Rather than using one digital pin for each side of the each pot, you could use one transistor for each side of each pot, and then use one digital pin to switch all 4 transistors on/off at the same time, in the right combination.

  • 1
    It could be done, yes. It's a choice between lots of components or lots of IO pins. If you're going in the lots of components direction you may as well go for an analog MUX and get lots more channels to play with anyway. – Majenko Mar 21 '16 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.