Introduction: Arduino Phased Array Measurement

In this project, we built an array of microphones to measure the direction of a sound wave within a range of 180°. We paired it with another project of building a sonic array, but you can use it to measure the directionality of any sound source with a focused output.

Check out video of successful testing

Supplies

Arduino Mega: Used because of its increased number of analog ports allowing us to use more than 6 microphones. Alternatively you can sue two Arduino Unos and connecting them or send data from each Arduino to a GUI or Website or your computer.

Breadboard or Circuit Board (PCB) (x7): Used to mount the microphones.

Electret Microphone - MAX4466 (x7): Any microphone compatible with Arduino will work.

Soundproof Foam: For soundproof testing area.

Cardboard: Base for the circuitry set up and to attach the soundproof foam to, wood would be better however we did not have any that would have worked.

5cm long 1x2 pieces of wood (x7): Mounts for the circuit boards.

Step 1: Understanding Soundwaves

In order to measure sound waves we first have to understand them.

The following equation: V = fλ, describes a wave. In this equation, V is velocity, f is frequency, and λ (Lambda) is wavelength. For this project we had to measure the intensity of sound (decibels), and display what direction is loudest.

Step 2: Soundproof Room

A soundproof room is vital for accurate calibration and measurement. It doesn’t need to be perfect, just functional enough to block out most unwanted background noise as well as reduce the amount of sound wave reflections. To build our space, we used soundproof foam along the walls to disrupt the propagation of sound waves and limit reverberations. We carpeted the floor for a similar effect, and used fabric for our ceiling.

Step 3: Set Up Microphones

Overview

We built two iterations of the microphones. We used cardboard as a base, and set our sensors (represented by the dots) in a semicircle around the source (blue rectangle). We chose 40cm as our radius, but depending on the sensitivity and amount of sensors you use, this can be changed. Since we had seven microphones to spread across 180°, they’re spaced 30° apart.

To figure this number out for yourself, divide your angular range by one less than your sensor count. This is because we placed the first and last sensor on 0° and 180° meaning there was one less division.

Ex. 90° range, 13 sensors = 7.5° between each sensor.


Prototype:

The prototype was created with cardboard, temporary breadboards and jumper wires. We plugged each microphone into its own breadboard and wired them as per the wiring diagram. This was successful for testing but wires kept getting unplugged and the breadboards were mounted badly.


Final Product:

The final product used soldered circuit boards, wood mounts, and regular wire. It has the same layout and wiring set up just with upgraded materials and reliability. We mounted each soldered circuit board to a piece of 1x2 wood with Velcro to attach to the cardboard base.



Step 4: Wiring

Wiring

The above diagram shows only 6 microphones as that is the max for the amount of analog ports on an Arduino Uno, however if you use a Mega, like we did, you can add up to 14. Each microphone has three ports labeled VCC (power), GND (ground), OUT (analog output). To power all of the microphones, connect each of the VCC pins to the 5v or 3v ports on the Arduino and each of the GND pins to the GND port. The third port (OUT) has to connect to a corresponding analog port (A0 -> A6) where data will be collected for each sensor.


Calibration

After the microphones are all wired you will notice that each sensor will give varying results for the same sound levels. It is best to get them as close together using the little screw on the back of the sensor, then do the rest in code (step 5).

Step 5: Code

Attached is flowchart to help you understand the code in addition to the full commented code file.

The code includes a section to connect two Arduino Unos through their serial ports however we didn't end up using it. If you do use it you'll need to download the software serial library on the IDE.

**Note this code has some bugs but does work the majority of the time

Step 6: Common Problems/Troubleshooting

  • The Arduino Uno has a maximum of six analog ports. If you want more ports you can solve this by using a different Arduino board such as the Mega or by connecting two Unos thereby doubling the available ports.
  • Microphones not working. Sometimes sensors just wont work for whatever reason so it is always good to have extras.
  • Unreliable Calibration. Manually tightening and loosening the screw on the back of the microphones only works so well and can be changed over time. Make sure the code is set up to fix this.

Step 7: Useful Links/Resources

Here's some resources we used when building this project.