Before we plunge into the fray with gusto and abandon (and aplomb, of course), let’s first set the scene. A current hobby project that I’m working on with my chum Steve Manley is to create a robot head whose eyes can pan and tilt. Furthermore, the whole head will be able to pan, tilt, and lean from side to side.
For my part, I’m starting off by experimenting with simple Mini Servo-Driven Pan-and-Tilt Kits from Adafruit. Meanwhile, Steve is playing his 3D printer like a concert pianist to create a cunningly convoluted implementation the like of which I’ve never seen before (see It’s (Almost) Alive! It’s (Almost) Alive!).
As a first step, we are planning on using joysticks to control things by hand. Later, we will be adding sophisticated sensors, thereby allowing our robot heads to react to whatever is happening around them, like responding to the user’s facial expressions or panning round to “look” for the source of an unexpected sound.
Steve and I both invested in a pair of JH-D400X-R4 10K 4-axis joysticks, which you can find all over the place, including Amazon and eBay. These are rather tasty devices. If the truth be told, however, the “4-axis” part is a bit of artistic license on behalf of the creators of these little rascals. In reality, they are only 3-axis devices that consist of three 10 kΩ linear potentiometers (pots) and a normally open (NO) pushbutton switch on the top.
Let’s also remind ourselves that a pot can be used as a rheostat (variable resistor) or as a voltage divider. In the case of this application, we will be using them as voltage dividers. With regard to our joysticks, the two pots we see on two of the sides respond to forward/backward and left/right motions of the joystick. The third pot, which is hidden inside, responds to our twisting the stick clockwise or anticlockwise.
I’m documenting all of this in a series of Cool Beans columns in Practical Electronics, which is the UK’s premier electronics, computing, and maker hobbyist magazine. In my column for the January 2022 issue, which will hit the streets in the first week of December, I posed a question to the readers. Since I didn’t have the space to answer that question there, I’m doing so in this Cool Beans Blog.
Let’s assume that the terminals of our pots are numbered as illustrated in Figure 2, where terminal 3 is commonly called the “wiper.” By default, the type of joystick we are using will return to its center position with respect to all three pots.
So, if we use our multimeter to measure the resistance between terminals 1 and 2, we should see a value of 10 kΩ (give or take). If we measure the resistance between the wiper and terminal 1, we should see a value of 5 kΩ (give or take), and similarly if we measure the resistance between the wiper and terminal 2.
In the case of this project, we will be connecting all six of our pots in parallel as illustrated in Figure 3. Now, before the power and ground are connected, and before the wipers are connected to analog inputs on the microcontroller, it’s not beyond the bounds of possibility that the designer might use his or her multimeter to measure the resistance between the wiper on one of the pots and whichever one of that pot’s terminals that will eventually be connected to ground. For the purposes of these discussions, let’s say this will be terminal 2 (Figure 4).
A lot of electronic newbies read my Cool Beans column in Practical Electronics. I suspect that many of them would expect the resistance to still read 5 kΩ (give or take). Sad to relate, it will actually be in the region of 2.92 kΩ. Just to add to the fun and frivolity, if we push (or rotate) the pot whose wiper we are measuring to its full extreme so it meets the pot’s terminal 2, we will see a reading of 0 kΩ, while driving it the other way to its full extent so it meets the pot’s terminal 1 will result in a reading of 1.67 kΩ.
If you are an old hand at this sort of thing, you need read no further. On the other hand, if you are scratching your head while saying “Wait, what?” then the rest of this blog is for you.
Hold On to Your Hat Because Here We Go!
We’ll start at the very beginning. Suppose we have three resistors called R1, R2, and R3 that are connected in series (one after the other) as illustrated in Figure 5. It may help to think of the resistor network as being a black box. From the outside world, this box has a total resistance of RT and it’s our task to figure out what this value is.
We can visualize electric current in wires as behaving a little like water flowing through a pipe. If we have only a single pipe, irrespective of any bends and twists and pinches and bulges, the same amount of water will be flowing past each point in the pipe at any particular point in time. Similarly, in an electric circuit that forms a closed loop, the current (I) is the same at every point around the circuit.
As a starting point, we know that the total voltage applied to the circuit (VT) has to equal the sum of the voltage drops across each of the resistors; that is, VT = VR1 + VR2 + VR3, which is shown as equation  in Figure 5.
Also, using Ohm’s law of V = I * R, we know that VR1 = I * R1 , VR2 = I * R2 , and VR3 = I * R3 . Substituting equations , , and  in equation  gives us equation . If we extract the common factor I, we are left with equation .
Coming at things from a different direction, we also know that whatever is the value of RT, then VT = I * RT . Substituting this for VT in equation  gives I * RT = I * (R1 + R2 + R3) . Dividing both sides by I reveals that RT = R1 + R2 + R3 .
Of course, we don’t need to go through this rigamarole each time. All we need to remember is that we can easily calculate the total resistance of a number of resistors in series by adding their individual values together. (It probably (hopefully) goes without saying that this works for any number of resistors.)
Next, let’s consider the same three resistors connected in parallel (side-by-side) as illustrated in Figure 6. Once again, it may help to start by thinking of the resistor network as being a black box with a total resistance of RT. And, once again, it’s our task to figure out what this value is.
Like water, electric current will take the path of least resistance, which means a resistor with a smaller value will have more current flowing through it. (Once again, we can think of our circuit like water flowing through pipes — more water will flow through wider pipes with less resistance, but it all adds up to the same amount of water going into the network and coming out the other side.)
In this case, we know that the total current IT has to equal the sum of the currents passing through each of the resistors; that is, IT = I1 + I2 + I3, which is shown as equation  in Figure 6.
Also, using Ohm’s law of V = I * R, which is equivalent to I = V/R, we know that I1 = V/R1 , I2 = V/R2 , and I3 = V/R3 . Substituting equations , , and  in equation  gives us equation .
Coming at things from a different direction, Ohm’s law also tells us that V = IT * RT , which is equivalent to IT = V/RT . Substituting this for IT in equation  gives V/RT = V/R1 + V/R2 + V/R3 . Dividing both sides by V reveals that 1/RT = 1/R1 + 1/R2 + 1/R3 .
In order to get RT directly, we multiply both sides by RT and divide both sides by 1/R1 + 1/R2 + 1/R3, resulting in RT = 1 / (1/R1 + 1/R2 + 1/R3) .
As before, we don’t need to go through this rigamarole each time. All we need to remember is that we can easily calculate the total resistance value of a number of resistors in parallel using the formula shown in equation .
OK. Armed with out newfound knowledge, we are ready to return to the conundrum posed in Figure 4. Let’s start with the low-hanging fruit, which is that we push (or rotate) the pot whose wiper we are measuring to its full extreme so that it meets the pot’s terminal 2. This situation is reflected in Figure 7. It’s apparent why we will see a reading of 0 kΩ in this case because the multimeter’s probes are effectively touching each other.
Next, let’s push (or rotate) the pot whose wiper we are measuring to its full extreme so that it meets the pot’s terminal 1 as illustrated in Figure 8.
In this case, the multimeter now sees all six of the pots as being connected in parallel. From our earlier discussions, we know that RT will equal 1 / (1/R1 + 1/R2 + 1/R3 + 1/R4 + 1/R5 + 1/R6). Of course, all of our pots are 10 kΩ. If we work in units of kΩ, we have RT = 1 / (1/10 + 1/10 + 1/10 + 1/10 + 1/10 + 1/10) = 1 / (0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1) = 1 / 0.6 = 1.67 kΩ.
Finally, let’s return to the tricky case where the wiper is in its middle position as illustrated in Figure 9a. Another way to look at this is to visualize the 10 kΩ pot being split into two 5 kΩ resistance values — RPA and RPB — as illustrated in Figure 9b. It might help to think of RPB as being moved around the circuit as illustrated in Figure 9c. And, to make things even clearer, you may wish to envisage things as illustrated in Figure 9d. The important thing to remember is that these are just alternative depictions of exactly the same thing.
Now all we have to do is take things one step at a time. We start with the five 10 kΩ resistors in parallel, whose total equivalent resistance is given by 1 / (1/10 + 1/10 + 1/10 + 1/10 + 1/10) = 1 / (0.1 + 0.1 + 0.1 + 0.1 + 0.1) = 1 / 0.5 = 2 kΩ. This value is in series with RPB, whose value is 5 kΩ, giving a new total of 2 + 5 = 7 kΩ. Let’s call this RRN, where “RN” stands for “Resistor Network.”
Our multimeter probes are placed either side of resistor RPA, which is in parallel with RRN. Once again, assuming we are dealing in units of kΩ, the value of these two resistances in parallel is given by 1 / (1/RPA + 1/RRN) = 1 / (1/5 + 1/7) = 1 / (0.2 + 0.14) = 1 / 0.34 = 2.92 kΩ. Tra-la!
Of course, when the rails connecting all of the pots are connected by low-impedance paths to power and ground, they will return to behaving the way we expect them to behave. Assuming a supply voltage of 5V, for example, the power supply will “see” six 10 kΩ resistors in parallel. Using I = V/R, this means the current drawn will be 5 V/1,670 Ω = 0.003 A (3 milliamps). Meanwhile, rotating a pot’s wiper from one extreme to the other will present the associated analog input to the microcontroller with values ranging from 0 V to 5 V, with 2.5 V corresponding to the wiper’s center position.