Cheap sinewave LFO question - Page 1
Forum section: electronics / beginners

author: Sigmoid
author_rank: Frequent Contributor
timestamp: October 30, 2014, 04:01:28 pm
content: HeyI'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.

author: clifford
author_rank: Regular Contributor
timestamp: October 30, 2014, 04:30:07 pm
content: 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.

author: fcb
author_rank: Super Contributor
timestamp: October 30, 2014, 04:38:43 pm
content: 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.

author: Simon
author_rank: Unknown
timestamp: October 30, 2014, 05:30:29 pm
content: ICL3086http://www.ebay.co.uk/itm/171480639372?ssPageName=STRK:MESELX:IT&_trksid=p3984.m1558.l2649

author: zapta
author_rank: Super Contributor
timestamp: October 30, 2014, 05:40:55 pm
content: 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).

author: atferrari
author_rank: Frequent Contributor
timestamp: October 30, 2014, 06:35:31 pm
content: Quote from: Sigmoid on October 30, 2014, 04:01:28 pmIf 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.

author: pa3bca
author_rank: Regular Contributor
timestamp: October 30, 2014, 08:46:27 pm
content: 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 filterLess 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.

author: atferrari
author_rank: Frequent Contributor
timestamp: October 30, 2014, 09:19:31 pm
content: Quote from: pa3bca on October 30, 2014, 08:46:27 pmCould you post circuit and eventually code?

author: LvW
author_rank: Frequent Contributor
timestamp: October 31, 2014, 12:36:32 pm
content: Quote from: Sigmoid on October 30, 2014, 04:01:28 pmOf course, there are harmonic (pure analog) oscillator schemes which are single-element tunable - mostly based ontwoopamp units.However, it may be a problem to realize such a large tuning range over 3 decades (o.1...10 Hz).

author: Simon
author_rank: Unknown
timestamp: October 31, 2014, 12:55:27 pm
content: 2 decades:0.1 - 1.01 - 10

author: LvW
author_rank: Frequent Contributor
timestamp: October 31, 2014, 12:59:13 pm
content: Quote from: Simon on October 31, 2014, 12:55:27 pmYes - from 0.1 to 10 we have two decades.However, the OP did mention a lower limit of 0.01 Hz.

author: Sigmoid
author_rank: Frequent Contributor
timestamp: October 31, 2014, 04:00:57 pm
content: 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?

author: pa3bca
author_rank: Regular Contributor
timestamp: November 01, 2014, 09:36:16 pm
content: Quote from: Sigmoid on October 31, 2014, 04:00:57 pmProbably. 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 voltageMinimum frequency step size and accuracySpectral purity of the sineTotal 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 likehttp://www.dx.com/p/ad9850-dds-signal-generator-module-150060Program 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