As we go through it I'll explain whatever background info you need to know, so as long as you can blink a button, read a switch and read an analog input, you'll be fine. If you can't do any of these, I'll point you in the right direction in the relevant steps as well.
Remove these ads by
Signing UpStep 1: Parts List
1 x Arduino (Obviously)
1 x 100K Resistor (Brown Black Yellow)
1 x 1K Resistor (Brown Black Red)
1 x 10K Resistor (Brown Black Orange)
1 x 33K Resistor (Orange Orange Orange)
1 x 68K Resistor (Blue Gray Orange)
4 x Push button switches
Some wires to connect it all
You can use any push buttons you might have lying around, and the resistor values are not critical. More on this later.










































Visit Our Store »
Go Pro Today »




I'm currently supplying the Arduino's 5V to it, and taking meter readings (disconnected from Arduino) and actual analogRead values (connected to Arduino) to correlate and get an idea of what I'll see. So far it looks logarithmic, suggesting a good spread of resistor values would be 1k, 10k, 37k, and 100k.
At the same time, I have to look up the combined parallel resistances to see what kind of spread they give... Rtotal = (R1*R2)/(R1+R2).
The logarithmic scale, if borne out, suggests higher resistances will give me less variance in analogRead values. Example: choosing R1=220 ohms, and R2=470 ohms, my parallel resistance is 149.86 ohms. But, at that point in the log scale, I expect my analogRead values to be around 220ohms=1002, 470ohms=978, 150ohms=1009. So that split between 1002 and 1009 isn't comfortable enough to account for resistor quality differences.
Instead, if I choose larger values, I hope to get a wider spread of analogRead values to work with.
Sometimes its nice to have the responsiveness of direct PWM on some channels, and 1 or 2 channels of other "actions" at the receiver.
I was just trying to implement your instructable in my project. I connenced the buttons according to your sketch. I used 22K, 33K and 47K resistors and 100K as a pull down resistor.
Now the buttons are working and like whn I press them, I can see the values change in the serial monitor. However, when it comes to calculating the range, the value doesnt fluctuate. Its the same value repeating. Like for button 1, the range is 1023. for button 2 the range is, 838-839, for button 3 it is, 658-659 and for button 4 it is, 503-504.
So, I am confused now. Like should I put down these ranges in my sketch or what?
Can you please help me out :/
1+2: 6.66K
1+3: 8K
1+4: 8.88K
1+2+3: 5.7K
As you can see, the multiple button presses result in resistances that are all very close together (and close to the button 1 resistance).
I'm wondering if there wouldn't be some way of rewiring the circuit to get the resistors in series when multiple buttons are pressed... Off the top of my head, I don't see an easy way, but it is after midnight here.
I have to admit, I haven't worked with any electronics for a while, so maybe I'm missing something obvious, but I don't see an easy way to convert conductance into a voltage that the Arduino would be able to measure.
Thanx a lot,
Alex
I guess you could deal with that in code. If you had button 1 tied to the supply voltage with no resistor, you know its value would be constant. So use button one to start a calibration process where you press each button in turn and the software records the new values for each button.
Of course then you need some form of memory to store the new values and it all starts getting more complicated again. Still, you could make it work if you were desperate enough :)
Of course, for a commercial venture, I would just use a micro-controller with more IO lines.