I'm working on a PCB motor and I'm trying to build a system to detect the position of the moving part. The board is already pretty much full on all layers between the coils themselves and control logic, so I don't really have space for separate sensing traces.
I first used my scope + sig gen to capture the frequency response of the motor coils, with and without the moving part sitting above them:
The largest swing is at ~600kHz, with the impedance changing from 15 ohms to 9. I can test this manually and see the waveform change amplitude on the scope as I move the part over the coils.
My basic idea to measure it:
- Generate 600kHz sine wave using MCU
- Buffer sine wave to an output impedance of 12 ohms (halfway between 15 and 9)
- Connect buffered wave to coil, forming a voltage divider
- Rectify the voltage at the middle of the divider to convert the AC amplitude to a DC one. Low pass filter to reduce ripple
- Amplify voltage difference to match ADC range using the MCU's built-in op amp
- Measure resultant voltage using ADC
For 1, I've investigated two options - using the MCU's DAC, or using the SPI output with pulse density modulation. The DAC produces lower harmonics, but has an output impedance of ~5k. The SPI option requires more filtering, but the output impedance is that of an MCU GPIO, ~150 ohms.
For 2, for simplicity I'm planning to use a single transistor voltage buffer, such as a common-drain mosfet. Looking at some typical mosfet values, this approach requires a source impedance of <1k, so I can't use it with the MCU DAC directly. An alternative option would be to find an op-amp that buffer the 5k DAC impedance all the way to 12 ohms with a single stage (and drive 50-100mA)
For 4, I'm using 1N4148 + some simple/passive low-pass filter
For 5, I'm going to use the MCU's builtin op amp since it's more than capable for this application (gain=20, bandwidth=50kHz)
So, I think the design is good, the only real question that remains is how to design the filters. I made a 4th order 1 MHz lowpass using 150 ohms + 1nF through hole components on a piece of perf board. It worked well for lower frequencies, but beyond ~30MHz it starts letting a lot through again. Problematic considering the SPI driver runs at 36 MHz (and still looks pretty square at that frequency).
Questions:
- Is it worth doing anything other than a 3-5th order RC lowpass?
- Will the typical parasitics for 0402 parts allow such a filter to work well up to hundreds of MHz?
- The measurement circuit needs an op-amp for gain anyways. What's the ideal way to combine the passive filter with the gain stage?
- Any other notes/critiques of the general idea