Sensing position of conductive part through coil impedance change - Page 1
Forum section: electronics / projects

author: charliehorse55
author_rank: Contributor
timestamp: June 25, 2024, 08:22:03 am
content: 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 MCUBuffer sine wave to an output impedance of 12 ohms (halfway between 15 and 9)Connect buffered wave to coil, forming a voltage dividerRectify the voltage at the middle of the divider to convert the AC amplitude to a DC one. Low pass filter to reduce rippleAmplify voltage difference to match ADC range using the MCU's built-in op ampMeasure resultant voltage using ADCFor 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 filterFor 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

author: PCB.Wiz
author_rank: Super Contributor
timestamp: June 26, 2024, 01:05:51 am
content: Quote from: charliehorse55 on June 25, 2024, 08:22:03 amAre you using the motor as a sensor, or do you want to sense this change on an operating (driven and rotating) motor ?How fast do you need the measurement result ?QuoteYou do not need to 'impedance match', if you current drive you get the full % swing, not half of it.Quote from: charliehorse55 on June 25, 2024, 08:22:03 amOr, you can get low Cin MOSFETS & high HFE transistors, tho 600kHz is getting Ft limited.

author: charliehorse55
author_rank: Contributor
timestamp: June 26, 2024, 07:07:17 am
content: Quote from: PCB.Wiz on June 26, 2024, 01:05:51 amIt has an interactive element, so a part may be placed over the board and I want to detect where it is. I can also briefly shut off the motor drive to measure where something is. Faster is better, but anything less than 1ms is probably fine. That's 600 cycles at 600kHz, should be more than enough.Quote from: PCB.Wiz on June 26, 2024, 01:05:51 amSounds nice, not exactly sure how I'd build a circuit to do that. The tricky thing is that due to other design constraints each coil can only be accessed from a single end, and needs a DC bias. So the voltage at "Measure" must be always between 0 and some +rail (say 10V).Quote from: PCB.Wiz on June 26, 2024, 01:05:51 amI looked at this briefly - the datasheet for the MCU lists a max drive of 50pF for the DAC. A quick search found a few mosfets with Cin < 30pF, so that could work.

author: moffy
author_rank: Super Contributor
timestamp: June 26, 2024, 07:56:34 am
content: For a high speed/high current driver, video amps are a good choice, you can get quads at reasonable prices, they are meant to drive 75R coax so if you paralleled 4 each driving its own 75R resistor you'd have about 19R output impedance e.g.https://www.analog.com/en/products/max4022.htmlP.S. I know the 75R is really 150R because of the series and termination resistors, but they do appear to be rated down to 75R at least with 2Vp-p@5MHz.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: June 26, 2024, 08:20:42 pm
content: Quote from: charliehorse55 on June 26, 2024, 07:07:17 amGood, that's sounding more practical.Quote from: charliehorse55 on June 26, 2024, 07:07:17 amYou do not need a pure sine, you can drive even with a triangle, and get a nominal square wave on the measure point.Driving from a high enough resistor is close to current drive.eg if I use your values with a 600kHz 5V swing into 250 ohms, for 20mA peak, that measure point has5Vpp Sine = 301.18294mV pp5Vpp triangle = 235.72546mV ppTo keep things simple, I would just output 600kHz square wave into an integrator, for the triangle, and then sync detect (using that square wave) the measure point into a 1ms filter + x10 gain.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: June 28, 2024, 03:24:26 am
content: Quote from: charliehorse55 on June 26, 2024, 07:07:17 amHow many channels do you need to capture ?Quote from: charliehorse55 on June 26, 2024, 07:07:17 amAn alternative to impedance at 600kHz would be to make that inductor resonate/oscillate at ~ 600kHz - Spice says Fo = 593.5kHz and Q ~ 6 with an 18nF cap.You can make a grounded inductor / single terminal osc, using a 2GU04 gate or a Dual PNP ( or maybe a 4069 or 4011UB if you run from a 10V supply ?)Feeding the oscillator into a part like 74AHC1G4210 gives 0.8625ms between edges, for easy MCU measurement.

author: charliehorse55
author_rank: Contributor
timestamp: August 01, 2024, 11:07:00 pm
content: I've spent the last month prototyping and testing different ideas. I've ended up settling on a current drive system using an op amp:I didn't come across this design on the internet, but I think it's the way to do it. I modified the design of a unipolar constant current driver to allow currents in both directions. I built the circuit (op amp is RT9146), and it's working quite well.This circuit has the added benefit of solving another problem, identifying pieces placed on the board. The comment about the Q factor being 6 got me thinking about RFIDs. Since the readers work by detecting small changes in impedance at the reader antenna, the circuitry is identical to what I already need to detect where the pieces are. I ordered some flex-pcbs that match the coil pattern on the board (to use as antenna for the RFID) and I was able to read 125 kHz passive RFIDs, using the motor coils as antenna. Luckily, even though they are only rated for 125 kHz, a quick test showed them working in excess of 10 MHz, which is great because the motor coils operate best around 700kHz.

author: moffy
author_rank: Super Contributor
timestamp: August 02, 2024, 12:09:25 am
content: A small shottky diode like a BAT54 might work a little better than the 1N4148, lower Vf and generally faster at peak detection.