12

A Google search will give you a few billion ideas. Which is the simplest/easiest/cheapest that you know of?

Generating a square wave and then filtering out the harmonics isn't a good solution unless the filter frequency can be varied along with the square.

endolith
  • 28,494
  • 23
  • 117
  • 181

8 Answers8

7

Wien bridge with a pot to vary the frequency. I bet you could build one for less than one US dollar.

pingswept
  • 12,581
  • 4
  • 46
  • 64
  • 4
    You should clarify that you need a dual element potentiometer to do this, and I'm not sure you can find those for much less than 1 US dollar. The circuit requires that R=R1=R2 (And C=C1=C2). Also, the gain needs to be controlled so that oscillation will continue, see this page for more details: http://www.ecircuitcenter.com/circuits/opwien/opwien.htm – Kevin Vermeer Aug 09 '10 at 13:40
  • A good point, Nivek. I might suggest a dual digital pot like the Maxim MAX5496 or the Analog Devices AD5235, but that definitely increases the cost by two or three dollars. I suspect that there is also a way that you could use a current mirror made from some BJTs to make one pot do double duty, but I'll leave that attempt to someone who really knows what they're doing with analog stuff. – pingswept Aug 09 '10 at 14:07
5

Making a numerically controlled oscillator (NCO) with uC + DAC is very easy. Could be a fun FPGA project. An advantage to an NCO is that you change waveforms.

I did a low frequency numerically controller oscillator Arduino sketch (see http://wiblocks.com/docs/app-notes/nb1a-nco.html). At the bottom of the webpage are a couple of references to the original articles,

jluciani
  • 11,646
  • 1
  • 34
  • 54
  • There are some pitfalls to generating waveforms digitally, so you need to design the firmware well to produce low-distortion waveforms, but that goes for analog circuits, too. So relatively, this is cheap, simple, and easy. :) – endolith Nov 23 '10 at 20:56
  • At the bottom of the page there are references to the original articles published in the Computer Music Journals. These discuss the trade-offs in S/N. – jluciani Jan 03 '11 at 11:58
  • My 'advanced' uP class in college had this as an exercise in ASM on the 8051. The project was called waveform generator and we had to do a ramp, sawtooth, and sine wave. I recommend it as a learning exercise but don't do it in ASM =P – NickHalden Jun 15 '11 at 14:15
  • Use dither to keep distortion down, and if you're generating anything other than sine waves, use bandlimited synthesis methods to avoid aliasing. It's not trivial to make good quality signals. – endolith Oct 14 '14 at 14:28
  • The link seems to broken (`wiblocks.luciani.org: 4003`). Can you provide the essential part here (e.g. a schematic and the principle(s) it is based on)? – Peter Mortensen Feb 02 '18 at 22:45
  • The link should now work. – jluciani Feb 04 '18 at 01:01
3

You didn't specify the frequency (100Hz or 100MHz?) or how much the frequency had to be varied (0.01% or 1000% ?) or whether the frequency had to be varied by a voltage or a physical knob. Purity of sine wave and stability matters too.

A one-transistor FET Hartley oscillator is hard to beat for cheap.

Steve
  • 31
  • 1
2

Cheapest DIY DDS signal generators (including sine wave):

http://www.myplace.nu/avr/minidds/index.htm

http://www.scienceprog.com/avr-dds-signal-generator-v20

avra
  • 1,872
  • 3
  • 14
  • 21
2

You could also PWM or otherwise DAC values out of a table to produce sine waves. Then the filtering should be easier. A very cheap MCU could probably do it up to fair frequencies.

I might second some RC + opamp design in principle. Whether the output and adjustability suits you depends on the application.

There are also some function generator IC's, ranging from classic 8038 to various complex DDS thingies. They might not come that cheap, though.

I guess there's also the option of finding an affordable second hand lab signal/function generator. It might be a long search for a cheap one, but it's all relative. Or you could take a spare AC generator and turn the shaft with variable speed. Amplify for power/impedance/voltage :)

XTL
  • 1,223
  • 1
  • 11
  • 18
  • http://www.exar.com/Common/Content/ProductDetails.aspx?ID=XR2206 is only a few bucks: http://www.futureelectronics.com/en/technologies/production-products/test-measurement/function-generators/Pages/4075065-XR2206D-F.aspx "The XR-2206 is a monolithic function generator integrated circuit capable of producing high quality sine, square, triangle, ramp, and pulse waveforms of high-stability and accuracy. The output waveforms can be both amplitude and frequency modulated by an external voltage." – endolith Aug 09 '10 at 14:48
  • Oh, I've forgotten about the XR entirely. I actually meant to see if I could find a couple to try some time ago. – XTL Aug 09 '10 at 17:20
  • 2
    Old thread, but FYI: XR-2206 is obsolete: see (http://electronics.stackexchange.com/questions/12422/analog-function-generator-ics) for details – Adam Lawrence May 04 '11 at 16:53
1

If you want to go the direct digital synthesis route with discrete chips, capacitors, etc. the result won't be nearly as compact as what could be done with a CPLD or micro, but would be pretty reasonable, especially since a significant amount of the circuitry could be shared among the five signal outputs.

Global signal generation requirement:

  • Input clock source
  • 12-bit counter (74HC4040)
  • 14 inverters (3 of 74HC14, leaving 4 gates open)
  • 13 small-signal capacitors
  • 13 resistors

Per-output requirement:

  • 13-input NAND gate (74HC133)
  • 12-bit counter (MC14521 or CD4521)
  • Lots of jumpers to set frequency

More details to follow. Given an input of 4,096,000Hz, the circuit should be able to produce square-wave outputs from 2KHz to 512Khz in multiples of 0.5Hz for signals up to 2KHz, 1Hz for signals up to 4Khz, etc. Other techniques can be used to convert a square wave thus generated into a sine wave.

Here's a circuit diagram to show the concept:

(HERE)

This circuit includes a configurable frequency generator (5 switches select input frequencies from 1/16 of the input up to 31/16 of the input). I also threw on a rough square-to-sine converter. Note that unlike most filtering techniques, this one maintains a reasonably consistent amplitude over the frequency range. The wave is quite rough because the above circuit only uses 4-bit counters. The MOSFETs would be replaced in practice by 4066 pass-gates (4 per chip).

supercat
  • 45,939
  • 2
  • 84
  • 143
1

You can still do it with a square wave and filtering out the harmonics. There are a number of high order filters that can be controlled with a microcontroller easily. This one allows the user to control the corner frequency with an outside clock (second square wave from the micro). Because of the large corner frequency to clock frequency ratio you could even do it without the need of another timer/interrupt with a simple software counter...

  • If you're using a microcontroller, I would think PWM output would be simpler. Then you only need a simple fixed-frequency filter. – endolith Aug 09 '10 at 14:52
0

Triangle oscillator with a triangle to sine converter.

Thomas O
  • 31,546
  • 57
  • 182
  • 320
  • 2
    Are you being charged per-character by your ISP? I kid, but you could probably develop this answer a bit further... – Kevin Vermeer May 04 '11 at 13:57
  • @Reemrevnivek, I had to rush to go to college, and had 2 mins to type out that answer... 1.5 mins of that were finding the link to what I wanted. – Thomas O May 04 '11 at 16:55
  • 1
    @ThomasO: You can edit answers to add more info at any time... – endolith Mar 19 '12 at 21:58