~60khz sine wave generation - Page 1
Forum section: electronics / projects

author: Rx7man
author_rank: Regular Contributor
timestamp: May 08, 2023, 06:37:11 am
content: I need to generate a 60-70 khz sine wave (or close to sine) for a project, it's a position sensor that uses the inductance of a coil at resonant frequency.. I've thought of a number of ways of doing this, from using a PIC microcontroller, crystal oscillator and divider, 555 timer, etc.I've tested it with a square wave and it seems to work, I'm reading the amplitude of the peaks, as that is very closely related to the position of the sensor, so amplitude stability is important.. Other than that, I'm pretty open to any design ideas. Amplitude isn't really critical, but if I had 5V P-P and run through a decoupling capacitor that would probably work OK

author: Kleinstein
author_rank: Super Contributor
timestamp: May 08, 2023, 06:45:20 am
content: A common way for such sensors is to use the sensor itself as a resonator and part of the oscillator and than measure the frequency and not the amplitude. So the sensor is part of a LC oscillator. A frequency measurement is easy and high resolution for a µC.If one wants to keep the fixed external frequency and than a measurement of amplitude or maybe the phase, one can start with a square wave (which is easy to get with a stable amplitude) and apply some RC low pass filtering to reduce the harmonics. Likely one would have to avoid inductors to avoid magnetic coupling to the sensor.

author: moffy
author_rank: Super Contributor
timestamp: May 08, 2023, 08:03:26 am
content: Do you need to track the resonant frequency of the inductance of the position sensor with time, temp etc? Or is a set frequency, which might drift a little, good enough? Of course something produced by a micro should have a stable frequency but won't track unless designed to. If a square wave works, unless there are other mitigating factors like noise, amplitude stability will be as good as the supply provided to say your 74HC14 driving the square wave.

author: Benta
author_rank: Super Contributor
timestamp: May 08, 2023, 10:44:02 am
content: This might be helpful:https://www.eevblog.com/forum/projects/simple-sinusoidal-oscillators

author: Rx7man
author_rank: Regular Contributor
timestamp: May 10, 2023, 01:21:19 am
content: that Peltz oscillator seems interesting, simple enough, and close enough to a sine wave it'll probably work fine for the application, Perhaps I'll put a decoupling cap in it and a bit of a pull-up resistor after and that would allow me to read the peaks with an op-amp pretty easily.. certainly food for thought

author: Rx7man
author_rank: Regular Contributor
timestamp: May 10, 2023, 01:45:00 am
content: I just looked up the AD9833 chip.. Not cheap at about $15, but it would definitely do the job, minimize components and everything is done in software... Hmmmmhttps://www.mouser.ca/datasheet/2/609/ad9833-3119795.pdf

author: BrianHG
author_rank: Super Contributor
timestamp: May 10, 2023, 02:20:46 am
content: If you already are using a PIC, you can just get one with a dac and with a tight loop, generate something with around 16 step levels on the output. Using an RLC filter at the output pin, or op-amp with a RC band oversampling/band pass filter would leave you with a clean sine wave.This can also be done just using any PIC's PWM 1 bit output.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 10, 2023, 03:54:30 am
content: Quote from: Rx7man on May 10, 2023, 01:45:00 amAliExpress have AD9833 parts mounted on modules for 'a few dollars'They also have AD9850 and AD9851 modules for a few more $$Great if you are just wanting to test something.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 10, 2023, 05:12:27 am
content: Quote from: Rx7man on May 10, 2023, 01:21:19 amYou would need to add a emitter follower or opamp buffer, for sine out.You can also make a LC osc with a standard CMOS unbuffered gate, the same as the MCU oscillators use, wire it just like a XTAL Osc and swap the XTAL for the inductor.Keep in mind a LC osc will be modest precision, the best mainstream inductors are mostly ±5% (a few ±3%) and the decent caps are ±1%I did find this onehttps://www.lcsc.com/product-detail/Power-Inductors_TDK-TPLC553030-592H_C531457.htmlnot small, but good ±3% precision and oscillates at 64.85kHz with 1.00nFThere is also the classic three stagePhase Shift Oscillator, that uses 3 R and 3C operating at a 60 degree phase shift on each stage.https://www.nutsvolts.com/magazine/article/march2015_HamWorkbenchand for fun, here is a shift register + resistor DAC uses as a clocked sine wave outputhttps://forums.parallax.com/discussion/141435/another-sine-wave-output-technique

author: Infraviolet
author_rank: Super Contributor
timestamp: May 10, 2023, 05:59:19 am
content: I'd be interested to hear mroe about this system once you've got it all up and running. Might well give me some ideas for something I'm working on, if the first few ideas I try once my PCBs finally arrive don't work out too well.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 10, 2023, 06:52:18 am
content: With a separate LC oscillator one would still need some amplitude stabilization. Another point is to use a closed core inductor to keep the stray field small. Due to the inductor core there will be some temperature dependence. If one wants to look at the amplitude at the sense both a stable frequency and amplitude are needed. Low harmonics are less important. The DDS way is possible, but quite some effort and more overkill. Chances are a square wave plus fitler is good enough and if there is a µC anyway the µC could also produce the square wave via PWM. For the amplitide measurement it can help to run synchronous to the clock.The Peltz oscillator may be an option for running the sensor in resonance.

author: Datman
author_rank: Regular Contributor
timestamp: May 10, 2023, 07:21:25 am
content: If you already have a good square wave, you can simply filter it by a LC and amplify as needed.

author: Benta
author_rank: Super Contributor
timestamp: May 10, 2023, 09:22:48 pm
content: Quote from: Datman on May 10, 2023, 07:21:25 amI think you'll find that a simple LC filter won't do the job. 60 kHz, next harmonic is 120 kHz. Has to be one mother of a filter to suppress that.A high-Q BP might do it, but have fun tuning it.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 10, 2023, 11:55:27 pm
content: Quote from: Rx7man on May 08, 2023, 06:37:11 amDo you need to shift this frequency to find thatsensor resonant frequency, or is the sensor already oscillating, and you look for beat frequency differences ?

author: Datman
author_rank: Regular Contributor
timestamp: March 21, 2025, 12:14:55 pm
content: Quote from: Benta on May 10, 2023, 09:22:48 pmNot a simple LC filter, but a LC resonator!

author: TimFox
author_rank: Super Contributor
timestamp: March 21, 2025, 02:25:18 pm
content: Quote from: Benta on May 10, 2023, 09:22:48 pmA good square wave has only odd harmonics, so the lowest one is at 3x the fundamental. Imperfectly symmetric square waves will have low amplitudes at even harmonics. A digitally generated square wave should have good symmetry (mark vs. space in archaic language).

author: Picuino
author_rank: Super Contributor
timestamp: March 21, 2025, 03:04:47 pm
content: Would it be useful to measure inductance directly with a resonator?In that case this project, with little modifications, may work. It is simple and quite accurate.https://electronics-diy.com/lc_meter.phpEDIT:It works as a resonator and a frequency meter with the PIC. Using some arithmetic into the microcontroller, the L can be calculated from the known capacitor C and the measured frequency f.The resonant frequency is not linear with the value of L: f = 1 / (2 * pi * sqrt(L * C))So: L = 1 / (C * (f * 2 * pi)^2)

author: Picuino
author_rank: Super Contributor
timestamp: March 21, 2025, 03:39:28 pm
content: https://www.picuino.com/circuits/?ctz=CQAgjCCsCmC0CcIBMkB0kwAYkA4wDYB2TYpJTfKTKEAFgGYo4wwAoAJ2SVpHsx-r1KfHtVrFMmVgHdeQ3vzmUyomVx7dqKhaoDG6nQfo5RITKkmX41m7buIwqWnhIsMuMEniKk6DgYItbhB8UyxLKVlBSkClAylObVjo8HxqanDLVgB5OO1aSXizNSS0g3IcYs5YitTqYzCIyKMTOt5W5u1amsxKqX0cLV622vSLCPtJmxBYR2d8UPdIHHhjSGNkPwGhysH201o4PvRsenF6L08weCRCYtk9hranqQAbM2Rh+o6zccxrqb2Sqwcz-WjXfiEfC3QRgejwMCQe4fJ6PDpqHYgPajVgANxmzn2BMqoQ+YmoSPSv0galghJeROadJJGmCpKkAENysEUtpEJTwE0Mk4XIQ3J48F5FI54DgVjdaJBIP9IIRBndMpIch8wFCQjxdZR0hjwHrMVIAPYgO7skAADxcYGggt+EC04GJXB1nuyAFcAC4ABwDrCAA

author: Picuino
author_rank: Super Contributor
timestamp: March 25, 2025, 04:39:56 pm
content: Circuit with switch to add or remove 1% inductance. Frequency changes from 61650Hz to 61950Hz.https://www.picuino.com/circuits/?ctz=CQAgjOCmC0AcKwJwDoAMBmRA2dZEHYAmQjdAFhAFZUqQz0qYwwAoAJxEKPCxrLCw8affKjEsA7p24l4XQkJCoWAY2kLCsOd3SwKwtGLGITps+cSdkZfEVijYlTIljpBhZJXadUcsjVkQLH1wI3EpfkEBPgFOQn1vdFQKJIpIkFSlULCWAHk6WOI02AD4rOUOQPiA3wy9LLAw5TUq-3BNTjaDJote0ysbXiQyLS57UQYPLzUwDur2+F0Q9GQkpvWxMhh4VGRRX0QwOyR8LHiGZSlZxfrApaUWABs6Pz5FknLDVDw+ix3DQ74RC4JCESiwLDDHaSF51CjXOEPCKvBadYQsABuIGgI0ROPgwXKdBolCJuy8UnxiNi90u2NxhMChIqBSivFZQRCjXCPgJaVizJY-ggmSKHLFEFgAB0AM5gSiy6Dy2XcsKylZHLAuWZHTWYGyyjw2OwOJwmVxYFVNJSG1BWjZicCyumtGiirow+S8jLJb1091u32ZOnpMXpYOe2r3L20z0yLTqP1PWHoD642lKL5iBS7IyETCELUlQjMIzywTKGU8amCVPCLIAMwAho8ZZAYTT6un6nSaWn3uiAPZBTlZAAesEaYEgoUzED44Hp8DADAuaDBWUsNAgVMsa9QG5ouQArgAXAAOZ5YQA