In Microphone test box, I talked about the first steps in building a box for testing microphones, testing hearing aids, and other small sound experiments. In that post, I just showed the physical setup and did some impedance measurements of the loudspeakers in the box.
I saw only weak indications of acoustic resonances in the impedance measurements of the speakers, but I expected that a wooden rectangular box would actually have strong resonances. So my next step was to put a microphone and transimpedance amplifier in the box to measure the resonances using the Analog Discovery 2 as a network analyzer.

Here is the transimpedance amplifier I used for biasing the microphone and converting the current output to a voltage. The bias voltage is set by W2 of the Analog Discovery 2, with a low-pass filter to remove any noise added in the wire. The gain of the amplifier is 1kΩ (so 1µA becomes 1mV). The 5.6kΩ at the scope input reduces the scope impedance, so that current picked up in the wire does not make a large voltage. (More on that below.)
I set up the network analyzer to use a 2V amplitude to drive the loudspeaker. With about an 80Ω load, this makes 25mA as the peak current, which is within the range that the function generator can handle. I set some of the other parameters to non-default values: 100ms settling time, 5× averaging, and auto offset. I swept from 10Hz to 10MHz at 50 steps per decade. For the first set of tests I did not have the 5.6kΩ resistor R3 on the scope input, but I was not satisfied with the results:

Although I saw a lot of fluctuation in the gain of the loudspeaker+mic, when I removed the mic, I saw signals as large as (or larger than) with the mic, so clearly a lot of the signal I was seeing was not an acoustic signal, but electrical interference.
The electrical interference is not too surprising, as we’re delivering 25mW RMS to the loudspeaker coils, which will radiate a lot of electromagnetic interference. The low-pass filter on the bias wire should be eliminating any noise picked up there, but the high-impedance (1MΩ) input of the oscilloscope means that even small currents in the output wire could result in large voltage swings at the scope input.
To test whether the electrical interference was in the output wire, I added a 5.6kΩ resistor in parallel with the scope input. This reduces the impedance of the scope, so that small currents no longer produce large voltage swings, while not putting too much load on the transimpedance amplifier (<1mA). The results were much more like what I expected:

At low frequencies, almost no electrical interference is seen, but above 10kHz the electrical interference is as big as the acoustic signal. I don’t know whether the problem is that the loudspeaker is producing essentially no sound at the higher frequencies, or if the electromagnetic interference is still too big. Above 100kHz, I’m sure that both are the case—no sound and enormous electromagnetic interference. Luckily, I’m not planning to try to do ultrasonic measurements in this box (at least, not with these speakers). I might consider adding a tweeter to the box, if I need to work above 8kHz.
The resonances seem to be the same with different bias voltages, but the microphone gets a little more sensitive as the bias voltage increases.
My next step is to line the box with foam sound-absorbing tiles, to try to tame the resonances a little.