Pages: [1] 2   Go Down
Author Topic: Reverse multiplexing  (Read 1434 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Edison Member
*
Karma: 23
Posts: 1077
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to use many (about 30) switches as inputs to my Arduino Uno. I've built a circuit using four 74LS30 (nine input NOR gates) to multiplex 15 switches down to 4 pins (16th state is when all switches are off, 0000) which works. However, expanding this to accept inputs from more switches will mean that the circuitry will get VERY complicated. smiley-sad It's not just a matter of adding another 74LS30, as all the inputs on the current ones are in use. I'm limited in the number of available pins on the Arduino that I can use, as I'm also using a MotorSheild to control a DC motor and some servos.

Basically, what I need is a 32 line to 5 line (binary) multiplexer.
Is there an IC (or two) that will do this for me?
Logged

0
Offline Offline
Full Member
***
Karma: 2
Posts: 124
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I believe the correct IC for this job is the 74HC165N: the parallel to serial shift register. Sparkfun sells them but probably for 1000% markup.
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31535
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Basically, what I need is a 32 line to 5 line (binary) multiplexer.
Is there an IC (or two) that will do this for me?
There is no one IC to do this but you can cascade a number of 4051s to give you any number of inputs.
With each 4051 you get 8 inputs, so using 4 of them gives you 32 inputs going down to 4 outputs. You can feed those outputs into another 4051 to get one output. So five chips will do it.
Logged

London
Offline Offline
Edison Member
*
Karma: 23
Posts: 1077
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you can cascade a number of 4051s to give you any number of inputs.

Thanks for your reply. Looking at various circuit diags. it appears that I'll need 6 pins on the Arduino to select which switch I want to check and another pin for the input to the Arduino. Only one of the 30 switches will be on at any one time. They're magnetic reed switches to give positional information.

I'm thinking of making a second 4 * 74LS30 board and using the (4 bit binary) outputs of both these boards to input into a single 4051 so that I need only the control signals for one chip and one input line = 4 pins.
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31535
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No to look at up to 32 inputs on one arduino input you only need 5 pins on the collection of 4051s. The number of inputs you can select is given by two to the power n, where n is the number of select lines you need to use. In your case four 4051s are connected to your inputs, those four outputs are connected into a second layer 4051. While this has three select lines as you only want to select one out of four you only need to wire up two of those select lines and ground the third. The select lines on the first layer of 4051s are common so that makes five lines in total.
Logged

London
Offline Offline
Edison Member
*
Karma: 23
Posts: 1077
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Again, thanks for your help.
So that's 5 lines to select the input and one data line = 6 pins. Correct?
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31535
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So that's 5 lines to select the input and one data line = 6 pins. Correct?
Yes.  smiley
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Could also use just two 16:1 chips.
Still need 4 address lines, 1 pin to select one chip or the other, and 1 pin for the data to come in on, but you do a lot less wiring for connecting it all up.

http://search.digikey.com/us/en/products/74HC4067N,652/568-7817-5-ND/1230423
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31535
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well a bit less wiring up but the chip is more than twice the size.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

True, the chip is bigger - but you only need 2 chips instead of 4 or 5.
All comes down to the tradeoffs one wants to make.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

London
Offline Offline
Edison Member
*
Karma: 23
Posts: 1077
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1 pin to select one chip or the other

How do you use one pin to select one of two chips, as both enables are active low? Taking that one pin low would enable both of them and taking it high would disable both of them. Or have I got it wrong?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah, you are correct - I had looked at several parts, was a little mixed up about the number of enable pins.
No problem, just add a transistor as an inverter, and enable one or the other.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

London
Offline Offline
Edison Member
*
Karma: 23
Posts: 1077
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the info. I'm thinking of using 74HC4067Ns but I don't know if my local electronics store in London has them. Mail order will probably incur more shipping charges than the value of the parts smiley-sad
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That's one of the tradeoffs: what you can get vs what it costs vs how much room on the board vs how much code it takes vs ...
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 514
Posts: 31535
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Mail order will probably incur more shipping charges than the value of the parts
Yes they are only £0.91 here:-
http://uk.farnell.com/texas-instruments/cd74hc4067e/logic-mux-demux-analog-hs-24dip/dp/1740160
The trick is to order other stuff to get you up to the free shipping total, which is about £25 or so here. Once you get into electronics you will find there is always stuff you want or need. Why they even sell Arduiunos and Raspberry Pis and lots of other stuff. It is a good excuse to get interesting things. You can justify it by saying to yourself, "well I had to get it to get me up to the free postage value so in effect it is free".  smiley
Logged

Pages: [1] 2   Go Up
Jump to: