Hi all. I'm in need of an unusual IC: a multiplexer that behaves like a changeover switch in each channel. Let me explain:
In an ordinary mux/demux, the values of the select lines cause one and only one channel to be connected with the input line at a given time. Meanwhile, all other channels are connected to nothing at all. What I need is for all channels that are not connected to the input line to be connected to ground, or to a second input line that I can connect to ground.
Is there any such beast? I'm working on a prototype of a really cool tactile interface using Arduino, but I've come to realize that I can't pull it off without two dozen or so of these special MUXes (and I can't think of a way to get the behavior I need out of the ordinary 16-channel MUXes I have).
Eternally grateful for any tips.
What type of multiplex chips do you currently have?
I'm currently using the 16-Channel Analog/Digital Mulitplexer/Demultiplexer, CD74HC4067, on a breakout board from SparkFun:
Can't you just put pull down resistors on all the outputs. That way the outputs that are not connected will see ground through a small resistor in stead.
Hi MikMo. I'd be very happy to find out I've overlooked something simple like that. Mind you, I don't have a lot of practical experience with electronics yet, but I don't think this will work for my particular setup. Here's why:
The output lines are sensors, but only when they're connected to the input line (which is connected to the cathode by way of a connection to an Arduino input which effectively tells whether current is flowing through the input line). When the selected output is connected to the input line, the sensor can either be in contact with a grounded object or not, in the manner of a simple switch. When it does contact a grounded object, current flows from the cathode into ground and the Arduino registers a "touch".
Meanwhile, however (and this is the real trick), the rest of the sensors/output lines need to function as connections to ground which can be touched.
Is that too much information? The reason I don't think the pull down resistors would work is that when any given output line is selected, current would flow from input line / cathode into ground through the resistor, causing a short circuit which would register falsely as a "touch".
Thanks for the input (no pun intended). Let me know if I've misunderstood something -- it's entirely possible.
What you want is a 4053, this is three multiplexers, that act as a change over switch.
With that you can build up any sort of switching arrangements you need.
Hi Grumpy_Mike. Many thanks for this suggestion! So this is basically three changeover switches in one, where each switch has one input, two outputs, and one control line to toggle between them. I can build my "magical mux" by using an ordinary 16-channel mux to control 16 of these switches. Unfortunately, this also increases the number of ICs I need by a factor of 6. For 700 sensors, that's 282 ICs (48 muxes plus 234 4053's). This is the closest I've gotten to a solution, though. Thanks again for the tip.
700 sensors :o
If you have 700 sensors you are going to need a lot of chips no matter what you do. What sort of sensors are these, is there any other way you could read them in?
700 sensors, indeed! Quite an undertaking for my first DIY electronics project, I know. I would settle for 256 sensors if I had to (in which case I would need only a two-tier instead of a three-tier hierarchy of muxes), but that's about the lower limit. It's a bit like charlieplexing a display, I guess, in that I have a 2D grid of sensors which I plan to sample one after another. I could do 256 sensors with just 17 "magic muxes" and half a dozen resistors and diodes. As it is, I see a lot of "electric glue" in my future :o
To be of use we need:
The datasheet of the sensor
The datasheet of the chips you want to use
A schematic showing at least how you think you want it wired
Your code.
Hi Richard, mrmeval. Thanks for taking an interest. Here's a diagram which may make things a little clearer:
Disclaimer: I'm a novice at circuit schematics, and I've just learned to use EAGLE! But hopefully you can see what's going on. Four digital output pins of the Arduino control the multiplexer, while an analog input pin (actually I'm using a digital one for now, and it works fine) reads from the mux by way of a pullup configuration. Diodes to protect the Arduino are omitted.
Now, the tricky part: each pair of outputs from the mux is a potential switch -- that is, any output line may "touch" any other output line in a detectable way: each output must be connected to the input line while it is being sampled, and connected to ground when it is not (if unselected outputs float, there is no potential for a switch). At any given moment, current may flow from the cathode through the selected output and into ground via one or more of the unselected outputs. If the selected output does not "touch" any of the other outputs, no current flows.
I know this is pretty weird, but therein lies the challenge! The "magic mux" is like an ordinary 16-channel mux except that all unselected outputs are grounded. I can build one using a 4067 and multiple 4053's (which Grumpy_Mike mentioned earlier), although the amount of circuitry involved is prohibitive.
mrmeval, my Arduino code is here: http://bit.ly/9BwlBn
As of now, the device registers a touch in any of the sensors (which are just the raw output lines) when the line touches an external, grounded object. However, the trick is to detect when the sensors are touching each other.
Thanks for the suggestion, Richard: parallel muxes are a really good idea! Just to get some more EAGLE practice, here's what that might look like:
Of course, the number of sampling operations grows with the square of the number of sensors, but based on what I've tried so far with single muxes, it seems likely that this approach would support 256 sensors at acceptable sampling rates. It might even scale up to my 700 sensors and beyond. I think I can live with twice the number of chips I had imagined.
Thank you, noble forum members. I am wiser now, and closer to a great Arduino creation
I think you are making things much more complicated than you need here. From the sound of it you don't need analogue multiplexers at all but digital multiplexers / data selectors. Here an un selected output is normally a logic 1 but you can get types that revert to a logic 0 when not selected. That first diagram with only one multiplexer will not do anything as you can never detect any interaction between the two inputs.
Have you looked at a keyboard scanning matrix, that looks like the sort of thing you want to do.
Grumpy_Mike, I'm looking into keyboard scanning matrices. Perhaps that will work for me. I wonder if the patent is an issue.
You're right that there's no reason I need an analog multiplexer, although I didn't realize it would make a difference. Are you saying that unselected outputs of a digital mux don't "float", but have a definite value of logical 0? I think I need to do some reading to know whether that means I could differentiate a floating selected output from one connected to logical 0 through another (unselected) sensor.
Richard, no, this isn't for a musical instrument, directly. I really only need one bit of information for each sensor. Meanwhile, I've tried sampling my sensors with parallel muxes, and it works, although timing does seem to be an issue. For 256 sensors (simulated by looping over my 16), I've only achieved a small fraction of the sampling rate I need. Perhaps some (more) clever optimization will come to the rescue.
Are you saying that unselected outputs of a digital mux don't "float", but have a definite value of logical 0?
yes or a value of 1 depending on the type of chip.
whether that means I could differentiate a floating selected output from one connected to logical 0 through another (unselected) sensor.
No you can't differentiate between these cases, most of the time you don't need to.
It really does depend on what the sensors are. It could be that shift registers are a better way to read in a lot of digital sensors.
I wonder if the patent is an issue.
I would doubt it, you are not going to make millions of these and sell them are you?