EPuck2 Microphones - EPFL-MICRO-315/TPs-Wiki GitHub Wiki

Important

Still in construction

Microphones acquisition

The e-puck2 has 4 digital microphones MP45DT02-M, working in pairs:

  • Left + Right: signal SPI2_MOSI on pin PB15 of F407 and configured as I2S2_SD
  • Front + Rear: signal SPI3_MOSI on pin PB5 of F407 and configured as SPI3_MOSI

We don’t remember at this time why one pair uses the I2S and the other the SPI but it’s quite similar, the idea being to recover very long bit sequences in order to store them in memory by DMA.

These microphones provide a digital signal in PDM format and need a software decoding as the STM32F407 doesn't have hardware support; that's done by interrupt in the mp45dt02_processing driver included in the e-puck2_main-processor library.

For information purposes only:

More details about this decoding in the application note Interfacing PDM digital microphones using STM32 MCUs and MPUs

PCB Coordinates of microphones:

  • X and Y in [mm] with the origin in center of PCB, X pointing to the left of the robot and Y pointing to the back of the robot
  • Position of the microphones relative to the centre of their case, with the microphone opening offset
  • Rot in [°], a value of 0 corresponding to have the case positioned as in Figure 7 of the datasheet if Y pointed against the top and X against the right of the page
  • X/Y/Z axes being the same as those of the accelerometers and gyroscopes indicated on the plexiglass cover
Position Mic X Y Rot  Side
Rigth -30.3 -8.35 180 Top
Left  2  30.3 -8.35 180 Top
Back 0 23.05 0 Top
Front 4 3.8 -31.85 180 Bottom

Regardless of component assembly tolerances on the PCB the distance between left and right microphones is 6.06 [cm] (1)

Wavelengths

From https://en.wikipedia.org/wiki/Wavelength

For sound waves in air, the speed of sound is 343 [m/s] (at room temperature and atmospheric pressure). The wavelengths of sound frequencies audible to the human ear (20 – 20'000 [Hz]) are thus between approximately 17 [m] and 17 [mm], respectively. Somewhat higher frequencies are used by bats so they can resolve targets smaller than 17 [mm]. Wavelengths in audible sound are much longer than those in visible light.

In resume the wavelength of a sound wave is:

$\lambda(f) = \frac{v_{sound}}{f} [\frac{m\cdot s⁻¹}{s⁻¹}$] (2)

Then for a sinusoidal signal at 1kHz:

$\lambda$1kHz = 34,3 [cm]

Then considering the distance between left and right microphones this would correspond to the wavelength of a signal of:

$f\simeq\frac{343}{60.6\cdot10⁻³}[\frac{\frac{m}{s}}{m}$] = 5,66 [kHz] (3)

Estimating the direction of a sound source

According to this thesis (from http://www.ece.iit.edu/~/ecasp/publications/Thesis/Vitaliy%20Kunin%20MS%20Thesis.pdf), the measurement of the direction of arrival of a sound source can very well be made in first approximation according to chapter 2.1 2D DOA with the simplified far-field, which assumes that the sound source is sufficiently distant from the microphones to obtain a model represented by Figure 2.2 which finally makes it possible to measure quite simply the angle according to equation 2.3.

At TP5 an FFT on a microphone allowed to find the frequency of a received signal by searching for the complex vector having the largest amplitude.

Important

Proposed by Daniel Burnier but not tested, nor found in previous miniprojects that could confirm it.

That was not used, but this complex vector also allows to determine the phase (position in the period of the sinusoidal signal), function of the real and imaginary parts, using ATAN2 function.

If the acquisition is made on the left and right microphones simultaneously, so that the FFTs calculated on the 2 microphones are made with the data of the same acquisition, then it will be possible to:

  • Find the frequency of the signal by searching the complex vector having the bigest magnitude of one of the 2 FFTs; normally this should be the same frequency for the 2 microphones and this frequency must be inferior to lengthwave to avoid multiple solutions
  • The difference of the 2 phase shifts reported at 2π will give the proportion of the wavelength of this frequency and correspond to the term T in equation 2.3
  • Equation 2.3 gives the a angle
⚠️ **GitHub.com Fallback** ⚠️