I'm buliding a drumpad with piezoelectric sensors, which I know is a really popular project, but I still have problems with multiplexing: sometimes (mainly when the hit is over a certain strenght) values from a piezo influence the others values read from the same mux
This is my setup
4 piezo with 1M res in parallel connected to the first 4 inputs of a 4051 mux, other mux inputs are grounded
I have 2 circuits like the one above, each mux's output goes to an arduino analog pin.
3 digital pins from the arduino go to both address pin of the muxs
all the unused analog arduino pin are grounded
and these are relevan parts of my arduino code. I tried to play with delays in between different analogRead and also between different writing to the address pins of the mux, but no success...
for (int i=0; i<4; i++)
sensorValue[i] = analogRead(A0);
sensorValue[i+4] = analogRead(A1);
void setMuxAddress(int var)
digitalWrite(2, bitRead(var, 2));
digitalWrite(3, bitRead(var, 1));
digitalWrite(4, bitRead(var, 0));
Thanks in advance!