Author Topic: Cheap sinewave LFO question  (Read 6396 times)

0 Members and 1 Guest are viewing this topic.

Offline SigmoidTopic starter

  • Frequent Contributor
  • **
  • Posts: 488
  • Country: us
Cheap sinewave LFO question
« on: October 30, 2014, 04:01:28 pm »
Hey :)

I'm interested what would be considered the best ways in practical life to generate an extremely low-frequency (say, .01..10Hz) sinewave without the need for specialized, expensive hardware like tightly matched dual pots.

A wien bridge oscillator requires you to have some kind of precision matched dual pot or dual variable capacitor, which tend to be expensive, and in this digital age, sometimes unobtainable. Generating square waves is easy, but if I want the frequency adjustable across a decade or more, I'd have to tune the low pass filter together with the multivibrator.
« Last Edit: October 30, 2014, 04:09:12 pm by Sigmoid »
 

Offline clifford

  • Regular Contributor
  • *
  • Posts: 64
  • Country: at
    • www.clifford.at
Re: Cheap sinewave LFO question
« Reply #1 on: October 30, 2014, 04:30:07 pm »
You want a DDS (http://en.wikipedia.org/wiki/Direct_digital_synthesizer). E.g. create a N-bit parallel digital signal with a microcontroller and use a R-2R network as simple DAC.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Cheap sinewave LFO question
« Reply #2 on: October 30, 2014, 04:38:43 pm »
There's a nice sinewave VCO in the LM13700 application notes.  Or build a triangle VCO and they use a tri>sine converter. Have a look at the synthesizer forums for schematics.
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: Cheap sinewave LFO question
« Reply #4 on: October 30, 2014, 05:40:55 pm »
You can use a MCU with a phase accumulator and a DAC to generate arbitrary low frequencies.  it goes like this, you keep a float variable and update it at fixed intervals (e.g. 1 Khz). Each time you add modulo one cycle a small (fixed per output frequency) value that represents the changes in phase change in that time slot. Then you  output this value to the DAC (with as many as significant bits as your DAC support).
 

Offline atferrari

  • Frequent Contributor
  • **
  • Posts: 314
  • Country: ar
Re: Cheap sinewave LFO question
« Reply #5 on: October 30, 2014, 06:35:31 pm »
Hey :)

I'm interested what would be considered the best ways in practical life to generate an extremely low-frequency (say, .01..10Hz) sinewave without the need for specialized, expensive hardware like tightly matched dual pots.

A wien bridge oscillator requires you to have some kind of precision matched dual pot or dual variable capacitor, which tend to be expensive, and in this digital age, sometimes unobtainable. Generating square waves is easy, but if I want the frequency adjustable across a decade or more, I'd have to tune the low pass filter together with the multivibrator.

If adjustable think of DDS. What most of the times is not mentioned that the output of the DDS itself needs to be filtered.

For DDS there are basically two routes: dedicated chip or micro. I choose the second one for a dual generator.
Agustín Tomás
In theory, there is no difference between theory and practice. In practice, however, there is.
 

Offline pa3bca

  • Regular Contributor
  • *
  • Posts: 135
  • Country: nl
Re: Cheap sinewave LFO question
« Reply #6 on: October 30, 2014, 08:46:27 pm »
For frequencies say below 100 - 200 Hz you don't even need a DAC or R2R - just use:

* 1 8 pin PIC 12F1840  (or any other micro you like)
* 1 pot to an analog input pin to set the frequency
* a few decoupling caps, and 2 resistors and 2 caps for a two pole lowpass filter
Less than 3 bucks for parts!

That's it. Write a software DDS and use PWM for the output - this is just a sine table and a few lines of code. Filter the PWM frequency out and you will have a very clean < 100Hz sine.
If you're interested I can send/post some code.


 

Offline atferrari

  • Frequent Contributor
  • **
  • Posts: 314
  • Country: ar
Re: Cheap sinewave LFO question
« Reply #7 on: October 30, 2014, 09:19:31 pm »
For frequencies say below 100 - 200 Hz you don't even need a DAC or R2R - just use:

* 1 8 pin PIC 12F1840  (or any other micro you like)
* 1 pot to an analog input pin to set the frequency
* a few decoupling caps, and 2 resistors and 2 caps for a two pole lowpass filter
Less than 3 bucks for parts!

That's it. Write a software DDS and use PWM for the output - this is just a sine table and a few lines of code. Filter the PWM frequency out and you will have a very clean < 100Hz sine.
If you're interested I can send/post some code.

Could you post circuit and eventually code?
Agustín Tomás
In theory, there is no difference between theory and practice. In practice, however, there is.
 

Offline LvW

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: de
Re: Cheap sinewave LFO question
« Reply #8 on: October 31, 2014, 12:36:32 pm »
Hey :)
I'm interested what would be considered the best ways in practical life to generate an extremely low-frequency (say, .01..10Hz) sinewave without the need for specialized, expensive hardware like tightly matched dual pots.

Of course, there are harmonic (pure analog) oscillator schemes which are single-element tunable - mostly based on two opamp units.
However, it may be a problem to realize such a large tuning range over 3 decades (o.1...10 Hz).
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Cheap sinewave LFO question
« Reply #9 on: October 31, 2014, 12:55:27 pm »
2 decades:

0.1 - 1.0
1 - 10
 

Offline LvW

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: de
Re: Cheap sinewave LFO question
« Reply #10 on: October 31, 2014, 12:59:13 pm »
2 decades:

0.1 - 1.0
1 - 10

Yes - from 0.1 to 10 we have two decades.
However, the OP did mention a lower limit of 0.01 Hz.
 

Offline SigmoidTopic starter

  • Frequent Contributor
  • **
  • Posts: 488
  • Country: us
Re: Cheap sinewave LFO question
« Reply #11 on: October 31, 2014, 04:00:57 pm »
Yes, the wider tunable the better. With an LFO you normally want as much flexibility as you can get.

So it seems to be the consensus that a MCU solution is the most practical? :)
 

Offline pa3bca

  • Regular Contributor
  • *
  • Posts: 135
  • Country: nl
Re: Cheap sinewave LFO question
« Reply #12 on: November 01, 2014, 09:36:16 pm »
So it seems to be the consensus that a MCU solution is the most practical? :)
Probably. But before you make a decision / create a design / buy a solution you have to specify your requirements in more detail beside min/max frequency. For instance:
  • Output voltage
  • Minimum frequency step size and accuracy
  • Spectral purity of the sine
  • Total cost
  • ........
With a very simple MCU software based DDS it is easy to generate a sine up to a few 100 Hertz without any additional hardware. You don't even need a DAC or a R2R ladder to generate the analog sine. As requested I have attached schematics and code for a PIC12F1840 CTCSS generator. (Sorry for the somewhat crappy schematics, but I was in a hurry an had to create it from scratch/memory).

This simple solution has some some caveats. For instance
* You need to filter out the DDS PWM signal. This is easy, in this case I need to filter out a 20 KHz signal and pass a < 100 Hz signal. A two pole RC filter (both with a cutoff frequency of 159 Hz does the job easily. After the first LC filter a small DDS ripple can still bee seen, but not after the second RC filter).
* due to computing capacity restrictions in the PIC you need a pre-calculated sine wave table. The table has 255 entries for a full sinewave, and the amplitude values are 8 bits. The PWM as implemented also has an 8 bits resolution.
You have to decide if 256 discrete amplitude steps is good enough. In my 77 Hz example the 156 Hz rolloff filters these amplitude steps out quite good, but with 0,01 Hz output you WILL notice the 256 discrete steps unless you have an adaptable output filter...
You can increase it to max 10 bits with some effort resulting in 1024 discrete amplitude steps. The table will be larger, but this can be compensated by storing only one quarter of the sinewave if memory is a problem. Also you should probably use more than 256 steps for the sine in the time domain...
Then there is the issue of setting the output frequency. The AD of the PIC can be used to read out the output of a potmeter, resulting in a resolution of 10 bits, so 1024 discrete steps. Not a lot for 3 decades of frequency range. (i.e. unusable). So use some other pins as range selectors?

If you need more resolution (in amplitude) just use a DDS like
http://www.dx.com/p/ad9850-dds-signal-generator-module-150060
Program it with a PIC.

Or just buy a complete unit. Probably cheaper than building all yourself (including a LCD screen, encoders, etc)
http://www.dx.com/p/udb1000-dds-signal-generator-module-green-152755
« Last Edit: November 02, 2014, 09:46:35 am by pa3bca »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf