im having a hard time wrapping my head around the "best" method for reading 3 SPDT buttons to drive a simple LCD menu. i started to build a r-2r ladder and figured there might be a more reliable and/or efficient approach that can take advantage of the NO contacts. any thoughts, ideas would be much appreciated! cheers!
-sj
btw, these are momentary break before make switches.
With 3 switches, providing they are not capable of "centre-off" there are only 8 possible binary permutations. It matter not whether the switches are SPST or SPDT. Therfore your proposed R/2R D to A convertor resistor chain is the simplest way of inputing to the arduino. And it only needs one input using an 8 level discriminator to determine which, if any, of the switches are activated.
the application is driving a simple LCD menu. the problem is don't what im doing.
Is there any reason why you want to use the same pin?
I would suggest the best method is to treat them just like a normal push to make button.
The best best method is to feed them into a flip flop and totally eliminate contact bounce but I don't think you have need to go so far.
i would like to save as many pins/cycles as possible for upgrade-ability/performance.
while it may or may not be needed for this application, any performance/reliability gained by doing things a little differently adds to my experience / knowledge base. the flip flop sounds like it may be what im after....
With 3 switches, providing they are not capable of "centre-off" there are only 8 possible binary permutations. It matter not whether the switches are SPST or SPDT. Therfore your proposed R/2R D to A convertor resistor chain is the simplest way of inputing to the arduino. And it only needs one input using an 8 level discriminator to determine which, if any, of the switches are activated.
no "centre-off" aside from a brief break before make. these switches were designed for a single throw, not like a camera button with 1/2 press to focus.
so aside from feeding a flip-flop, there is no advantage to the spdt?
cheers!
-sj
Keep It Simple! Don't use complex circuits and active components when passive components and simple circuits will do just fine.
simple isn't always the "best" route... whats "just fine" for one person may render a product worthless to another who uses it in a different manner. there are applications where latency and reliability are paramount to the product's function. this project is a stepping stone to larger, more ambitious goals. if there are faster, more reliable methods for interfacing a switch, i would rather experiment with them now so i have a better understanding of my options when designing my next circuit.
There are millions of consumer gadgets out there that use simple resistor networks for detecting multiple buttons.
just because a product makes it to market does not mean it doesn't suck. i've had the displeasure of owning/attempting to use many such devices!
-sj
i just wanted to know if there was a better / different way of achieving the end result so i can learn the advantages and disadvantages 1st hand. its easier / cheaper / faster to learn from my mistakes with 3 buttons than it is to make a mistake midway through constructing a device with 50 or so.
fwiw, i would eventually like to build a universal real time control surface for live dj performance. i currently use a m-audio trigger finger for a lot of my input workload. while i do like some of the aspects of this controller for live performance... alone, it falls short input wise for the type of control integration i would like to accomplish. for this application, lowest possible latency, performance consistency and high reliability are requirements.
-sj
The Flip-Flop is somthing for managing your double-throw thingy, also debouncing it electrically at the same time....
Multiplexing the switches, be it analog voltage or digital time multiplex is another business..
As already said by others, a resister ladder of whatever kind is a very good and underestimated solution. As you have to identify multiple switch settings this is limited to 8 or when are bold to 9 (Don't use the LBS of the ADC..)
For tact switches you will generally have to detect one press at a time only, which would allow for a hundred buttons to connect to a single analog line!!!
122 - idle
188 - L
198 - C
248 - R
335 - L + C
402 - L + R
506 - C + R
1023 - L + C + R
that 188 & 198 look a little close... i could have done a better job picking the resistors. i didn't have any precision that were a factor of two on hand though.
the click on these switches is likely the most satisfying thing one can experience with his/her pants on! the legends didn't turn out too good, but i printed them on these wacky inkjet mailing labels.... i might head over to the office supply store and print up a sheet on a heavy transparency / laser printer.
The 2-dimensional array of switches using R/4R ratios to get unique values for each button.
Using a 555 timer chip in lieu of an analog input on their old-technology microcontroller. Of course this is much easier with Arduino analog input.
clever! looks simple & clean.
my dad informed me that he salvaged 2 really nice keypads from some gear headed to the recycler! im anxious to see what he got! im a sucker for industrial controls!
-sj
The array shown above, whilst very nice at identifying each key, has the disadvantage that it can only "see" one key at a time. If any key on the lower line is closed, all keys above it are ignored.
What would be ideal is a system that can identify any combination of keys.
Hence the use of a binary translator suggestion (3 keys = 8 possible permutations) previously entered.
The general idea of matrix arrangement is reducing the amount of wiring, at the cost of adding additional circuitry. This is a trade-off in all cases.
In an LED matrix you get diodes for free. If you are willing to solder a diode in each key matrix junction you can identify all combinations of pressed keys in a scan cycle.
so what happens if you press any 2 (or more) keyboard keys on one of your standard computer keyboards. Does the board inbuilt software output the last key pressed or does it create some new code that is a combination of the two keys. Get my popint ?
If you want a micro system that can read a variety of input switches, surely it must be designed to read all switches which are being operated, irrespective of the number.