PDA

View Full Version : Turning analog inputs into multi-switch digital inputs?



Clavis
12-08-2007, 02:11 PM
As you may notice from the other new thread I just submitted, I am interested in creating an interactive LED gameboard of some kind (or even a sort of "Stargate" DHD-type sci-fi prop!), where each square or tile is lit up from below by either a single white LED or an RGB combo.

It always occurred to me that I'd love it if I could have each tile be responsive to touch. Nothing fancy, just a simple on/off switch. But the project I have in mind would either be 21 RGB tiles or 64 white or monochromatic ones... and that's a lot of controllers!

Then I came up with a way to use an analog input controller that's so crazy it just might work :D:

If I assemble a set of resistors, each selected to resist a discrete percentage of the total analog input voltage, and connect each resistor to a momentary switch, and put them all in parallel on the same analog input circuit, then each switch would lower the voltage by a different amount, and (with the right code, of course) that could be properly interpreted as the depression of that switch, and (for example) the appropriate LED could be illuminated!

(Hell, for all I know, that's more or less how early electric keyboards worked! :tongue:)


In other words, for example, if I have switches labeled A through H, and switch A allows the analog input to receive 0.5V, and switch B allows the analog input to receive 1.0V, and so on all the way up to H, which provides 8.0V to the analog input, then it should be simple to write code that interprets each of these discrete voltage amounts as "representing" the depression of a particular switch, so that the rest of the code can respond appropriately.

In fact, theoretically, if I come up with the right combination of resistors for each "column" of switches, I could even arrange it so that you could press more than one switch at the same time, and the code would recognize that unique new aggregate resistance properly as the combination of certain depressed switches!

However, even if you *could* only press one button at a time -- and that certainly would be easier -- that's still a way to, for example, turn 8 analog inputs into 64 digital inputs! That's enough to create a fully interactive, light-up chessboard with only an LED64 controller and a single 8/8/8 controller (you could use the other I/O connections for things like GAME SELECT and RESET and whatnot!), or to create a Stargate dialing device, where the tiles light up and unique SFX are triggered as you press them down.

Damnit, why can't I win the lottery so I can just buy a bunch of Phidgets!?

Anyway, I was just curious if this was feasible, or if anyone has actually tried it and had some success?

Rock on, y'all! :veryhappy:

Dave
12-12-2007, 01:33 PM
That trick definitely works. I rigged up a system similar to what you're talking about back when I was in college. I was using a 68HC11 dev board, not an 8/8/8, but the concept is the same. I had no real reason for doing this, I think I was just struck by the idea and wanted to try it.

For each button, I used a precision multiturn potentiometer to create a voltage divider that could be tuned to a very specific voltage. I only ended up using five of them on one A/D input, but I'm sure you could cram a lot more in there. Since the 8/8/8 has 10-bit inputs, you could theoretically increment each button by 5 mV and put 1023 switches on each analog input! Actually, the 0-1000 limitation in the Phidget system would limit you somewhat, but you get the idea. Realistically though, I bet you could get 20 switches to work reliably on one input without much trouble.

Now the problem of identifying multiple buttons simultaneously in a system like this, that's a tough one. For that you'll need to consult someone who has much more free time than I do.

Clavis
08-29-2009, 08:03 AM
Hey, I'm actually working on a project (FINALLY!) that's using the principle I describe at the top, but now that I actually have the LCD / 8/8/8 unit, I see that the Analog Input has 3 contacts: +5V, ANALOG INPUT and GROUND. Even the diagram for hooking up a simple potentiometer shows that all three contacts are used. I'm afraid my electronics skills are insufficient for me to grasp the concepts, so... if I wanted to build the circuit I describe above, and I just want to use simple resistors (instead of pots that have voltage dividers with which I could hook up to all 3 contacts), so that the only contacts used in the Analog Input circuit at all were the +5V and ANALOG INPUT (between which would be the big resistor/switch circuit described), would that work? Does the 8/8/8 unit care if anything is going to GROUND in conjunction with any particular Analog Input?

Is it that the Analog Inputs need to have a total of 5V coming in at all times between ANALOG INPUT and GROUND, and the ratio between them determines the returned value, such that having zero volts going to GROUND would mess up the circuit or even be dangerous? Or is it just that complex sensors (with onboard chips running code and whatnot) all generally need to be hooked up to a steady +/- circuit, and need that 3rd contact (ANALOG INPUT) to which to actually send the sensor signal?

Thanks very much for your help!

Adrenalynn
08-29-2009, 12:53 PM
No ground, no circuit.

GND -> goes to your circuit and the board
+5v -> goes through your circuit -> goes to the analog input

Whatever remains of the +5v after your circuit works it over is the analog input value that then gets scaled to digital.

MikeG
08-29-2009, 02:12 PM
Old keyboards were of the matrix variety. The pressed button is determined by the button's location, row and column. A simple parallel to serial shift register can be used to convert the row/column to a binary number which is shifted one bit at a time to a micro. Or you can skip the shift register and go with a microcontroller.


http://www.parallax.com/Portals/0/Images/Product%20Information/Microcontroller/keypad.gif
(http://www.parallax.com/tabid/405/Default.aspx)

Clavis
08-29-2009, 10:32 PM
Thanks for the helps, folks... Unfortunately, I'm a little confused -- I thought things went *to* GROUND, not the other way around... but maybe I'm thinking (literally) backwards...

Anyway, here's a picture that represents what I'm trying to do -- this diagram represents the five switches I would hook up to one analog input... I recycled graphics from the LCD / 8/8/8 PDF, and made a change based upon Adrenalynn's feedback (great name, by the way) ... Please check this out and see if at least it makes sense, even if it may not work...

http://i31.tinypic.com/20kc51y.gif

I guess I know a heck of a lot less about electronics than I thought I did (which would explain a few things), but... can anyone tell me why my idea above won't work, and what basic concepts of electronics I'm failing to grasp that led me to this sorry state of affairs?

lnxfergy
08-29-2009, 10:57 PM
http://forums.trossenrobotics.com/attachment.php?attachmentid=1458&stc=1&d=1251604435
Connecting 5V to ground is a sure way to blow stuff up. I'm guessing that's an error though in your schematic. If you take the link out between 5V and R0 (leave R0 connected to ground), this should work. However what if two buttons are pressed? You'd have to make sure that you choose your resistors such that you can tell which buttons are pressed even if two or more are pressed at the same time, or make it well known to the user that two cannot be pressed at th same time...

EDIT: I'd also probably make sure that R0 > all other R, so that it quickly pulls the state back down to 0V when the switch is disconnected....

-Fergs

jes1510
08-29-2009, 11:10 PM
You are seriously limiting the capabilities of this project by using one analog input and the phidgets board. There are a number of small LCD's on the market that also have a keypad input for around 16 keys. Take a look at matrix orbital. Here is one that might work but they sell a bazillion different ones:
http://www.matrixorbital.com/lk2047t1utci-p-227.html

Note you can also do the same with a microcontroller. They are cheaper but you don't get the cool LCD.

MikeG
08-30-2009, 12:20 AM
Thanks for the helps, folks... Unfortunately, I'm a little confused -- I thought things went *to* GROUND, not the other way around... but maybe I'm thinking (literally) backwards...This image might be easier to understand :cool:

http://engknowledge.com/documents/uC_Interfacing_Keyboard_Fig1.PNG

Adrenalynn
08-30-2009, 01:52 AM
It's a great matrix, Mike, but aren't you doing multiple digital inputs there?

And yeah, if you hooked it up that way Clavis, it'd destroy the microcontroller

Clavis
08-30-2009, 06:35 AM
Wow, I suck. You guys are all being very helpful, but now I'm even MORE confused than I was the first time!

Please forgive my childlike grasp of electronics: I was under the impression that the way a circuit worked was that you connected, say, an LED to a safe voltage source -- the cathode to the +5V side, in effect, and the anode to the GROUND. Now I'm being told that connecting +5V to GROUND will blow up the circuit.

Why does there even need to be a GROUND *and* an ANALOG INPUT? Is the ANALOG INPUT a voltage input or a voltage output? Why do I need to send the electrons in two directions at once? In other words, if +5V is voltage out, and ANALOG INPUT is voltage in, and it reads a differing voltage in as the differing signal to be interpreted, then what's the point of having GROUND as well? Is there some whole new third category of electron movement with which I've been completely unfamiliar all this time. like "up" or "sideways"? This is remarkably frustrating... I mean, again, forgive my stupidity, but if R0 in my diagram is only connected to GROUND, and I press (say) R1, so that a certain number (below 5) Volts passes through R1 and to the rest of the circuit, why is it important that the voltage split in two directions and get distributed between ANALOG INPUT *and* GROUND? And if it's okay for voltage -- potentially almost 5V -- to go to GROUND when I push a button, why would it blow the circuit up for the +5V to be going straight to GROUND as in my diagram? How the hell does the Phidget know if the voltage is getting to GROUND directly or through a switch or resistor, and why would it make any difference?

I guess if you really wanted to, you could take all my questions above and distill them into one question: WHY THREE CONTACTS FOR THE ANALOG INPUTS? WHAT TO THEY *DO*?!?

Thanks again for your help. I've been psyched to play with these Phidgets for a long time, and it's annoying to get to this point and then discover that I haven't the slightest idea what I'm doing...

Clavis
08-30-2009, 07:00 AM
Adrenalynn, I guess your specific advice also confuses me. You say:

"No ground, no circuit.

GND -> goes to your circuit and the board
+5v -> goes through your circuit -> goes to the analog input

Whatever remains of the +5v after your circuit works it over is the analog input value that then gets scaled to digital."

I totally don't get what you mean by "GND -> goes to your circuit and the board". I can't connect GROUND to the board; GROUND is already ON the board -- it's one of the three connector pins. Do you mean connect my circuit to GROUND?

"+5v -> goes through your circuit -> goes to the analog input" Okay, that was my original idea. Then I was told that I need to include the GROUND connection.

Again, what you're saying seems (I guess) to fit lxfergy's suggestion to leave R0 connected to GROUND, but it still doesn't make any sense to me, probably because I don't understand how the Analog Inputs work in theory. It seems like I'm supposed to include GROUND in the circuit as some sort of good luck charm or out of charity.

Again, to use the example Trossen gives in their PDF of a potentiometer connected to an analog input:

http://i28.tinypic.com/10p1t8z.jpg

They have it hooked up to all three connections. Isn't the above diagram showing (if you turned the pot all the way to one side) +5V connected to GROUND? Doesn't that mean THIS would blow up the board, too? I know you can use a pot by only connecting up two of the connections... so what exactly is it about the Phidget (or about electronics in general) that makes is necessary to use all three connections?

I'm in Google right now, trying to find an explanation of why people sometimes use 2 of the pot's connections and sometimes all 3... I had no idea I was so ignorant...

MikeG
08-30-2009, 10:18 AM
@Adrenalynn The image came from an internet search. It looks right though, two ports and I'd have to assume that the rows and columns are not tied together until the button is pressed.

@Clavis Ground is a common point where voltage magnitude are measured from; on a number line ground would be zero.

lnxfergy
08-30-2009, 10:57 AM
Now I'm being told that connecting +5V to GROUND will blow up the circuit.

Connecting 5V directly to ground, with no resistance in between, will cause near infinite current pass from through the circuit -- that will blow up either the 5V supply, or burn up the traces on the PCB, whichever gives first.


Why does there even need to be a GROUND *and* an ANALOG INPUT? Is the ANALOG INPUT a voltage input or a voltage output? Why do I need to send the electrons in two directions at once? In other words, if +5V is voltage out, and ANALOG INPUT is voltage in, and it reads a differing voltage in as the differing signal to be interpreted, then what's the point of having GROUND as well? Is there some whole new third category of electron movement with which I've been completely unfamiliar all this time. like "up" or "sideways"? This is remarkably frustrating... I mean, again, forgive my stupidity, but if R0 in my diagram is only connected to GROUND, and I press (say) R1, so that a certain number (below 5) Volts passes through R1 and to the rest of the circuit, why is it important that the voltage split in two directions and get distributed between ANALOG INPUT *and* GROUND? And if it's okay for voltage -- potentially almost 5V -- to go to GROUND when I push a button, why would it blow the circuit up for the +5V to be going straight to GROUND as in my diagram? How the hell does the Phidget know if the voltage is getting to GROUND directly or through a switch or resistor, and why would it make any difference

The quick version: In a circuit, we have voltage (also known as potential) and current. For your circuit, voltage is what is important. Effectively, there are various voltage levels, 5V is a voltage level. Just like we have to start counting from somewhere, 5V does not make any sense unless we define what 0V is.. in this case that is GROUND. There is a 5V difference in potential between the 5V pin and the ground pin.

Digital inputs are always either 5V or Ground (naive view, but we'll leave it at that). For an analog input, the voltage can vary infinitely between 0V (the ground reference) and 5V (the source). If we take out the part of the circuit I have labeled BOOM, and connect the R0 between the ANALOG_INPUT and GROUND:


When no switch is closed, the input is connected only to ground, via a resistor. It's voltage level is 0V. The resistor is important - if any current were to trickle into the input, the voltage level would float around, this resistor is a pull-down resistor.
When you close any switch, you create a voltage divider. If we are using conventional current, the current flows from 5V through a resistor, Rx, into the junction with ANALOG_IN, some of that current then flows on through R0 to ground. The voltage at the junction is a function of the resistors, V = 5V*(R0/(Rx+R0))

The reason the circuit doesnt explode is the resistors -- they limit the current through the circuit. That said, your resistors will be in the >1k range most of the time. That's about all I can easily say without writing a book. There are numerous online tutorials on electronics out there.

-Fergs

Clavis
08-30-2009, 10:59 AM
@Clavis Ground is a common point where voltage magnitude are measured from; on a number line ground would be zero.

MikeG, I appreciate your efforts. However, I am trying to make my circuit work using the Phidget 8/8/8 unit I purchased and am trying to understand the function of the three connections of the Analog Input connector of that Phidget. I am not trying to understand the ins and outs of the alternative circuit you provided. Thanks anyway. :happy:

lnxfergy
08-30-2009, 11:02 AM
MikeG, I appreciate your efforts. However, I am trying to make my circuit work using the Phidget 8/8/8 unit I purchased and am trying to understand the function of the three connections of the Analog Input connector of that Phidget. I am not trying to understand the ins and outs of the alternative circuit you provided. Thanks anyway. :happy:

That is a universal truth though! Ground is always a reference, 0V...

-Fergs

Clavis
08-30-2009, 11:16 AM
Connecting 5V directly to ground, with no resistance in between, will cause near infinite current pass from through the circuit -- that will blow up either the 5V supply, or burn up the traces on the PCB, whichever gives first.



The quick version: In a circuit, we have voltage (also known as potential) and current. For your circuit, voltage is what is important. Effectively, there are various voltage levels, 5V is a voltage level. Just like we have to start counting from somewhere, 5V does not make any sense unless we define what 0V is.. in this case that is GROUND. There is a 5V difference in potential between the 5V pin and the ground pin.

Digital inputs are always either 5V or Ground (naive view, but we'll leave it at that). For an analog input, the voltage can vary infinitely between 0V (the ground reference) and 5V (the source). If we take out the part of the circuit I have labeled BOOM, and connect the R0 between the ANALOG_INPUT and GROUND:


When no switch is closed, the input is connected only to ground, via a resistor. It's voltage level is 0V. The resistor is important - if any current were to trickle into the input, the voltage level would float around, this resistor is a pull-down resistor.
When you close any switch, you create a voltage divider. If we are using conventional current, the current flows from 5V through a resistor, Rx, into the junction with ANALOG_IN, some of that current then flows on through R0 to ground. The voltage at the junction is a function of the resistors, V = 5V*(R0/(Rx+R0))

The reason the circuit doesnt explode is the resistors -- they limit the current through the circuit. That said, your resistors will be in the >1k range most of the time. That's about all I can easily say without writing a book. There are numerous online tutorials on electronics out there.

-Fergs

Oh, my god, thank you. LOL I was stomping around my apartment, saying to myself, "It *cant'* be that the big objection everybody had to the fact that I had the 5 volts going straight from +5V to GROUND was that there was no current-limiting resistor, could it? That's crazy; OBVIOUSLY, I could throw a current-limiting resistor in there right before GROUND... it must be something else... but what could it *be*?!?" That's a riot.

So that was really it? It's not bad that I was sending approx. 5V to GROUND; it was that I didn't include a current-limiting resistor in the circuit?!! LOL Wow. I feel stupid for not including a mention of that possibility in all my rambling... but I'm very happy that it's an explanation that totally makes sense to me!!!

So below is my new circuit, based upon the suggestions, just to be clear:

http://i32.tinypic.com/2ewz69s.jpg

So I'm going to lay this out on a breadboard, using a multimeter rather than the Phidget at first, until I know that R1-R5 are all sufficiently different from one another, and all work nicely in conjunction with R0, so that the resulting Phidget readings are all easily usable in my programming... AND so that I know I'm not going to blow up my Phidget!

Thanks very much, lnxfergy (and everyone else, too!) -- I know I have a lot to learn, and I'm very glad there's a community out here of people with the knowledge and the kindness to help a brother out!

P.S. Just read the Wiki entry on pull-up (and pull-down) resistors. Another thing I learned today! :) Thanks again!

Clavis
08-30-2009, 11:22 AM
That is a universal truth though! Ground is always a reference, 0V...

-Fergs

Now I understand better what both you and MikeG mean. Thanks, both of you! :veryhappy:

Clavis
08-30-2009, 01:28 PM
No ground, no circuit.

GND -> goes to your circuit and the board
+5v -> goes through your circuit -> goes to the analog input

Whatever remains of the +5v after your circuit works it over is the analog input value that then gets scaled to digital.

Okay, so my understanding (or misunderstanding, as the case may be) based partially on your response above, is that, for the Phidget's Analog Input to register, there needs to be a complete circuit between +5V and GND (through the appropriate current-limiting resistor, of course!), *and* voltage can also flow into the ANALOG INPUT connection, where it will be converted into the A.I. value. And because the ANALOG INPUTs are logic inputs, they cannot (or, at least, DO not) act as circuit grounds, yes?

I hope I have this right. I really appreciate your help. I had no idea I was wading into such deep waters! :tongue:

Adrenalynn
08-30-2009, 01:59 PM
Just to be clear: The lowest possible potential in a circuit is called "ground".

Electricity flows from negative to positive - seems counter intuitive, but... Let's look at the physics:
Atoms have negative and positive sides which attract each other. Nature abhors a vacuum, right? If there is a difference between the amount of negative and positive atoms at one end of the wire versus the other, then the atoms will move or "flow" to equal out the difference. The negatively charged electrons will be attracted to the positively charged electrons, and will move towards the positive electrons, this is what we call the flow of electric current.

You are "tapping off" the circuit to bring it in to the analog input before it goes to ground. You're doing this through what's called a "voltage divider circuit" as, I believe it was Fergs, mentioned above. The analog input has its ground on the "other side of the microprocessor" - ie it's traveling through it.

The circuit and the microcontroller must share a common ground. Why? Remember that we said earlier that "ground" is defined as the lowest possible potential in a circuit? Well - that potential must match or our flow gets wonky, and our levels can never match up.

I know this seems like we're making this deliberately obtuse, but a little understanding of the physics behind it goes a long way towards understanding how one has to design a circuit. Everything we do in electronics design is nothing more than herding electrons...

Clavis
08-30-2009, 03:04 PM
Adrenalynn, thank you for that. I actually knew most of it already, even the counter-intuitive "really, it's actually going from negative to positive, thank you Ben Franklin" part :wink:; believe it or not, part of my frustration came from not explicitly ruling out the lack of a current-limiting resistor in my original circuit as the cause of the "BAM" scenario... I should have mentioned that earlier...

Also, I wasn't thinking about the (in retrospect) obvious difference between a logic input and a plain old Ground, and the relative functions of specifically the Phidget unit's GROUND and ANALOG IN. I'm not sure I'm 100% on them yet, but I'm definitely closer! Thanks for all your help.

Clavis
09-06-2009, 04:20 PM
Hey, guess what? Turns out, even if you take care to put a current-limiting resistor into your circuit, if you don't have a spare 3-hole analog sensor plug lying around (and I don't), and you try jerry-rigging connections into the 8/8/8 Analog Input so as to try out your new circuit, that you can accidentally (I assume this is what happened) short between +5V and GROUND inside the jack and blow out the 8/8/8 completely! Now it doesn't show up in the Ph USB menu at all! ZAP!!!

I was going to rant and rave about sending a kit without the necessary connectors to connect into the thing (all the other connections have little screw terminals), but I assume it's a standard jack and I just shouldn't have risked it... but I worked really hard to protect the contacts from one another, and I wanted to test the damn thing to make sure it worked. Well, I tested it, and it worked, and I tested it some more, and now it doesn't work at all.

Oh, well... add another $99 to my investment on this project. [Excrement].


P.S. I don't care to what degree this was my fault right now. I really don't. I'm just so [Reproductive activities marking their territory]

Clavis
09-06-2009, 05:30 PM
This image might be easier to understand :cool:

http://engknowledge.com/documents/uC_Interfacing_Keyboard_Fig1.PNG

Your prospect intrigues me. I'm thinking I might want to scrap the analog inputs keypad idea entirely, given that experimenting along those lines just cost me $99, and so I'm looking into using 4 of the digital outs and all 8 digital ins and creating a 32-key keypad array. I just need to figure out how to connect the digital outs to the digital ins without blowing up another 8/8/8! :genmad:

MikeG
09-07-2009, 09:19 AM
Consider using parallel to serial shift registers.

74HC165/74HC164 (8-bit)
http://focus.ti.com/lit/ds/symlink/sn74hc166.pdf

SN74LS674 (16 bit)
http://focus.ti.com/lit/ds/symlink/sn74ls674.pdf

The 74HC165/4 is under a buck.

The shift registers will isolate the matrix key board circuit from the controller. However, you’ll need to understand the datasheets and use a controller to shift (clock) the bits. I’m not sure if the Phidget 8/8/8 device is the best way to go, that is if I understand your requirements.

On the 74HC166 set the SH/LD pin LOW to strobe the CLK pin. This grabs 8 lines of parallel data from the matrix keyboard. Set the SH/LD pin HIGH and clock each of the 8 bits out the SER pin and into your controller. I like the Parallax STAMP controller because they are very easy to program, the documentation is excellent, and PBASIC come with commands to do this sort of thing with only a few lines of code.

If I remember correctly, you wanted to light LEDs too. Well do the opposite. The 74HC164 is a serial to parallel shift register.

So you can get the job done with 74HC165s and 74HC164s, various buttons and resistors, and a micro-controller.

BS2 starter kit.
http://www.parallax.com/Store/Microcontrollers/BASICStampProgrammingKits/tabid/136/CategoryID/11/List/0/SortField/0/Level/a/ProductID/313/Default.aspx

Edit:
Example using shift registers or I2C (PCF8574)
http://www.zbasic.net/appNotes/AN205.pdf

robologist
09-07-2009, 04:34 PM
Here is a connection article for an analog keypad :
http://www.ednasia.com/article-9327-twowirefourbyfourkeykeyboardinterfacesavespower-Asia.html
http://www.ednasia.com/cmsimages/0612pg76_f1.jpg

Clavis
10-09-2009, 05:48 AM
Hey, guys. I'm working hard on my project, and plan to get two 0/16/16 units, not only because they'll let me simply and reliably control 32 digital inputs (not to mention not having to worry about multiple buttons being pressed at the same time), but because I figured out a use in my project for having a lot of outputs that I can connect to relays. (I plan to control a bunch of hacked MP3 players to provide SFX, and I can use the digital outs to employ relays to activate the buttons on the MP3 players.)

However, in case I did want to do something where I use the analog inputs to register one of a set of resistor values, it looks like this would solve a lot of my problems in terms of trying to build the necessary circuit:

http://www.phidgets.com/products.php?product_id=1121

It seems like this item recreates most of the circuit I was originally trying to build, and that all I'd have to do would be to connect the set of parallel resistor/switch combinations and I'd have my switches. Am I correct in assuming this?

Cheers!

Robert
10-09-2009, 03:18 PM
Here's a quick way to do it. I used to use this method on my old lego mindstorms computer.

http://www.annoyingrob.com/Phidgets/multi_switch.jpg


The idea is that each resistor is twice the previous one, creating a series of distinct analog voltage levels depending on which combination of switches is pressed. If all of your switches are pressed, your analog voltage goes up to around 985 on the 888. If all are unpressed, the voltage goes down to around 496. Any combination of switches can be decoded into a distinct number between 496, and 985.

jes1510
10-09-2009, 03:24 PM
You may want to look at a multiplexer. There are chips out that will allow you poll 16 A/D pins using 5 pins on your microcontroller.

Edit: Sparkfun offers a breakout board that looks like it may be useful:
http://www.sparkfun.com/commerce/product_info.php?products_id=9056

Adrenalynn
10-09-2009, 05:18 PM
If you use a Ladder as Robert describes, watch your tolerances on the resistors. 2 x 10% could mean a 20% error. At the extreme there could be some confusing signals, so don't tune your code too tightly or you might miss a switch.

Clavis
10-09-2009, 05:27 PM
LOL Thanks, guys. It's funny that I found that Voltage Splitter *after* I'd made the decision to switch to using (2) 0/16/16 units... but like I said, it turned to be fortuitous, because my new idea for providing SFX for my project is to have literally 4-7 little $20 MP3 players, and with the 0/16/16, I can just wire all the VOL UP / VOL DOWN / PLAY-PAUSE / NEXT TRACK / PREV TRACK / POWER /etc. buttons up to relays and hook those relays up to the digital outs on the 0/16/16. Without the (2) 0/16/16 units, I'd never have the outputs necessary to do all that manipulation. Plus, it means I can wire my buttons up individually and not be worried about resistors or button combinations or anything like that!

Anyone ever use Vex sensors with their Phidget inputs? They have a Rotary Encoder that looks like it would plug right into one of the Analog Inputs!

Robert
10-19-2009, 12:59 PM
If you use a Ladder as Robert describes, watch your tolerances on the resistors. 2 x 10% could mean a 20% error. At the extreme there could be some confusing signals, so don't tune your code too tightly or you might miss a switch.
Use 0.1% resistors. They're cheap :)

Adrenalynn
10-19-2009, 03:08 PM
Agreed - as I said "watch your tolerances". I probably should have written "don't buy the cheap Radio Shack packaged resistors" to be more clear.

xdream
10-19-2009, 03:17 PM
Those digital matrix decoders are readily available as keypad switches that can be bought at radioshack or even surplus like BGmicro.

The original idea is a good one (taking care of the 'short' typo) if you want to convert analog to various digital...most people tend not to need that much digital I/O and use a matrix encoder when they do....

You should experiment and get your idea to work and see what you learn! :)
mark

Clavis
10-20-2010, 07:51 PM
Hey, guess what, gang? Since I'm trying to finally get my act together with this project I've had on hold since forever, I finally tried out Robert's circuit on my 8/8/8 (using a real analog input cable this time, and not a bunch of jerry-rigged wires)... and it worked! I'm not totally hopeless, after all! :tongue:

Thanks, everybody, for your help! :happy:

carrycorrie
01-09-2011, 11:42 PM
Thank you so much for the wonderful information that was posted here, it was very helpful. Thank you for sharing to us here.

-------------
Day Planners For You (http://betterdayplannersforyou.info/Classic_Cornerstone_July_09_Planner_Refill_Bundle. aspx)