Step 3: Mock-up
We did this by using 2 bread boards, placing a 4051 multiplexer/demultiplexer in each, and then connected inputs/outputs to the correct places on the Arduino.
Once again, refer to the schematic at http://www.arduino.cc/playground/Learning/4051.
Here are some basic things to remember (all of the following pin numbers refer to the 4051 chip):
Attach the two Vcc inputs (pin 16) to the shared 5 V source of your Arduino.
Attach E (pin 6), Vee (pin 7), GND (pin 8) of both chips to the shared ground of your Arduino.
Attach z (pin 3) to an Analog In of your Arduino. If you use our exact code, attach the chip with the piezos to A5, and the chip with LEDs to A0.
Attach S0 (pin 11), S1 (pin 10), S2 (pin 9) to Digital Outputs on your Arduino. Once again, if you use our exact code, attach the chip with piezos to 2, 3, and 4, and the chip with LEDs to 8, 9, 10.
Ok! Now that you have a crazy mess of wires, you should connect your components to the remaining pins.
At first, we just wanted to make sure it worked, so we only hooked up 2 piezo sensors and 2 strings of LEDs.
These go in any of the remaining I/O pins on the 4051.
For the sensors:
Connect a wire from a 4051 pin to a piezo disk and 1 MΩ resistor, and then connect this to ground. (We advise making a shared strip of ground on your breadboard.)
For the LED strings:
Ideally, connect a wire from a 4051 pin to a resistor, and then 3 LEDs in parallel, and then to ground. (This depends largely on the types of LEDs you have- you should look at the voltage drops across them and calculate what size resistor you need in order to moderate the 5V power supply from the arduino.)
***You should hook up the LED string to the same numbered pin on the 4051 as the pin its respective piezo disk is hooked up to.
CAUTION: When we were trying to test this, we encountered some random, sporadic data. Then, we hooked up all our floating pins of the 4051 to ground, and everything worked fine. We're not quite sure why, when the pins aren't connected to anything, they give off random readings, but, in any case, connect every pin you're not using to GROUND.
Now, uploading and running the Arduino code, you should be able to tap the piezo disks and then see numbers on the serial monitor, as well as see the respective LEDs lighting up.
(It's a great feeling when this works.)