# DIY FunctionGenerator

Discussion in 'Electronics Homework Help' started by dssteven, Nov 13, 2012.

1. ### dssteven

47
0
May 9, 2012
Hey everyone!

Been a while since my last post but I need some help again. I'm in an upper level electronics course and we're tasked with designing a function generator. I'm not looking exactly for circuit diagrams or anything of the sort but I'm wondering where to start. The function generator criteria is as follows:

• Frequency Range 100Hz to 1kHz
• Voltage Amplitude of 0.5V to 10V
• Sine, Triangle and Square Wave
• A DC offset must be able to be added

Also, this has to be done using only Op-amps, Capacitors and Resistors. Variable Caps/Resistors work too. Here is what I know:

For the voltage amplitude, i just need to run the output through a simple filter with a voltage divider in parallel with two Zener Diodes. I can handle that part no problem.

I've designed a Schmitt trigger Oscillator to which I can make a square wave with varying frequency and Amplitude (hooray!) but I can't seem to get the Triangle wave to output correctly (using an integrator on the output of the square wave). I also can't figure out a way to make a sine wave out of this setup. Regardless of my schematic, i'm pretty sure i'm going about this the wrong way.

Would it be better to start with a sine wave generator? and if so, how do I do this? I've looked a lot on the internet but can't find much. We've not yet discussed a sine wave generator or even a Schmitt trigger in our lectures yet but I have no problem learning them on my own. Please help me in some suggestions as to where I should begin with this.

Many thanks!

Dan

2. ### Harald KappModeratorModerator

10,771
2,427
Nov 17, 2011
Look up the MAX038.
Digital synthesis would be another venue, but I think that is not what is requested on the level of your course.

Harald

3. ### dssteven

47
0
May 9, 2012
We can't use any ICs... but I realized I can make a sine wave by running the triangle wave through another integrator since it acts as a LPF... what I'm running into now is trying to get the triangle wave to output with the same amplitude as the output of the first op amp stage. So this is what I've got for math...

Now, using these parameters... this is what I have on Multisim:

Please let me know if my math is horribly wrong or if there is something i'm not understanding. This is how we were taught in class as I remember it so this is how I solved. Also, notice the amplitudes on the o-scope are not actually the same, the green is much much smaller...

Thanks!!

EDIT: Apparently my images weren't showing. Hope this solves it! Thanks Harald.
And more clarification: R7 is Rf and R5 is Ri in the math.
Dan

#### Attached Files:

File size:
15.7 KB
Views:
241
• ###### Capture.JPG
File size:
124.2 KB
Views:
216
Last edited: Nov 14, 2012
4. ### Harald KappModeratorModerator

10,771
2,427
Nov 17, 2011
The simplest way to adjust the amplitude:
- to lower the amplitude use a resistive divider.
- to increase the amplitude use an amplifier (simple non-inverting OpAmp stage)
Or combine both using an adjustable divider (potentiometer) and a fixed gain OpAmp (e.g. *10).
Thus you can adjust the overall gain from 0 (pot at min) to 10 (pot at max).

Harald

Harald

5. ### Harald KappModeratorModerator

10,771
2,427
Nov 17, 2011
Not right. Look at the rising edge of the triangle. It can be described by y=a*t where a is a constant describing the slope and t is time. Integrating this gives
int(y) = a/2*t²2 This is far from a sine, it has a concave shape whereas a sine would have a convex shape.

You can convert a triangular waveform into a sine by using a real low pass filter. If designed correctly, this will eliminat the harmonics and leave the fundamental (sine). Your low passs filter will have to track the input frequency since a filter designed for 100 Hz will not let pass 1kHz and a filter designed for 1kHz will not remove the harmonics from a 100 Hz signal sufficiently.

You may want to read up this discussion on the same topic, including a schematic.

Harald

6. ### dssteven

47
0
May 9, 2012
Thanks Harald. I ended up reading that discussion, some good stuff. I got everything to work except adding the +/- 5V DC offset. Any ideas on how to do this?

Thanks!

7. ### Harald KappModeratorModerator

10,771
2,427
Nov 17, 2011
Use an operational amplifier in an adder configuration.

Harald