# How do I multiplex many signals into my sound card?

I'm looking for a recipe that will allow me to...

Hook 24 piezos to a box that will "multiplex" their output into a single signal that I can connect to the microphone input on a PC soundcard.

The purpose of this is to build a cheap and portable contact-microphone/midi-drum-trigger setup. Essentially I just need to get a low-resolution signal from all 24 piezos into the single soundcard input, which probably responds to frequencies between 20Hz and 20kHz. Each of the 24 signals must be coming into the PC full-time, not "sampled" once every nth step in a sampling cycle; I'm just looking to compress each signal into a small band of the total frequency band of the soundcard. But it is important that each signal be compressed such that they can be compared 1-to-1; i.e. given a situation where each piezo is identical and receives identical environmental input, each signal on the PC should be identical, albeit "transposed" to one of 24 frequency "bands".

• SO you want to do frequency division multiplexing, if I understood that right? – AndrejaKo Feb 8 '13 at 18:53
• If you want to put them into their own band, each one gets a maximum of 1kHz of bandwidth. In practice, you can't get a sharp bandpass filter, so there will either be overlap or dead areas between bands. If you do it in analog, your circuit will be huge and fiddly. By comparison, MCP3008 will give you 8 channels at up to 200k samples per sec for <$5. – pjc50 Feb 8 '13 at 21:09 ## 4 Answers Let me be completely honest with you. Don't do this. I would compare this approach (combining 24-channels of piezo info into an audio input) to trying to move all of your furniture from one house to another with a sports car. You can do it, but you are much better off just renting a moving truck. The typical way that you'd do this is to get several ADCs. Not ADCs made for audio. But something with a sample rate of 200+ KHz and a mux on the input. Most of these muxes will be an 8 or 12 input mux, so you will need several ADCs to get all 24 input channels. Then connect these ADCs to a microcontroller (MCU). Some MCUs already have a Mux+ADC integrated in them, but I doubt that you'll find one that can take 24 channels (but I could be wrong). I would pick something like an ARM Cortex-M3 or M4 from T.I.. Some of them have USB interfaces, which you can use to connect up to a PC. This approach sounds like a lot of work, and it is! But the amount of work is less than what you were thinking, and the odds of failing are lower. Good luck! • Thanks a bunch, but for the purpose of this OP I should have specified that answers should only regard use with a PC soundcard. – themirror Feb 8 '13 at 22:14 • @marienbad I guess you misunderstood my point: Doing it with a PC soundcard is the wrong way to do it. – user3624 Feb 9 '13 at 21:08 You are not going to do this successfully with bandpass filtering or anything like that. Assuming you want the time of each event, not the details of its waveform, you COULD perhaps do it with a 556 dual timer for each piezo, as follows: Timer (1) as a monostable, triggered by the piezo, generating a pulse of 20-100ms. Timer (2) as an oscillator, started/stopped by timer 1, generating a burst of tone at a specific frequency. (Circuits readily available online) Mix these tone bursts together into your soundcard input. But this glosses over a lot of problems; not the least being how to set all 24 frequencies with analog components, and filtering them so that the lowest one's harmonics don't interfere with the higher frequencies. So, could be done, but probably not well. A better solution would use the piezos to signal into the GPIO pins of a couple of Arduino processors, which record the times and talk to the PC via USB. (Either of these solutions would require some circuitry to get a clean logic level from the piezo sensor) Having reccomended you do it in digital, I've just worked out how you might do this in the analog domain that stands a chance of working: stereo separation. You need a stereo line in. Each piezo input then goes to two preamp inputs, left and right, through one of 12 different sorts of attenuation resistors that establish a stereo placement. Half of the inputs are inverted. Mix all of the left signals onto the left input and all of the right signals onto the right input. You can then extract a signal by looking at whether the L and R inpulses for it are same-phase or opposite phase, and what the relative magnitudes of the signals are. You might even be able to debug it with a pair of headphones: the signals will have an audible location in the stereo space. • How would you separate simultaneous/overlapping signals from multiple piezos? – Dave Tweed Feb 8 '13 at 21:46 • This is unlikely to work in any but the most trivial cases. – Chris Stratton Feb 8 '13 at 21:58 • @DaveTweed It could be hypothetically done, using tight phase mapping at the receiving end: Each of the 24 signals will be differently phase-separated using delay lines, to 24 distinct "angles" in front of (and their mirror images behind) the virtual stereo microphone. This won't work with a PC sound card, though, that is for sure - and is going to be iffy with anything more than about 4-5 signals rather than 24. – Anindo Ghosh Feb 9 '13 at 3:15 As said before, doing this in the analog world would be very difficult. I am not saying that this is a clever idea, but you could perform the acquisitions using multiple ADC or by multiplexing as @David Kessner suggested and, using a DSP, perform the bandpass filtering, and frequency division multiplexing. This overcome the problem of very narrow bandpass done in analog. Then you could output the resulting signal using a DAC to your soundcard. This is a board that is likely to cost at least$500.

You have to master digital filtering theory and DSP programming.

This sounds a little bit overkill in comparison to a low cost MCU solution with USB that can do the job for \$20.

In my mother tongue language we have an expression for that :

Use a cannon to kill a fly...