Pages: [1] 2   Go Down
Author Topic: programing and wiring 2 Multiplexer / demultiplexer with arduino  (Read 7126 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello I am very pleased to participate in this community!
I recently developed an autonomous airship project. For this project I wish to receive information from 30 sensors and send commands to actuators 18.
I have a Arduino mini pro 328  three multi / demultiplexers 74HC4067  buy from Sparkfun
I learn about their installation and programming but I do not see:
1) how the physical cable to the card (ie if the 2 multiplexer and demultiplexer are on the same digital inputs?)
2) how to manage these two groups in programming

thank you to you!
to help me in this project
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 635
Posts: 34574
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You cannot use a 74HC4067 to multiplex outputs. Well you can but only one output can be active at any one time and all the rest of the outputs will be high impedance. You are not the first to be caught out about this but there is a lot of wrong information about.
To get multiple outputs you need to use either a shift register, port expander (like the 23S17), or something with a latch.
For examples of these see my projects:-
http://www.thebox.myzen.co.uk/Hardware/CNC_Conversion.html - uses port expander
http://www.thebox.myzen.co.uk/Hardware/Transistor_Tester.html - uses latched multoplexer
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
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

To control these, you connect 4 arduino outputs to the S0-S1-S2-S3 pins, that will select which I/O path thru the device will be connected.
Then you will have 4 more arduino outputs that will function as chip selects. You will write out S0-S3, then enable one device at a time.

Connect the common I/O pin (pin 1) for the 2 sensor selector parts together and connect to your digital input pin.
The combination of S0-S3 and the 2 enable pins will select which of the 32 outputs will appear at your digital input pin.

Connect the common I/O pin for the 2 actuator selector parts together and connector to your digital output pin.
The combination of S0-S3 and the 2 enable pins will select which of the 32 outputs will follow the actions of the digital output pin.
Be aware that when no outputs are selected, the pins will not be Hi or Lo, you will need a  pullup or pulldown resistor to put the actuator in its Off state.

If you want to use just 1 arduino pin to both read the sensors and drive the actuators, that is possible also.
Connect the common I/O pin from all devices to the arduino.
Your code will have to change the mode of the pin as you use it:
for reading, pinMode(ioPin, INPUT);
set S0-S3, enable one of the sensor input parts
then read the signal

for writing, pinMode(ioPin, OUTPUT);
set S0-S3, enable one of actuator output parts
then write your actuator signal  hi/lo, or lo/hi, as needed.

Does that make sense?
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.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

great!
thanks Grumpy_Mikegood projets...

 CrossRoads
yes that make sense to me!
2 solutions . can you make a drawing of them ?
because y dont read english very well and y dont want too make mistake
y dont need 32 actuator only 18 that s why y try to use only one demultiplexer

y  try to use   tree     74 hc 6067 bread bord



thanks a lot and have a caribeean sun
 








Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
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

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)
Offline Offline
Brattain Member
*****
Karma: 635
Posts: 34574
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the way to do it with latched outputs, so that once you have set an output to a level it stops at that level.
Note this was drawn for an old computer, the reference to a "User Port" is what you would call an arduino pin. Note you can use any arduino pins but avoid pins 0 and 1 as they are for the serial comms.


* multiplex.png (34.89 KB, 1520x705 - viewed 119 times.)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello
my loggin name is angoo
and y am talking with you  in the forum about multiplexing/demultiplexing
i m work on it
but i dont know how to post image and code
there is some information on the old forum but i dont find in this one
thanks for help!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 635
Posts: 34574
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just sent you a PM but for others.
For code click the # icon above the reply box and paste the code between the brackets that pop up.
For a picture click the Additional Operations... below the box and brows for your picture.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank
Grumpy
for the explication

 the code downside it made by  SHYWODD
on the french forum




Code:
/*
S0 -> digital 7
S1 -> digital 8
S2 -> digital 9
S3 -> digital 10
Z -> analog 0

E -> 0v
gnd -> 0v
vcc -> 5v
*/

void setup(){
Serial.begin(9600);
pinMode(7,OUPUT);
pinMode(8,OUPUT);
pinMode(9,OUPUT);
pinMode(10,OUPUT);
}

void loop(){
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW); // Y0
Serial.println(analogRead(A0));

digitalWrite(7,HIGH);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW); // Y1
Serial.println(analogRead(A0));

digitalWrite(7,LOW);
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
digitalWrite(10,LOW); // Y2
Serial.println(analogRead(A0));

digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
digitalWrite(10,LOW); // Y3
Serial.println(analogRead(A0));
// etc .....
}





* demux-demo.jpg (458.21 KB, 1700x2837 - viewed 148 times.)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

it s ok for the code part but not for picture !
what i do
click on insert image
it give me brows like that/img / /img/ (/ are for explication)
clik on additional options
there is attach
i make "parcourir" and find my picture
for example :  C:\Users\tauliaut\Desktop\demux-demo.jpg
i paste it on the /img]C:\Users\tauliaut\Desktop\demux-demo.jpg[/img/

i make prewiew
it wrong!
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
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

I don't believe you  can use
[ img ] link to your desktop [ /img ]
for images on your computer. You need to use the Reply and Additional Options to attach pictures that will then upload as part of your post.

This is used to link to images you have uploaded to the internet somewheree
[ img ] http://www.link to flickr.com/your_picture.jpg [ /img], that knd of link.
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)
Offline Offline
Brattain Member
*****
Karma: 635
Posts: 34574
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK angoo I see your picture and your code now what is your question?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i started from the CROSSROAD picture
 and make a one that s close off my mind

2 multiplexer and one demultiplexer
do you thing it s  good?
thank a lot


* 4067_mux-demux version 2.jpg (69.53 KB, 960x720 - viewed 97 times.)
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8601
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You do realize that you can't use 4067s for outputs unless you only need one output on at a time, it's been stated a couple of times but I'm not sure you've pick up on it.

BTW, your picture links to your C drive, that ain't gonna work smiley
______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 635
Posts: 34574
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The select inputs to the first level of multiplexers are not going anywhere, so there will be no way to control them. Unless that is they are joined to the others. When drawing a schematic you should not have lines that cross and join together unless you put a dot on the intersection.

You also need supply decoupling as well.
« Last Edit: May 19, 2011, 01:30:58 am by Grumpy_Mike » Logged

Pages: [1] 2   Go Up
Jump to: