Quadcopter Controller: Buttons and Joysticks
The quadcopter controller has some normal push buttons which work the same way that the karaoke's simple buttons work. The on/off switch is a slide switch (like karaoke’s on/off switch but its action goes side-to-side instead up-and-down), the rest are momentary buttons. From the outside, it may not be obvious that the controller’s flight trimmer inputs are momentary buttons, they look like rocker switches
But by looking at the board (Figure 3-12), you can see the trimmer input’s rocker switch arm presses momentary buttons. Also notice how each joystick has an arm out to the side and a button below the arm. These get pressed when you push down on the joystick.
The joysticks are a pair of potentiometers attached to the lever stick, like karaoke’s knobs but in two directions (X and Y) instead of one direction (around). The steering, up/down, and left/right joystick controls auto-center; they have springs in them that force the joystick to the center when you’re not pushing them. Each of these has a gray potentiometer on the side of the joystick (sidecar pots), marked 502J+. The throttle stays where you put it and doesn’t spring back. Its sidecar pot is green and marked 502J-. The color and marking of the pots has nothing to do with the springiness though I had to destroy one of the controllers to determine this.
See, I was getting really strange resistance measurements. Sure, the ends of measurement were ok (using beep mode) but trying to measure resistance across the pins didn’t add up.
If you look back at karaoke’s resistance (Figure 3-10), measuring an outer pin (1) against center pin (2) and then the center pin against the other outer pin (3) always added to the same number. That’s why the graph is an X, because measuring u to w is a constant.
As shown in Figure 3-13, the two parts of the potentiometer reading are like resistors in series: they add together so Ruw = Ruv + Rvw. At least that’s how it is supposed to work.The joysticks themselves aren’t digital input devices: if they were, then you’d only be able to specify “full power” or “no power.” Trust me, you don’t want the ‘copter to throttle up to full power as you take off (well, maybe you do, but don’t lean over it when you do that, it hurts when the ‘copter hits your forehead at high speed, not that I’d know, of course). On the DMM, I can beep out the connections as long as the stick is all the way up or down, left or right. When the joystick is centered, the pins don’t beep a connection to anything.
I wasn’t getting that for the quadcopter: the resistances didn’t add up. I desoldered the joystick and measured the pots without the rest of the circuit board: now they made sense. See the first two rows of Table 3-2: they add up. But with the joystick mounted in the board, the readings didn't make sense. Look at the bottom two rows: they don’t add up! How can the resistance go down?
If the current can take multiple paths between the points 1 and 3, then it will. Adding resistors gives the circuit more current capacity, and makes the total resistance between 1 and 3 go down. Like the karaoke’s disco LEDs, we say that these multiple paths are in parallel. Looking up the equation for resistance in parallel, I remember it as the “inverse equation” (see Figure 3-14).
Beeping out the board, I can see how all four joystick pots are connected. In Figure 3-15, I simplified it and showed how I applied the resistors-in-parallel equation to get the on-board 1 to 3 resistance I measured. Note that I had to know the true resistance of the pot off the board (4.8 kΩ) to be able to get the answer.
Whew! I like it when the mathematically derived answer matches what I measure, it doesn’t always happen. And to get here, I did have to be destructive: removing the joystick from the board broke it, so there was no going back. Sometimes, you just can’t measure a component while it is in the circuit, it has to be removed. With the damage already done, I thought it might be interesting to see what else is inside the joystick.
Leftmost in Figure 3-16 is the wiper which goes into the pot on the side. The pot is turned via the notch in the joystick handle assembly. The handle goes into the joystick assembly from the bottom, with the notch sticking out, interacting with the pot that snaps on to the side. The other side of the handle sticks out of the joystick and presses a momentary button when the joystick is pressed down (which you can see back in Figure 3-12).
I admit, the whole “resistances don’t add up” was a bit frustrating. But I’m happy I kept working on it. Even though I’m down one controller, I’m quite satisfied I got to take it entirely apart. Also, the gray potentiometer is similarly built though it has a slightly different pattern on the inside see Figure 3-17. The green pot is not linear in the center of its range; the gray one is.
Going Further
While potentiometers are special because they let us peek into the analog world, most buttons are simple digital ones, sometimes in a key scanning matrix. Key matrices can be harder to understand as you take apart an old TV remote, but once you start looking for diodes and tracing out how they fit together, it will start to make sense. Then you can build your own.
Buying a set of small, cheap momentary push buttons from SparkFun or Adafruit is cheap and easy. They are very useful and productive for when you need them; you might as well buy a dozen to have them around for future products. Useful and productive… but not as much fun as you could have.
How the buttons feel has a serious impact on how the whole project feels. If you really want your project to feel awesome, go for the largest buttons you can find. The mushy buttons on a TV remote feel cheap because they are conductive rubber buttons pressed onto traces on the circuit board. A big red dome button begs to be pushed. A toggle switch with plastic safety cover makes pressing your button feel like a major event. A multicolored, LED-lit matrix of buttons looks nicely futuristic. These can all be connected to the Arduino or other development boards you might have picked up to play with LEDs.
How many things are made up mostly of buttons and LEDs? As you look around, you are likely to see many things that are fairly straightforward inputs and outputs. The thing that makes such devices interesting is what the software does with those them.
This is a series. If you’d like to read them in order, check out the Taking Apart Toys index.