# How to increase sampling rate of Raspberry Pi to 10Msps using external ADC or Microcontroller

I am working on a project where I want to use 3 electret microphones to triangulate the origin of a noise. I will add a 4th microphone for some additional accuracy. The microphones will be around 30cm apart from one another and I am looking for decent accuracy, so sampling speed will be very important. I want to triangulating the sound by capturing the difference in time from the microphones hearing the noise.

Example reading: mic1 = 0s => 0mm; mic2 = .1ms => 3.43mm; mic3 = 1ms = > 34.3mm

Using speed of sound through air at a given temp we turn this into distances and from knowing the position of the mics are we can find the original point through some linear algebra.

Due to proximity of the microphones to each other and accuracy goals of around than .1mm I would need to sample at a rate of around 10Msps.

speed_of_sound/sampling rate = possible distance traveled between samples 343,000/10*10^6 = .0343mm of tolerance due to sampling rate

From research online, this seems impossible for just an external ADC and Raspberry Pi 4. Typically I have read that the SPI between the ADC and the RPI is typically going to be slower than my goal.

I found the following post where someone got 380ksps but seemingly was slowed down by the SPI.

How to achieve a high sampling speed using an ADC with Raspberry Pi?

I was thinking about using an arduino MicroController to do this counting, but the onboard ADC is way too slow. So I am wondering, are there any microcontrollers like arduino that specialize in this type of thing? I do not need many inputs or output, just the 4 microphones attached to the microcontroller and then passing some info back and forth to the raspberry pi.

• Just brainstorming: try PCM1802, with system clock 32MHz (no SPI Clock is used): raspberrypi.stackexchange.com/questions/107778/…. Good luck, cheers. Commented May 11, 2020 at 4:30
• Don't mention stupid Xnono low resolution 10 bit on board ADC in this forum. You make me laugh. Look STM32. Commented May 11, 2020 at 5:02
• Have you considered building an external circuit? A sound that is detected by any one of your microphones (logic OR) could be used as an interrupt/trigger to begin sampling at a sufficient rate and for only as long as necessary to reach the limit of your detectable range. You could sample in parallel the signals from all mics as bits that go high when the sounds achieves threshold. You could use fast comparators for the mic signals and might want to think about synchronous sample-and-hold circuits on the mic signals. Check the frequency response of components. Commented May 11, 2020 at 12:11
• The data would be sent to the Pi for processing. Commented May 11, 2020 at 12:13
• BalooRM - I would not be opposed to trying to build an external circuit. I am no electrical engineer so most of what you just said I would have to look up. I was planning on using the microphone as an interrupt/trigger. Since there really is nothing else going on during sampling an interrupt should be fine. Commented May 11, 2020 at 21:57