Go Down

### Topic: Multiplexer: how does it work and how can i make one? (Read 4814 times)previous topic - next topic

#### Swoosh88

##### May 19, 2011, 12:03 pmLast Edit: May 26, 2011, 10:06 am by Swoosh88 Reason: 1
Hi
Im new to Arduino and soldering electronics, but id like to learn more about it, because we have to make an installation using electronics, as a school project.
Now, we would like to make some sort of pressure sensitive floor, using Piezo sensors (pressure sensors).
To cover the floor we would need about 200 Piezos, which obviously doesnt fit on an Arduino board. (we use the Arduino Diecimila at school).

Now, i talked to one of my teachers and he said that we would have to make a matrix so we can send all the data to the arduino.
So, after searching a bit, i found some examples with led matrixes, but couldnt quickly find how to make one and how they work.
And that, is the reason is why i made this topic:
Can someone explain to me how a matrix works, and how to make one?

#### floresta

#1
##### May 19, 2011, 05:34 pm
I found this in a few seconds using Google.  I searched for 'keyboard matrix'. http://www.dribin.org/dave/keyboard/html/

Don

#### Swoosh88

#2
##### May 19, 2011, 09:04 pm
Thanks for that, it is kind of helpful.
But I would like to know more about how to make such a thing, like photos maybe? Because I honestly don't understand how you make such a matrix.

Also, I know this might sound stupid, but I also don't understand how such a matrix would work, because what is the difference between a matrix and lots of sensors?
I know what a matrix does, but not how it does it, does that make sense?

#3
##### May 19, 2011, 09:39 pm
A matrix in one sense is a grid of wires laid out looking like a tile floor.
The vertical lines are one set ogf wires, the horizontal lines are another set.
What you are looking to is sense when one wire is pressed against another at an intersection.
Similary you might have an LED at each intersection, with a high on one wire and a low on the other to turn on a particular LED.

In your case, what you are really after is how to read a bunch of discrete pressure points. In which case what you really need to do is make a big electronic switch that can select a switch at a time and see if it is pressed.  You are taking many inputs and multiplexing them down into 1 input.  You can design it to capture/read 1 at a time (example you have a bank of CD4067 type chips with 16 inputs each, you select 1 of 16, read it, select the next read it etc. After all 16 are read, you enable the next CD4067 and start the next group of 16), you can design it to capture all at once and serially shift them in to see which changed (for example a bank of parallel-in/serial-out shift registers, send out a clock pulse to capture the state of all sensors at one time, then shift in the 200 BITs to see what you captured.) Or a combination, 16 muxes (196 signals) feeding a bank of 2 shift registers: Select address 0 for all 16 Muxes, clock the data into the 2 shift registers, shift in 16 bits & act. Select address 1, clock the data into the 2 shift registers, shift in 16 bits & act. Repeat 14 more times.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Swoosh88

#4
##### May 23, 2011, 11:04 pm
What you described is indeed what I am looking for.
I would like to check all of the sensors at once, because multiple sensors can be pressed at once.
Also, because I want to use Piezo sensors/elements which can measure pressure, they need to be monitored constantly.

But I have no idea how to make such a multiplexing device or setting.

Also, what is that CD4067 chip you are talking about?

#5
##### May 23, 2011, 11:31 pm
Go google CD4067 and download its datashee, and browse the forum - I quite recently posted a schematic for scanninng 32 inputs using the same chip.

I described several methods above - you will have to be more clear about which method you are interested on. Setting up the hardware is pretty straightforward, what you do when you detect a closure will be the interesting part.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#6
##### May 24, 2011, 01:40 am
Here is one the methods, the one I seemed to discuss the most.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Swoosh88

#7
##### May 24, 2011, 12:05 pm
Ok, that doesnt seem so complicated.
So basically what I do, is I lay down my grid of Piezo Sensors, and connect each set of 16 with this array?
So if I would like to do this for 100 Piezo Sensors, I'd have to put down 6 of these chips.

Now, I still have a few questions:
What are those "4 Adress Select Lines"? Where do they come from?

#8
##### May 25, 2011, 05:26 am
No, not complicated at all. Just reading the state of the switches.
The 4 address select lines and the enable line come from the arduino.
You could have them come from a shift register also - but that typically needs 3 pins, so doesn't gain you much.
Same for the '165s control lines.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Swoosh88

#9
##### May 25, 2011, 10:37 am
But what are those address select lines? Are they digital input/output?
Also, I tried googling it, but what is a Shift Register?

#10
##### May 25, 2011, 03:36 pm
Address select lines are digital outputs.
Shift Register: 74HC595.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Swoosh88

#11
##### May 25, 2011, 08:04 pm
Let's see if I get it:
The piezo sensor sends an analog signal to the Multiplexer.
The Multiplexer captures this, and the other signals.
Then the Multiplexer sends a signal out via de Adress Select Lines?
And what signal goes into the Shift Register? (why isn't that also a Multiplexer?)

#12
##### May 26, 2011, 03:41 am
That is not it.

The multiplexers are a big switch.
The Common I/O line is connected to one of the I/O lines when the Enable line is active (high or low, need to look it up on the datasheet). The address lines ABCD select which one is connected. The arduino will create those addresses and control the enable line.
The shift register will then store the state of the selected I/O line when its Load line is active. For a '165 type part, that happens when the Load line is low and goes high (pin 1 for 74hc165).
The clock line is driven by the shift-in command to bring the data into the arduino.

So what you doing is this:
enable the multiplexers (can be enabled all the time for this use)
for (address_bit_d = 0 to 1)
for (address_bit_c = 0 to 1)
for (address_bit_b = 0 to 1)
for (address_bit_a = 1 to 1)
// address is now setup, piezo sensor state goes thru the multiplexer to the shift register input
// activate the shift register latch
// shift in the data:
shiftIn(dataPin, clockPin, bitOrder)

so you have 4 loops within loops controlling the address lines, and reading in the data.
If the piezo sensors are not putting out good digital data, then maybe you will have to read them in analog input pins instead - with 6 4051s, you can use 6 analog inputs.
Or run them thru another analog mux as you noted above.
You said the sensors are on the floor, so I am thinking you will have relatively slowly changing outputs that could look digital.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### Grumpy_Mike

#13
##### May 26, 2011, 07:01 am
Quote
Now, we would like to make some sort of pressure sensitive floor, using Piezo sensors (pressure sensors).

A Piezo sensor does not measure pressure. It turns the differential of the sensor deformation into voltage.
That means as you stand on it you get a signal, as you continue to stand on it the signal goes away and is the same as a sensor not being stood on.
Are you sure this is what you want?
You can get force sensitive resistors.
http://www.sparkfun.com/products/9375
but buying 200 will cost some.
You can make your own using conductive foam:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html
I think you will have to scale your ambition down, making those 16 took me long enough.

#### Swoosh88

#14
##### May 26, 2011, 10:06 am
That is not it.

The multiplexers are a big switch.
The Common I/O line is connected to one of the I/O lines when the Enable line is active (high or low, need to look it up on the datasheet). The address lines ABCD select which one is connected. The arduino will create those addresses and control the enable line.
The shift register will then store the state of the selected I/O line when its Load line is active. For a '165 type part, that happens when the Load line is low and goes high (pin 1 for 74hc165).
The clock line is driven by the shift-in command to bring the data into the arduino.

So what you doing is this:
enable the multiplexers (can be enabled all the time for this use)
for (address_bit_d = 0 to 1)
for (address_bit_c = 0 to 1)
for (address_bit_b = 0 to 1)
for (address_bit_a = 1 to 1)
// address is now setup, piezo sensor state goes thru the multiplexer to the shift register input
// activate the shift register latch
// shift in the data:
shiftIn(dataPin, clockPin, bitOrder)

so you have 4 loops within loops controlling the address lines, and reading in the data.

Ok, I get the part about the abcd bits, but i still dont understand what those address lines are...
What kind of data do they send to the arduino?

If the piezo sensors are not putting out good digital data, then maybe you will have to read them in analog input pins instead - with 6 4051s, you can use 6 analog inputs.
Or run them thru another analog mux as you noted above.
You said the sensors are on the floor, so I am thinking you will have relatively slowly changing outputs that could look digital.

Well, the piezo sensors are not putting out digital data at all, just an analog signal: voltage
As for the change, that is what we want to measure: the force/speed used to "press" the sensor.

Quote
Now, we would like to make some sort of pressure sensitive floor, using Piezo sensors (pressure sensors).

A Piezo sensor does not measure pressure. It turns the differential of the sensor deformation into voltage.
That means as you stand on it you get a signal, as you continue to stand on it the signal goes away and is the same as a sensor not being stood on.
Are you sure this is what you want?
You can get force sensitive resistors.
http://www.sparkfun.com/products/9375
but buying 200 will cost some.
You can make your own using conductive foam:-
http://www.thebox.myzen.co.uk/Hardware/MIDI_Footsteps.html
I think you will have to scale your ambition down, making those 16 took me long enough.

Well, basically what we want is a floor made of buttons, simply said.
But we want to measure the speed/force used to press these buttons, where Piezo elements are supposed to be perfect for. (however, I didnt manage to get it working yet, and i think the problem is my arduino board)
Also, we have a €100,- budget from school to make this project, and we already checked, and those Piezo sensors will fit inside this budget. Note that we only need about 100, not 200. (we changed it a bit)
And yeah, it is ok that the signal dies when you arent standing on the island anymore, and actually, that is exactly what we want

PS: i modified the topic title, it seems more suited like this

Go Up

Please enter a valid email to subscribe