I wired a resistive joystick to the knockoff Nano controlling the crystal tester and connected the button to an analog input because I have a lot of those left over and why not. Unfortunately, the ADC returned a sequence of random-ish numbers indicating the button didn’t have a pullup to +5 V.
One might be forgiven for assuming the pads marked R5 would hold such a pullup resistor, had the joystick not been relentlessly cost-reduced:
One would, of course, be completely wrong.
Having been around this block several times, I measured the pad-to-pin resistances and found R5 firmly affixed to the GND and +5V pins, with the SW (a.k.a. button) pin floating free. Pressing the joystick hat closes the switch next to R5, thereby connecting the SW pin to GND.
Baffles me. Maybe a fresh intern did the PCB layout and just misplaced the resistor?
So I soldered an ordinary resistor (*) between the +5 V and SW pins:
Now it works just as it should.
(*) For long-lost reasons, I have a zillion 12.4 kΩ 1% resistors appearing in place of simple 10 kΩ resistors.
13 thoughts on “Arduino Joystick: Button Pullup FAIL”
I believe the processor can engage pullups on the analog pins, but when you have a heap of 12.4kΩ resistors lying around, it’s probably more reliable to just use those.
Plus, I wanted to run the button directly into A1 for E-Z wiring. It’s possible to turn A1 into a digital input with an internal pullup, but, having begun the exercise with the notion of just soldering a chip onto those obvious pads, an external resistor seemed a perfectly reasonable conclusion.
We have a couple of these from a kit but I don’t think we ever used one. I’ll have to take a quick peek next time I’m around lab :)
Oh and a bit of errata, second to last paragraph should probably read: “Now it works just [AS] it should.” Too bad you’re not treating them like Knuth :)
Were I foolish enough to use his bug bounty algorithm, I’d be deep in debt by now. May he live forever!
I wonder how many of those checks ever got cashed in – probably not much. I mean it IS the ultimate geek currency :)
The other thing these joysticks could use is a top-plate with a round hole for the knob. And that could also limit the movement, so it doesn’t go all the way to the end. At least mine show some shouldn’t-be-there-resistance at the stop positions.
It definitely cries out for a case protecting all those solder points. I’ve already scribbled several high-style and completely un-printable designs; right now, it dangles safely an inch off the workbench.
It seems like a job for the mill to me, maybe from a nice aluminum or Delrin scrap piece… I know, I know… that way lies madness :)
Nowadays, the Sherline mill doesn’t get much love: it’s much easier to pick a shape off the M2’s platform and be done with it.
Apparently there are plenty of people who had the same idea.
The first one looks pretty good, although I’d been thinking more along the lines of a hockey puck resting flat on the bench, with a much longer hank of super-flexy cable instead of the ribbon: obviously too complexicated.
Comments are closed.