# Oscillator basics

Discussion in 'Electronic Basics' started by Ryan, Jul 18, 2003.

1. ### RyanGuest

I'm trying to repair my first high power car audio amplifier, and then
hopefully two or three more.

I've been told left and right that I need a sine wave generator in order
to deduce anything. I'll elaborate on the amp's condition later.

So, I'm off to build my first sine wave generator. I tried with a
helper a few weeks ago and gave up, so now I want to hit it from
scratch.

At my disposal, I have the following:
A couple of solderless prototype boards
Dual OP AMP, DC 9039
NE556 - Dual Timer
Dead computer power supplies for parts, I can get 1 or 2 of these per
week.

I think I want to make a generator based on an op amp, and then a
resistor and capacitor for the timing. Already, I don't understand and
my lack of understanding is why I gave up.

From the beginning, if I have a battery, and a capacitor what is the
result? I'd get some flow of current and then none, right? If I added
a resistor it would be slower, right?

The resistor and capacitor with an op amp outputs a triangular wave, is
that correct? Is it a square wave instead?

My understanding is that once I get a square wave produced, I can then
calculate a resistor and capacitor filter to permit only the fundamental
and then end up with a pretty looking sine wave.

So I guess what I want to do, is from the ground up, build a square wave
(or whatever cyclical repeating thing), filter it, filter it again, and
get it looking like a sine wave. After that, put a voltage follower on
it so that a connected device won't change it.

==

About the amp, it is an Alpine MRV-T757. When I picked it up, all the
power supply outputs were scorched. I replaced those, and now that part
works. The rail voltage is +-40 volts. One output channel works fine,
the other does not. With the bad channel put together, it blows a fuse
right away. I've checked all transistors/mosfets. On the bad side, one
of each of the two output fets were shorted gate to drain. It should
work with half of them in place as the working channel does. With the
output transistor removed, the amp does not blow anything. I put on a
square wave generator and scoped the driver transitors. The form is
funky looking, I'd have to email you pictures of it. A few folks told
me I'd have to put in a sine wave rather than a square one to make any
sense of it.

-Ryan

2. ### Keith R. WilliamsGuest

A sine wave certainly makes the analysis simpler. Superposition
and all...
When I did this stuff I preferred a quadrature oscillator using a
couple of op-amps/integrators to solve the diff-eqs and a couple
of diodes for limiting. With the proper gain I could get
remarkable THD. It gets harder for a wide frequency variation
though.
Agreed. It makes the analysis simpler too.
like more of a PITA to me. Then a gain, depending on the
frequency a uC could generate any arbitrary waveform. ;-)
Exactly. A square wave (I found "impulses" easier) can be used
along with forier analysis to do all the work of a swept sine
wave. Square/impluse stimulants are a little harder to convert
to the frequency domain though. Sine waves aren't that difficult
to generate and may make things rather simpler.

3. ### RyanGuest

When I did this stuff I preferred a quadrature oscillator using a

I didn't realize that I could just generate a sine wave to begin with
without knowing a whole slew of stuff. What does "quadrature" mean? I
see on the link that John provided, on page 7
http://www.national.com/an/AN/AN-31.pdf there is a diagram of a
quadrature generator. I have no frame of reference, so that seems as
good a starting point as anything. Perhaps I can build it. The
diagram looks daunting to me.

Question: I don't have an LM108 but I do have an MC33078P
http://www.intusoft.com/onsemipdfs/MC33078-D.PDF
will this work? Should I get out there and find an LM108? Should I
find the exact capacitors and resistors or might I improvise by finding
simliar R*C products as John has mentioned to me in the past? In doing
so, do I risk throwing off the rest of the circuit?

I'll mention that I was thinking 60hz would be a good frequency to
generate because low pitches don't grate my nerves as much as higher
frequencies. I'd like to use a computer power supply as my power
source. Either the 12v or 5v leg, whichever makes sense.

Do you mean it makes the analysis of the faulty amplifier easier?

Thank You.

4. ### Roger JohanssonGuest

The LM108 is a very old general op amp, you can replace it with any
modern op amp.
If you want a very simple to build 60Hz sine wave generator you can
use a transformer from the mains voltage, add a pot and you have a
0-6Volt sine generator (if you choose a 6Volt transformer).

5. ### Rich GriseGuest

Actually, a square wave can tell you a lot about the condition of an
amp. I'd like to see the waveforms, but don't use the email in the
"from" header - excise the adjacent letters a, r, and d to make an
a spam dump.

(BTW, I agree with everybody else on how to get a sine wave. )

Cheers!
Rich

6. ### Roger JohanssonGuest

The classical function generator does not have to reach 15 MHz, more
like 1 MHz maximum and often lower.

The typical function generator gives 3 types of waveforms, sinus,
square and triangle.

A classical function generator IC is the 2206 (XR2206) which reaches
close to 1 MHz (800kHz typically).

A soundcard is a fairly good replacement for a low standard function
generator. And a low standard audio frequency oscilloscope.

You are describing a very sophisticated high end function generator,
and it was probably very expensive when it was new.

7. ### RyanGuest

other. For your purposes, either output could do fine. There is a
In the Wein Bridge Oscillator diagram, on the left, there is a picture
of a circle with an oval inside of it. What is that? Nearby, what does
"L*" mean? Regarding the capacitors of ".01" is uF assumed unless
otherwise specified?

This would be a device with primary and secondary windings where the
input is the wall voltage and the output is determined by the number of
windings, correct?

Is this the type of thing that I could find on the shelf at a Radio
Shack? Does it look like the standard transformer case (like a tiny
overpacked suitcase) or might it be in the form of a universal plug

I presume that once I get it, the potentiometer is used to vary the
amplitude (voltage) of the output? I would just put the pot inline with
one of the output wires?

-Ryan

8. ### N. ThorntonGuest

Dear OP,

You have no need for a sine wave generator or any other generator, so
most of this thread is irrelevant to you.

I dont understand why folks havent just told you that.

Regards, NT

9. ### John PopelishGuest

Look for the asterisk below. It is a low current light bulb used as a
temperature dependent resistor that stabilizes the output voltage. as
the oscillator output gets larger, the bulb heats up, raises its
resistance, and increases the net negative feedback, which reduces
gain enough to make the amplitude quit growing. If you search the
oscillator name on Google, you will find many variations on this
oscillator that use diodes or other schemes to perform this function.
If you replace the bulb with a variable resistor, you can set it at a
point that gives slightly clipped sine wave output (using the
limitations of the output stage to determine the amplitude). This
produces more distortion in the wave, but for testing, this is not so
That is L1*, L1 being the designation for the first lamp that appears
on the schematic. The asterisk leads you to the note at the bottom.
Either. If you get one built into a plug, make sure it has an AC
output, not DC.
A more effective way is to connect the ends of the resistive element
across the transformer, and use one end and the wiper as the output.
You might also want to add a series resistor (say, 1k) to the wiper,
to limit the current into any low resistance node, and a capacitor to
keep your signal injection from disturbing any DC bias voltage at that
node.

10. ### Michael A. TerrellGuest

I was pointing out that using a sound card does not replace a
function generator. You need a low output impedance and DC coupling for
a true function generator. The coupling capacitor in the output will
change its reactance as the frequency changes and that will change the
output level. It will also cause distortion unless you drive a high

There are millions of good used function generators floating around
at low prices.

On the other hand, the H-P 3325B function generator I had on my bench
WAS expensive. It was digitally controlled from a front panel keypad, or
a IEEE-488 computer interface on the rear panel. You programmed the
frequency, waveform type, DC offset, and you could set the output level
in either voltage or dBm. It went to .001 Hz to 30 MHz on the front
panel, and had a .001 to 60 MHz output on the rear panel, less the
programmable level and DC offset.

Yes, sometimes you can work on the ultra cheap, but you need to be
aware of the limitations of the test setup before you accept bad data,
or look for problems caused by your equipment.

11. ### John PopelishGuest

Sorry, you cannot substitute an LEd for the lamp. The part is not
there to produce light, but to have a changing resistance with
current, and the LED changes its resistance in an entirely different
way than a tungsten filament lamp. I would just try some fixed
resistor values that are around 1/4 of the resistance of the feedback
Plus 12 should be connected to pin 8, -5 to pin 4. This circuit
diagram assumes that the opamp has supply voltages both more positive
and more negative than the ground connection (which has to connect
back to the common for both the +12 and -5 busses).
You just don't have it working, yet. Your opamp has different pin
numbers than the LM107 in the diagram. You have to substitute the
pins that have the same function. For now, just leave the spare opamp
unconnected.

12. ### Roger JohanssonGuest

It all depends on what level of technical standard we are talking
equipment, I talk about a lower standard, which amateurs and hobbyists
may have use for or build themselves.

Everything is relative in this field, and I try to fit into the scope
of this newsgroup, where I think the lower standard is better suited.

If you look at the projects in electronics magazines about building a
function generator, or when such generators are mentioned in amateur
radio literature, you will hardly find a function generator that goes
over 1 MHz, everything over that are signal generators, and use only
sinus wave form.

But the need for faster equipment drives the development, so these
classical definitions may have changed in later years, so I keep the
door open, as time goes we may need to move the limits upwards.

13. ### Roger JohanssonGuest

Isn't it better to use normal diodes, a string of them to replace a
lamp with a certain voltage rating.

A lamp could maybe be replaced by 2-4 diodes and a suitable resistor
in series if there is a need to limit the current.

I don't have the circuit diagram you are discussing but I think I have
seen such a lamp replaced by diodes before.
After all, the function we need is a soft clipping of the
oscillations.

If we want better symmetry we can use the same number of diodes in
anti-parallell, but that is probably not necessary as it is enough to
limit the oscillations in one direction.

14. ### John PopelishGuest

If you use diodes, instead of a lamp, you have to parallel them across
the feedback resistor, and replace the lamp with a fixed resistor.

15. ### Roger JohanssonGuest

Well, the diodes do not work "only at the peaks", diodes are
logaritmic devices and start conducting at a voltage very close to
zero, and conduct more and more the higher the voltage is over it.
Around 0.6 Volt we reach milliampere currents and that is usually the
kind of currents we count as substantial. That is the reason why we
often hear that the diode forward voltage is 0.6-0.7 Volt.

(I am explaining this to the other readers, you, John, of course know

With a good combination of diodes and serial and parallell resistance,
and source impedance, we can achieve a suitable soft damping effect.

The basic principle behind the Wien-bridge oscillator is that a small
imbalance at the start is amplified and the oscillations become bigger
and bigger.

In the Wien-bridge oscillator the oscillations are soft, rounded wave
forms, because of the time constants in the feedback circuitry, and
there is a parasitic non-linear device which starts to steal energy
from the oscillations when they get bigger, which stabilizes the
oscillations at a certain level.

This non-linear parasitic device can be a lamp or diodes, for example.

The lamp takes more time to regulate the oscillator, the diodes are
faster but distorts the waveform a little more.
A lamp regulated oscillator may have a long term stability problem, it
takes minutes to become stable and reacts to temperatures and
ventilation changes, a diode regulated oscillator gives the same wave
form for every cycle, because it regulates at every cycle.

Depending on the purpose one might prefer one or the other solution.

Please correct me if I am wrong, John, these are just my guesses and I
know you have a lot more knowledge in electronics than me.

16. ### Michael A. TerrellGuest

Does your sound card go down to 1 Hz and still have a clean signal?
The output coupling cap will be too small to have a good low frequency
response. Most of the specs I have found for sound cards stop at 10 Hz,
not 1 Hz. Just find and buy a "Test CD" made to test car amps. They
have a number of different frequencies recorded on different tracks, and
a sweep. MCM used to car it, but any place that sells and installs the
amps should have a source.

17. ### A EGuest

No, that was a joke. I don't think 1Hz is relevant to audio, quite frankly.
If it's that important, Michael, use a SPDIF digital output and plug that to your
outboard DAC suitably modified. I still say 1Hz is not relelvant to audio, and that
a computer with audio out is good enough for testing a audio amplifier.
Oh, do they go down to 1Hz?

18. ### Roger JohanssonGuest

I have been playing with a wien-bridge oscillator in Electronics
Workbench now.

It was an example circuit I think from EWB, with two zener diodes.

There was no flattening of the top of the waveform, but a kind of
leaning of each wave, like the rising flank was faster than the
falling flank.
I managed to get a much better waveform by introducing a series
resistor (the 10k below) to the zener diodes.

The waveform is now so close to a perfect sinus wave I cannot see any
faults on the oscilloscope picture. I would need a harmonic analyzer
to tweak the circuit for better purity.

I can describe the circuit:

There is an op amp, LF157, and a wien bridge consisting of 10nF and
20kOhm. The bridge is grounded at the bottom, the middle point is
connected to the + input to the op amp, the top of the bridge
connected to the output of LF157.

The output is also connected to the zener net, consisting of two 30V
at 1mA zeners, 10k in series with the zeners and 20k in parallel with
the zeners plus the series resistor.

The other end of the zener net is connected to a 50k trimpot to
ground, where the wiper is set to 40% and goes to the - input to
LF157.

The introduction of a series resistor inside the zener net makes the
influence of the zeners a lot softer, as I thought, and this makes the
waveform into a very beautiful sinus wave.
Some further tweaking might produce a high quality sinus generator.

The quality is probably rather independent from the frequency, if a
2-gang pot is used in the wien-bridge to change the frequency.

19. ### Michael A. TerrellGuest

I'm sure they get closer than a sound card.

I have seen good used function generators for less than \$20, and have
had people give me ones that have died. They are definitely not lab
grade, but would work ok to test a sound system. I owned and ran a
commercial sound business years ago and I would love to have had a
portable function generator, rather than the 65 pound H-P unit at the
shop so I could carry it a tool box, rather than strap the H-P to a hand
truck when I worked on sound systems in large churches or stadiums.

20. ### RyanGuest

I think so. you would have to connect all points that have a ground

With no load on the supply and a meter reading, I get the positive and
negative voltages I was hoping for.

After I wrote last, I took apart the project and began again. I
realized my folly of using 200 ohm resistors instead of 200K ohm.
Drat! I improvised using some pots and dialing them to within 10 points
of 200,000 ohms using my meter. (I knew the K was there, but I missed
it anyway)

So, I played around with that and still got a flat line around 7 volts.

Next, I took it all apart again and assembled it a 3rd time.

Referring back to the schematic
http://www.geocities.com/newsgrouppictures/wein.htm

Perhaps I have made some incorrect assumptions in the construction.
I've had to formal teaching on reading these diagrams. On the input
side of the op-amp, the only things feeding the + and the - is a [lamp]
resistor to the reference and a 200K ohm resistor to reference for the
other one. Does one of the inputs need to tap into a power supply
voltage somewhere? Since I don't have a lamp, I connected a 1Kohm
potentiometer in it's place and tried wiping it to its extremes. I
never saw any oscillation.

I understand that the op amp is powered by pins 4 and 8, but op-amps
compare the inputs (without drawing from them) and then do something
with that difference, right? Is the + input supposed to have a voltage
applied to it? If I follow correctly, I don't see and have not applied
any power to this circuit.

===

In the mean time, I also hooked up a 120vac to 12.5vac transformer and
with a 10Mohm potentiometer was able to reduce it's 7 volt output down
to about + and -2 volts. This feels like I'm cheating though. I think
I'll need to understand the principles of the other project for future
use.

Thank You.

-Ryan