Ghosting on a 2x2 pressure sensor matrix

Hi guys, let me start by saying that I'm posting on this section of the forum because it's related to multiplexing.
I'm new to electronics and I'm currently in the process of experimenting with textile materials.
I've created a 2x2 pressure sensor matrix made out of cloth and aluminium tape. It has three layers, the top one has two aluminium stripes taped horizontaly (rows), the middle one is composed of a resistive material (Velostat) and the bottom one has two aluminium stripes taped vertically (columns).
Image attached with a basic idea (Layers.png).
I now want to read the values of each sensor.
The basic idea is to power one of the rows, read the value of each column sequentially, and repeat the process for the second row.
To power the rows sequentially I'm using a 74HC4067 Analog Multiplexer/Demultiplexer (info on pins here: Tutorial – 74HC4067 16-Channel Analog Multiplexer Demultiplexer | tronixstuff.com).
Both rows have a pull down resistor so that they don't interfere with the readings when they're not being powered.
To read the columns I'm also using a similar Multiplexer/Demultiplexer. Each column is read in turn, and the value is sento to A0 analog pin.
I've attached a diagram with all the wiring (Diagram.png and Diagram.fzz).
The green lines are the address lines for the MUXs, the two parallel yellow lines are used to read the columns values from the sensor, the single yellow line is used to send the value to the analog pin A0, and the two blue ones are used to power the rows.
Now the thing is, if I only press one or two sensors everything works fine, but if I press three sensors the fourth one will also register a value.
I've attached an image with an possible scenario (Multiple presses.png). If I press the three sensors marked as solid red, the top right one will start to ghost.
This actually makes sense, since that if we power the first row and the last column the electrons can flow through the path shown on image Electron flow.png.
Does anyone know how I can prevent this from happening?
I've seen lots of info on the net but I haven't found one solution that works.
Sorry for my Paint skills.
Oh, and before you say that I don't need the multiplexers for this, later I want to scale this to a bigger matrix. I just wanted to start small and iron any issues that might appear before scaling it.

EDIT: Source code added as attachment

Multiple presses.png

Electron flow.png

Source code.txt (1.61 KB)

Does anyone know how I can prevent this from happening?

You need to put a diode at each matrix intersection to prevent back flow of any signal.

Not sure why you have not seen this as a solution as apart from charlyplexing it is the only way to do a switched matrix.

Thank you for your response.
Like I said before, I'm trying to work with textile materials.
On all examples I saw I've never seen diodes being used on the matrix. If you think of it it actually makes sense, i'ts not practical to have hundreds of diodes on a piece of clothing.
Also, remember that there is a middle membrane of Velostat between the top and bottom layers which prevents physical connections between the two of them.
Unfortunatelly I've never seen, on any of them, the electronic schema used to read the sensors, nor did they address any ghosting issues.

On all examples I saw I've never seen diodes being used on the matrix.

So is that a failing on your part or my part?

If you think of it it actually makes sense,

Thought about it and no it doesn't.

i'ts not practical to have hundreds of diodes on a piece of clothing.

That is the thing that makes no sense. These things can be small, a typical diode can be sized 0603 which is 1.5 by 0.8mm, the smallest you can get is called an 0201 which is 0.6 by 0.3 mm which you will struggle to see let alone solder. So it is possible to have hundreds of diodes on a piece of clothing using flexible PCBs.

Now the laws of physics do not make exceptions for art, so if you can't incorporate diodes into your design you will have to put up with either dropping your multi press requirement, or dropping your project.

Is it really necessary to be able to press all the keys at the same time?

later I want to scale this to a bigger matrix.

How big?

I just wanted to start small and iron any issues that might appear before scaling it.

Electronics / life doesn't quite work that way. You get the small stuff working fully first. Then you scale up an run up against a whole different set of problems. Imagine you want to bake bread, you learn how to bake one loaf, then do you think you can scale that up to baking two thousand loaves without any further difficulties?

So how big do you want to end up and how many multiple presses do you expect to be your maximum. Remember you can always mask out multiple presses in software and only accept either the first key you come across in the matrix scan, or scan the whole thing and don't accept multiple presses.

The best way I can show you what I'm trying to accomplish is by showing you a similar approach.
Please open page 3 on this pdf:

You can see the sensor matrix composed of conductive threads arranged horizontally and vertically in a way that they don't have contact with each other. At the point where they "intersect" there is a resistive substance, basically this allows to read an analog value based on the weight. As you can see in the diagram there's no reference to any kind of diodes.
The next thing I ask you is to go to page 4, where you can see a schematic of the circuit.
It's very similar to what I showed in the first post. Again, there are no diodes involved.
Page 5, there's a close up of the sensor in the mat, no diodes.
In page 10 you can see that it's a "multi touch" mat, you can see a foot pressing on multiple sensors.
Now, going back to your post.

So is that a failing on your part or my part?

I answered this in the begining of this post.

Thought about it and no it doesn't.

I hope now it does.

That is the thing that makes no sense. These things can be small, a typical diode can be sized 0603 which is 1.5 by 0.8mm, the smallest you can get is called an 0201 which is 0.6 by 0.3 mm which you will struggle to see let alone solder. So it is possible to have hundreds of diodes on a piece of clothing using flexible PCBs.

Here I should have been more clear, it actually is for a mat. Putting diodes there it's prone to damaging them.
But you're absolutely right about sizing, you can have them small enough.

Now the laws of physics do not make exceptions for art, so if you can't incorporate diodes into your design you will have to put up with either dropping your multi press requirement, or dropping your project.

It's not for an art project, it's for a science project.
Quiting is not an option.

Is it really necessary to be able to press all the keys at the same time?

It's not absolutely necessary to be able to press the entire sensors at the same time, but we need to register various shapes and sizes. If ghosting occurs we'll get bad data that we can't analize with great confidence.

How big?

Around 120x32

Electronics / life doesn't quite work that way. You get the small stuff working fully first. Then you scale up an run up against a whole different set of problems. Imagine you want to bake bread, you learn how to bake one loaf, then do you think you can scale that up to baking two thousand loaves without any further difficulties?

Well, if you can't bake one you'll get hundreds of badly baked loafs.
Or I can give you another example, Boeing doesn't start designing a new plane by building it in actual size. They first prototype it in a smaller scale, test it for aerodynamics, iron out any issues it has, and then scale it up.
I get what you say, I'm sure we'll get into other problems, but if we don't do it this way we'll have to solve them all at once.

Remember you can always mask out multiple presses in software and only accept either the first key you come across in the matrix scan, or scan the whole thing and don't accept multiple presses.

We actually want to allow multiple presses, the thing is that in the scenario I showed you it's giving me 4 sensors pressed when in fact there are only 3.

The next thing I ask you is to go to page 4, where you can see a schematic of the circuit.
It's very similar to what I showed in the first post

It is absolutely nothing like you showed in the first post. Where are the transimpedance amplifiers in what you posted. Where is the DAC in your circuit?

What you asked for is nothing like that paper describes, and what the paper describes is not proof against ghosting.
Why not make what is is Figure 2?

What you asked for is nothing like that paper describes,

It's the same basic Idea, two MUXs, one directing the power to rows and another reading from the columns.
Everything is working except for the ghosting issue.

Why not make what is is Figure 2?

Currently we don't have the hardware, we are trying with what we have.
In the future we might exchange the Uno for something else.
But in any case I don't think that that is related to the ghosting.

...and what the paper describes is not proof against ghosting.

You're right about that. The thing is that all textile sensor matrices I've seen are like that (with no diodes), and I've never seen anyone referring to ghosting issues.
Like you, I'm also very skeptical about this.

Ok I have had a long read of that paper and I think I can see what is happening.

First off let me say that I did do something similar back in 1986 see Fun with Foam for the text, and the attached for the figures. However where it differs from the system in the paper is that the undriven / unread column and rows were left floating in my system where as here they are grounded.
It is this, I think, that provides some form of ghosting protection. When the ghosting occurs it does so because current flows through an un addressed strip of column and row to arrive at the addressed row. However by grounding the unaddressed lines this path is cut short and the ghosting current never arrives at the address row.

The thing to realise is that this is not a digital system at all but an analogue one. I think you are having troubles because:-

  1. Your matrix is small and does not have the resistance characteristics of the original mat.
  2. The grounding of the un addressed lines has not got a low enough impedance.
  3. The original system has a D/A on the drive line allowing the drive signal to be AC
  4. The multiplexers you used have a typical on resistance of 70R where as the ones they used has an on resistance of 4R.
  5. You are not using transconducting amplifiers to convert the current through the addressed column / row into a voltage that can be measured and is proportional to the pressure.

It might be worth switching the un addressed lines to ground through a multiplexer to get even better grounding.

Hope that helps.

Thank you, we'll definetely try changing the grounding on the unaddressed lines to see if it helps.

@Nwik Did You manage to resolve ghosting issue? Did grounding unaddressed lines help?

I'm asking, because I'm planning to create something similar (pressure mat).