In Part 1, I documented quadrature-encoder-ing with the Nucleo boards, and talked about some ways to sense speaker cone velocity.
Here's the hardware.
So what's going on up there?
To the left of the speaker is an interferometer built by Peter. This particular configuration of interferometer results in two out-of-phase interference patterns, which (for this project) are conditioned into a digital quadrature signal, just like an encoder.
A HeNe laser is split and directed at two retroreflectors - one on the back of the speaker driver, and one fixed to the optical breadboard. The reflected paths re-intersect each other and interfere. The interference pattern changes as the moving half of the path changes length, and this changing pattern is picked up by a pair of photodiodes. Here's a diagram of the laser path, because words are hard sometimes. The blue circle is where the interference happens. The interference pattern on each beam cycles every 1/2 wavelength of displacement, (since the beam path lengthens by twice the movement of the speaker), and since the two interference patterns are ~90 degrees out of phase, the edges of the digital output are spaced 1/2 that again, so every 1/4 wavelength of speaker displacement. That's 158.2 nm for this laser. I can't do justice to the explanation for why the two outputs are out of phase, so I'm not going to try.
The laser passes through the convenient hole in the back of the driver, and bounces off a tiny retroreflector attached to the back of the cone.
A pair of photodiodes pick up the interference patterns.
The sensing and control is done through this glorious stack of arduino-shield-shaped objects. From top to bottom:
A Pololu motor driver, to drive the speaker
An circuit to DC bias the audio input for the microcontroller's ADC
A photodiode, to quadrature converter board
An Arduino, just used as a spacer
A signal to BNC board, for debugging on a scope
An STM32F446 Nucleo board, running the show
Here's a closer look at the photodiode to quadrature converter, also built by Peter. The signal from each photodiodes goes through a transimpedance amplifier and then to a comparator, to convert them to square waves. The two trim pots for each channel set the hysteresis and reference voltage of the comparator. A little LED on each channel blinks out the comparator output state, which is extremely useful for debugging.
For the speaker, I picked up a super cheap 10" car audio subwoofer. Notice the faux carbon fiber aesthetic cone glued in front of the actual cone. Quality. Claims 250 Watts RMS, and a kW peak.
The speaker took some significant modification to stuff a retroreflector inside. I sliced off the voice coil magnet assembly with a bandsaw, and cleaned up the driver on the Bridgeport with a slitting saw.
I happened to scrounge a machined round piece of aluminum which was already almost the exact size I needed to reattach the magnet. I did some minor operations on it and bolted it to the magnet assembly.
The tiny retroreflector was pressed into a little 3D printed jig, which was then glued into the back of the cone. Fortunately, there was a convenient flat plastic surface to glue to. The 3D printed bit centers the reflector in a cavity on the back of the cone.
In part 3, I'll go through the controls stuff.