Author Topic: ~60khz sine wave generation  (Read 1433 times)

0 Members and 1 Guest are viewing this topic.

Offline Rx7manTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: ca
  • Hobbyist/Hack/Farmer
~60khz sine wave generation
« on: May 08, 2023, 06:37:11 am »
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

 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14590
  • Country: de
Re: ~60khz sine wave generation
« Reply #1 on: May 08, 2023, 06:45:20 am »
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.
 
The following users thanked this post: Rx7man

Offline moffy

  • Super Contributor
  • ***
  • Posts: 1980
  • Country: au
Re: ~60khz sine wave generation
« Reply #2 on: May 08, 2023, 08:03:26 am »
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.
 
The following users thanked this post: Rx7man

Online Benta

  • Super Contributor
  • ***
  • Posts: 6093
  • Country: de
Re: ~60khz sine wave generation
« Reply #3 on: May 08, 2023, 10:44:02 am »
 
The following users thanked this post: Rx7man

Offline Rx7manTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: ca
  • Hobbyist/Hack/Farmer
Re: ~60khz sine wave generation
« Reply #4 on: May 10, 2023, 01:21:19 am »
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 :)
 

Offline Rx7manTopic starter

  • Regular Contributor
  • *
  • Posts: 124
  • Country: ca
  • Hobbyist/Hack/Farmer
Re: ~60khz sine wave generation
« Reply #5 on: May 10, 2023, 01:45:00 am »
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... Hmmmm
https://www.mouser.ca/datasheet/2/609/ad9833-3119795.pdf
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7937
  • Country: ca
Re: ~60khz sine wave generation
« Reply #6 on: May 10, 2023, 02:20:46 am »
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.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1735
  • Country: au
Re: ~60khz sine wave generation
« Reply #7 on: May 10, 2023, 03:54:30 am »
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... Hmmmm
https://www.mouser.ca/datasheet/2/609/ad9833-3119795.pdf

AliExpress 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.
 
The following users thanked this post: Rx7man, mskeete

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1735
  • Country: au
Re: ~60khz sine wave generation
« Reply #8 on: May 10, 2023, 05:12:27 am »
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 :)
You 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 one
https://www.lcsc.com/product-detail/Power-Inductors_TDK-TPLC553030-592H_C531457.html
not small, but good ±3% precision and oscillates at 64.85kHz with 1.00nF


There is also the classic three stage Phase 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_HamWorkbench


and for fun, here is a shift register + resistor DAC uses as a clocked sine wave output
https://forums.parallax.com/discussion/141435/another-sine-wave-output-technique
« Last Edit: May 10, 2023, 05:49:37 am by PCB.Wiz »
 
The following users thanked this post: mycroft, Rx7man

Offline Infraviolet

  • Super Contributor
  • ***
  • Posts: 1121
  • Country: gb
Re: ~60khz sine wave generation
« Reply #9 on: May 10, 2023, 05:59:19 am »
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.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14590
  • Country: de
Re: ~60khz sine wave generation
« Reply #10 on: May 10, 2023, 06:52:18 am »
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.
 

Offline Datman

  • Regular Contributor
  • *
  • Posts: 114
  • Country: it
Re: ~60khz sine wave generation
« Reply #11 on: May 10, 2023, 07:21:25 am »
If you already have a good square wave, you can simply filter it by a LC and amplify as needed.
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 6093
  • Country: de
Re: ~60khz sine wave generation
« Reply #12 on: May 10, 2023, 09:22:48 pm »
If you already have a good square wave, you can simply filter it by a LC and amplify as needed.
I 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.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1735
  • Country: au
Re: ~60khz sine wave generation
« Reply #13 on: May 10, 2023, 11:55:27 pm »
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..
Do you need to shift this frequency to find that sensor resonant frequency, or is the sensor already oscillating, and you look for beat frequency differences ?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf