AREF - using external 5v PSU with variable resistors

Hello!

I'm hoping for some guidance on a project I'm building for my toddler.

Overview:

This portion of the project includes three sliding variable resistors (not potentiometers, only 2 pins) representing red, green, and blue. My Arduino Nano R4 will read the voltage across each of these individually and convert them to a Neopixel color value, which will then display on a light strip.

Issue:
I've noticed that when connecting multiple variable resistors to the Uno's 5v pin, the analog read becomes unstable. Parallel resistors are complicated, and I assume this is due to the limited output on this pin. I have a dedicated 5v power supply that I think should stabilize the circuit.

Question:
If I'm reading analog voltages from an outside 5v supply, should I tie that voltage supply to the AREF pin or just trust that the internal 5v comparison will be close enough? I know the AREF pin is tricky and should never have more than 5v connected, but I'm unsure if a straight 5v is okay. My understanding of the Arduino internals is limited at best, so any insight is appreciated.

Thank you!

Not sure what you are doing, so post all code in code tags, any useful serial output also in code tags then hand draw your wiring and post a photo of that.

1 Like

Excellent assumption. Unless part of a voltage divider, two pin variable resistors are the wrong choice for this project, because at the low-Ohm end, they will draw too much current from (or even short circuit) any power supply you pick.

Instead use 3-terminal potentiometers as shown in the circuit below. 10K to 50K pots would be appropriate.

2 Likes

I was stuck in my head on using what I had. You're right. Thanks for setting me straight!

2 Likes

If you know the max resistance of the items you have, or can measure it with a meter, all is not lost. Let’s assume they’re 10 kohms. Just put an equivalent 10k fixed resistor in series. Connect the fixed resistor to 5V, and the adjustable one to GND. Tap off the junction point and wire it to the analog input. There you go! A variable input that will vary from 0 to 512, approximately, when read with analogRead(). Not perfect, as it wastes half the voltage range, but avoids overloading the 5V source. If the device resistance is below about 1 kohm, of course, the technique is less useful, as you’ll have to use a fixed resistance that is larger than the adjustable, resulting in even less voltage range for the analogRead().

1 Like