DIY Real Time Analysis

by nozden in Circuits > Arduino

217 Views, 0 Favorites, 0 Comments

DIY Real Time Analysis

image1.jpg

Real Time Analysis (RTA) is the simplest and most common method of testing a loudspeakers audio directivity. This method sees the loudspeaker in question placed on a turntable while an omni-directional microphone is set at a certain distance away. A tone is then generated through the loudspeaker as it rotates, allowing the microphone to gather data in real time.

In this instructable you will be constructing your own RTA setup using the supplies listed.

Supplies

Cardboard sheet large enough to cut 7.5 diameter circle out of

Stepper Motor (5V)

Arduino Uno R3

Smart Phone w/ Decibel X app (iPhone) or equivalent app (gives dB readings)

Some sort of small speaker (We use a smartphone)

Breadboard

Pushbutton (2-pin)

Some male to female and male to male wires

Laptop with Arduino IDE

Something you can somewhat accurately measure angles with (Protractor, eyeballs, etc)

Optional:

Sheet of printing paper

Access to laser 3D laser printer (we provide model files)

Creating the Turntable

IMG_20210429_211412.jpg

Using a protractor or similar tool, cut a circle with a diameter of 7.5 inches out of the cardboard sheet.

Mark 6 equidistant points along the circumference to evenly divide the circle.

(For more accuracy of angles, add more mid-points as desired)

Optionally, if you have the means and knowledge to you can 3D laser print your turntable using the files linked here: files (Just to make it look clean and nice, don't sweat it.)

Adding the Motor

IMG_20210429_211749.jpg

Cut a hole at the center of the circle for stepper motor shaft (as long as it fits enough to not slip you're good).

Insert motor shaft.

Wiring the Motor

image2.jpg
schematic.png

Plug white motor bus into the white header on the driver PCB (don’t worry, it physically only goes in one way).

Wire the Arduino breadboard circuit, and Arduino to driver module following the schematic above.

Description of Schematic:

'5V' to '+', 'GND' to '-'

pins 8 thru 11 into IN1 thru IN4

Note:

All 5V's and all GND's are equivalent to each other, it doesn't matter which one you use as long as they are labeled the same. Also, if you accidentally short 5V to GND, your Arduino will shut down to protect itself. You probably haven't broken it, just unplug the short and continue on as normal.

Coding the Arduino

code picture.png

Download the free Arduino IDE software from https://www.arduino.cc/en/software. You can optionally use the web editor, but we recommend downloading the option that says “Download Win 7 and newer” as this is the version our code is intended for.

Install the IDE where preferred using the installer that was downloaded.

After the Arduino IDE is installed, download the attached code and open it (it should automatically open in the Arduino IDE).

Click the upload button.

When you push the pushbutton, the motor should turn ~60 degrees. This is an approximate angle, and will vary depending on your specific motor, how heavy the device placed on the turntable is, etc. Use your best judgement or fiddle with the 'stepsPerRevolution' and myStepper.setSpeed() commands if you want to make it more precise to your setup. Be warned, if you don't know what you're doing this will just take some trial and error. However, if you ever want to put back the default values just refer to the picture of the code here, or a freshly downloaded copy of the original code.

Software Setup

excel picture.png

Install and open the Decibel X app from the App Store if you are on iPhone. If on Android (or want to use a different app on iPhone), any app that gives a decibel reading from the phone's microphone is sufficient for this project.

Open Excel on the laptop and download the linked Excel chart.

Excel Polar Chart Template

Decibel readings go in the column with '<- Put readings here' next to it. By default, the stepper code is set to be roughly 60 degrees, so in the excel file you will likewise insert values for 0/360, 60, 120, 180, 240, and 300. The chart is in increments of 30 degrees, so to account for this you have two options: fiddle with the code to change to 30 degrees (harder), or simply average the surrounding values to fill in the 30 increments (much, much easier). For example, if you have a measured value for 0 and 60, you can add them up and divide by 2 to get a mock value for 30. For the sake of the project, the accuracy frankly does not need to be very high, as the main point is just to show the visual relationship between the volume (dB) and angle on the polar chart.

Note on Excel file:

The only values you need to change are the volume readings on the leftmost table, as pictured in the screenshot. Changing other things will likely affect the chart negatively, so it isn't recommended unless you know what you're doing.

Testing and Measurement

image0.jpg
DIY Real Time Analysis with an Arduino Uno

Place/hold the smartphone being used to measure the decibel level in a static place, with the app open and reading.

Set smartphone or other audio emitting device on turntable disc and emit a clean tone like this. Feel free to find something less annoying if you'd like, but it is important that it's a clean, simple tone and not music since we want easily readable volume levels.

1. Record the decibel value at 0 degrees (which is also 360 degrees) in Excel.

2. Use pushbutton to rotate stepper motor ~60 degrees.

3. Record the measured decibel value in Excel.

4. Repeat steps 2 and 3 until you have made a full revolution (back to 0/360 degrees).

5. See the updated polar chart generated by Excel, the part of the chart where the pattern spikes outward the most is the angle relative to the microphone from which the sound is mathematically shown to be coming from.