Relaxation oscillator - Page 1
Forum section: electronics / beginners

author: Dan Moos
author_rank: Frequent Contributor
timestamp: November 16, 2016, 03:58:35 am
content: I realized I've gone a long way in electronics without ever really experimenting with oscillators. Decided to remedy that.Anyway, I built a relaxation oscillator with a 741 opamp. I have far better parts, but it was the one I grabbed.Anyway, it works, but drifts back and forth. I built it to run at 2 kHz, which I figured was a nice place to not push any envelopes.Any way, it's not horribly unstable, but does drift back and forth randomly. I'd say it jumps around in 50us bursts, with the direction being pretty random.Since I built the circuit to further my education, my question is: what causes this? My circuit is pretty much the single supply example in AOE 3d edition page 426. (Figure 7.1 b)

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 16, 2016, 06:51:44 am
content: I don't have the book in front of me at the moment, but 741 is NOT a single-supply part. That may be a contributor...Tim

author: tron9000
author_rank: Frequent Contributor
timestamp: November 16, 2016, 09:11:49 am
content: well that says to me the learning process has begun!someone said to me once: "people who design amplifiers accidentally build the perfect oscillator and vice versa!"I'd use a split rail supply like Tim said if your not. There are loads of typical circuits of this circuit showing dual rail supplies

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 16, 2016, 09:35:27 am
content: Looked at the book... should be biased correctly.Did you use the +5V shown in the drawing? 'Cuz 741 barely works at 5V, so that would be a similar problem.Try it at 10V or more, it should behave itself.Tim

author: Audioguru
author_rank: Super Contributor
timestamp: November 16, 2016, 06:12:06 pm
content: The 741 was introduced 48 or 49 years ago (!) and its datasheet shows its spec's withonlya +15V and -15V supply.There are many newer opamps available that are spec'd with supply voltages as low as a single +3V supply.

author: Dan Moos
author_rank: Frequent Contributor
timestamp: November 17, 2016, 12:39:32 am
content: Thanks. To be clear, I'm not so much trying to "fix" the circuit. Mostly trying to figure out the mechanism by which the drift is occurring for educational purposes.Some here mentioned that the 741 is not happy with a five volt single supply. How specifically might that effect things? First thing that comes to mind is that the various constant current sources in the thing are not quite able to function correctly.Another thought, unrelated to the opamp, is that the ceramic caps I used might be causing weird jitter. Voltage wise, the square wave looks great. It just drifts back and forth in the time domain.I'll try a more suitable opamp, just to see if that's it.

author: xygor
author_rank: Regular Contributor
timestamp: November 17, 2016, 02:05:06 am
content: Bang on the capacitors and see what happens.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 17, 2016, 02:07:59 am
content: The 741 only works if its input voltages are a couple volts away from +V or -V/GND. So with a 5V supply, you only get about 1V of useful range.Likewise, the output can't pull much closer than a volt or so near each supply.The design amplitude for that circuit (i.e., the thresholds where it switches) are in that no-go range, meaning it might not even work at all -- the output being unable to swing past that threshold, it just sits idle...Probably, the inconsistency you see is due to poor performance in this region -- maybe the output does eventually rise or fall past the threshold, but it takes a while; or the inputs do poorly defined things as well.The waveform on the capacitor is the telling thing: it's not a bent triangle, but has lots of sloppy flat time, am I right?Running at a higher voltage, so that the thresholds are more than a few volts away from each supply, and so the op-amp behaves more normally in and of itself (yup, because of internal bias and stuff), will do the trick.There's also LM358, which doesn't work near +V, but does work near -V. (Which, by the way, is marginally better than '741, but that's not to say it's an actually good amp by any stretch.) You'd see the rising "triangle" edge severely deformed, but the falling edge would look fine. Or a TLV2372 (or any other RRIO amp, such as the ones the text recommends) which will work as advertised.Tim

author: Dan Moos
author_rank: Frequent Contributor
timestamp: November 18, 2016, 12:50:51 am
content: Update: I tried a 5532 (a very good audio quality opamp), and at first had the same issue. Then I started looking into my scope's horizontal settings, randomly hit the reset for the delayed sweep function, and BAM stable display. Don't remember turning that on, but there you go.One thing though. The 741 gave me a 7 kHz wave with the same RC values that give a 11 kHz wave on the 5532. Also, raising the voltage on the 5532 to 10 volts gave me a 17k signal.Why is the time constant opamp, and voltage dependant?I have no load on the output currently, but plan to experiment accordingly when I get a chance.

author: RandallMcRee
author_rank: Frequent Contributor
timestamp: November 18, 2016, 01:30:01 am
content: Well you seem to be trying to get things to fail and then asking the eevblog why.You might consult the book from which you grabbed the circuit.It shows comparators, not opamps.You might want to read up on the differences between the two. AoE mentions that opamps will work but gives significant caveats. Your clue is in there.But AoE is assuming that you are using opamps that are fit-for-purpose and both the ones you mention won't work in that AoE circuit reliably. Ok, if you use +-15 volts the 5534 should work but not even as well as the LM6152 mentioned in AoE.Using a 741 or 5532 try making a wein bridge or other sine-wave oscillator.

author: Dan Moos
author_rank: Frequent Contributor
timestamp: November 18, 2016, 01:48:29 am
content: Let me clarify my aim here. I'm NOT trying to make a quality relaxation oscillator. I built one out of what I had because it's a citrcuit Ive never messed with before.I'm not trying to debug it to "get it working right". I just want to understand the specific mechanisms at play here. I have a stable waveform with a roughly 700 ns rise and fall time. So the circuit works. What I don't understand is why the opamp has anything to do with the RC time constant. AoE doesn't clear that detail up for me, or if its in there, I'm just not making the connection. I know exactly the mechanism by which the oscillator works on a broad scale. Its the details that I'm trying to learn. "Get a proper opamp/compariter" would fix my circuit I imagine, but I will have learned nothing.Again, I have no problems with having an imperfect circuit. I just want to learn specifically what mechanisms are causing the imperfections, so that I'm not just assembling stuff I don't fully understand.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: November 18, 2016, 02:16:34 am
content: Quote from: Dan Moos on November 18, 2016, 01:48:29 amPlease post your _exact_ circuit, along with details of the power supply and the probe points and scope details and settings you are using. Some of us (like me!) may not have access to AoE, nor can we guess at what changes in component values or connections you may have made!Are you building your circuit on a solderless breadboard? Can you post a photo? Does the circuit change its performance in any way when you move your hands around near the circuit?

author: Dan Moos
author_rank: Frequent Contributor
timestamp: November 18, 2016, 05:30:12 am
content: Ok,Solderless breadoardNothing happens when I touch components.Lab power supply set to five volts. Floating.circuit is as follows:5532 opamp. 5 volts at + power pin, ground at negative power pin.non invert input biased to 2.5 volts via divider using 2 20k resisters between Vcc and ground, the mid point at the non invert input.positive feedback via a 10k resistor from non invert input to output of opamp.10pF ceramic "speed up" cap also from non invert input to output. I understand its function, but its presence doesn't change anything. I specifically noted that my rise/fall times are the same with/without this cap.47k resistor from invert input to output.1 nF ceramic cap from invert input to ground.Other than my use of an opamp rather than a comparitor this is exactly as shown in the text.Probing at the output of the opamp with Rigol 1052e, normal aquisition, reading frequency off the onscreen counter. No idea if this is a harware counter, or software. The counter from the measurement menu is close but not the same. I suspect that one is done in software, whereas the other is a true hardware counter. They are within 2 tenths of a hertz of each other.The book, and my math say it should be around a 10k square wave. At five volts I have about a 12k square wave. wave is clean and stable. abut 680 nS rise and fall time.What I am curious about is that if I raise the supply voltage, the frequency also rises. 10 volts gets me 17kHz. 20 volts gets me 20kHz. 30 volts gets me 21k. Much below 5V, and the wave starts to fall apart. I understand the low voltage problem. Its the climb in frequency with supply voltage that I'm curious about. What other factor besides RC time constant set by the 47k resistor and the 1 nF cap is at play here?Again. This is only for my own education. I'm just wondering what mechanism is at play here.

author: Zero999
author_rank: Super Contributor
timestamp: November 18, 2016, 04:45:53 pm
content: The frequency is lower with the 741 than the 5532 because the 741 is a much slower op-amp. The 741 contributes to the delay on the RC circuit both in the time it takes for the output to start responding to the change in the input voltages and how long it physically takes for the output to change from low to high, i.e. the slew rate. If you look at the output of the 741, you'll probably find it looks more like a triangle wave than a square wave.As far as the frequency increasing with voltage is concerned. The op-amps you're using do not have a rail to rail output. The output will not fully saturate either supply rail and it will be asymmetric, meaning the hysteresis and voltage applies across the RC circuit will vary with the supply voltage, hence the change in frequency.

author: Dan Moos
author_rank: Frequent Contributor
timestamp: November 19, 2016, 01:00:03 am
content: Ok, that makes sense.I have messed a lot with audio power amps, which are basically opamps with large current capabilities. Now I kinda want to do a discrete opamp and try and make it have the properties that this oscillator requires! I know how to design a discrete opamp. Making it fast and rail to rail, plus high freq would be challenging/fun.

author: alsetalokin4017
author_rank: Super Contributor
timestamp: November 19, 2016, 01:14:40 am
content: The oscillator circuit as described in the post above works fine with 1/2 of the TL082 dual op amp, and the frequency is stable with supply voltage change, as long as the supply voltage is over about 7 volts.