# Triangular Wave Guidance

Discussion in 'The Projects Forum' started by blah2222, Aug 9, 2011.

1. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Hello all,

For my current project that I am working on, I am in need of a ramping triangular wave voltage signal. This signal is to be pretty symmetrical, sweep between +/- 2 V at a frequency around 0.01 Hz - 1 Hz, very slow.

Ideally, I would like to use a single coin cell battery to power this signal. Is there a simple way to split say a 5 V battery into two +/- 2.5 V supplies?

Here is the standard circuit that I am using to build the wave:

I understand that the frequency can be found as:

$f = \frac{1}{4R_{t}C}(\frac{R_{2}}{R_{1}})$

Not sure, but is:

$Vamp_{+} = (\frac{R_{1}}{R_{2}})V_{ss}$

$Vamp_{-} = (\frac{R_{1}}{R_{2}})V_{ee}$

I ran some tests and found that when I used ceramic disk capacitors they held by the equation above, but when I used tantalum, their apparent capacitance was around 10 times greater than their marked value.

So I guess my main questions are:

1. For the peak voltages (+/- 2 V) that are desired, what value of supply should I be thinking of using?

2. Once I obtain said supply, how can I split it into Vss and Vee?

Thanks,
JP

Last edited: Aug 9, 2011
2. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
UPDATE

Still haven't worked on the battery problem, but still need help with that.

Created a ~500 mHz (465mHz) triangle wave with Vp-p = 3.96 V and offset of -200 mV:

C = 1 uF
Rt = 1 Mohm
R1 = 2 Mohm
R2 = 1 Mohm

I am powering this with a dual supply (+/- 5 V) using two LF411CN op-amps. Is there any way to get rid of the offset?

Using a single LF412CN op-amp, I got a frequency of 458 mHz, Vp-p = 3.84 V, and offset of ~250 mV.

Last edited: Aug 9, 2011
3. ### Wendy Moderator

Mar 24, 2008
21,012
2,744
A simple resistor divider with a voltage following op amp will work. It creates a virtual ground. That or use two watch cells for a ± power supply.

Does the waveform have to be linear? Will a sawtooth work (it is a close approximation of a triangle wave)?

4. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Thank you for the reply! Just curious, how will I get a negative voltage from the resistor divider, wont it just be halfway between GND and VCC?

I have also looked into sawtooth waves, but my signal really has to be symmetric. I am building a system to perform and measure cyclic ramping voltage responses on electrochemical cells and the rise and fall times of the signal have to be more or less equal or else time begins to skew my results, as these trigger oxidation or reduction reactions depending on their direction.

I am pretty pleased with my results of using just this single op-amp network so I think I'm going to stick with this for the triangular waveform.

I am just hoping that someone can clarify how to interpret my peak values. When centered about GND, my waveform hits +2 and -2.

My supplies are +5 V and -5 V. This means that my peak voltages are a factor of 0.4 of the supply voltages. Where is this 0.4 coming from?

Thanks again!
JP

5. ### Wendy Moderator

Mar 24, 2008
21,012
2,744
Ground can be considered an arbitrary point. The unity op amp drops the impedance of the two resistors to a very low value, you treat that as ground.

This is actually a common problem with electronics. Here is an article I wrote about it...

Creating a Virtual Power Supply Ground

A LM324 can go down to 3VDC for the power supply, there are other op amps that can go even lower.

6. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Beauty, I'll have a look!

Sorry, I thought that I did. A Sawtooth wave would be good for half of what I need. I need the voltage signal to ramp up then immediately go back down with the same sweet rate. A sawtooth doesn't have the latter functionality.

Awesome, I only had LF412's on me.

The thing that still bugs me is:

My supplies are +5 V and -5 V. This means that my peak voltages are a factor of 0.4 of the supply voltages. Where is this 0.4 coming from?

7. ### Wendy Moderator

Mar 24, 2008
21,012
2,744
I'm not sure what you mean by 0.4 of the supply voltages. Do you mean they aren't reaching the power supply voltage, or that the peak to peak voltage is only 0.4V?

Op amps as a rule can only get within a volt or so of the power supply voltage. If you have ±5V you will be lucky to get a waveform that is 8V p-p.

This is a sawtooth...

It is a waveform produced by a 555. A CMOS 555 can go down to 2VDC on the power supply.

Basically there are many ways to do what you are wanting. If linearity is an issue an op amp will work, but you can even use a 555 as the Schmitt Trigger portion, and it will produce a very predictable 1/3 p-p voltage of the power supply.

This shows how to produce a very linear version of what you are thinking of as a sawtooth...

I've put a different version into My Cookbook.

8. ### SgtWookie Expert

Jul 17, 2007
22,194
1,764
An LM324 can sense near the negative rail, but can't go to the positive rail.

Working with voltages & power as low as you are, you really have to have an RRIO (rail-to-rail inputs and outputs) opamp that has very low current requirements.

9. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Yeah I understand what a sawtooth is, but I can't use a sawtooth for my purposes. By a factor of 0.4 of the power supply voltages, I mean.

I have Vss = +5 V and Vee = -5 V and Vp+ = 0.4*5 = 2 V and Vp- = 0.4*(-5) = -2 V

Last edited: Aug 9, 2011
10. ### Wendy Moderator

Mar 24, 2008
21,012
2,744
So you want a ±2V (or 4V p-p) triangle wave. You are going to need at least 6V, but if you use two 3V batteries you can have the ground (with a minimum of components) you want. 4V p-p means you will need more than one 3V watch battery. For a 555 to do this you will need 12V (remember the 1/3 of Vcc requirement?).

To design something like this (555 or no) you will need to precisely define the power supply source (TBA) and the wave form requirement (which you have done).

Mar 24, 2008
21,012
2,744
12. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Thanks again for the timely post! Great, I think I will be using two coin cell batteries like you mentioned to establish the supplies. A lot of sites refer to the relation of Vss and Vp+ (as well as Vee and Vp-) as proportional to (R1/R2).

In my case, R1 = 1 MΩ and R2 = 2 MΩ; Therefore R1/R2 = 0.5

Any idea on how to ensure the peaks are held at +/- 2 V?

Thank you!
JP

13. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Whoa, I haven't seen this version. I guess I have been looking at an older version that did not post supply minimums, thanks! SgtWookie recommended the LM324 for its low supply requirement (3 V min) so that might be able to be a good replacement.

14. ### Wendy Moderator

Mar 24, 2008
21,012
2,744
The peaks are a direct function of the Schmitt Trigger threshold voltages. This is one of the reasons I like the 555 so much, it is extremely predictable. Making a Schmitt Trigger with an op amp is easy, and the threshold values can be calculated, but part of the math is determined by the output voltage of the op amp, which is not predictable (but can be measured easily enough). The fact almost all op amps do not go rail to rail is where the problem lies.

15. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Ah, I see what you're saying now. Well, I found a couple good sites to describe what is going on, so I'll try to interpret them in that sense.

Another thing that I don't understand is, why does one op-amp act as a Schmitt Trigger while the other one is simply a somewhat ideal op-amp?

They both use feedback, why are the capacitor's terminals ideal, (both roughly equal voltage: GND), while the resistive feedback acts as a Schmitt Trigger? I guess what I'm trying to ask is: When do you know that an op-amp is operating as either a Schmitt Trigger or "ideal" op-amp?

16. ### Wendy Moderator

Mar 24, 2008
21,012
2,744
The other is acting as an integrator, a calculas function. The intigration of a square wave is a triangle wave. This is more of an analog computer function.

As to when is which, a Schmitt Trigger has positive feedback (amplifiers have negitive). A integrator has a capacitor on the feedback loop. Basically these are what I call cook book functions, the schematic for the funtion almost never changes.

Wikipedia's articles aren't up to snuff, but they are there.

http://en.wikipedia.org/wiki/Integrator

http://en.wikipedia.org/wiki/Schmitt_trigger

17. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Okay so after reading through countless wiki-pages and other articles online, I still am having trouble deciphering between inverting/non-inverting amplifiers and a Schmitt Trigger.

Literally the only difference between a Schmitt Trigger and it's inverting/non-inverting counterpart is which terminal each input is connected to:

Inverting Amplifier

Schmitt Trigger - 1

---------------------------------------------------------------

Non-Inverting Amplifier

Schmitt Trigger - 2

---------------------------------------------------------------

I still can't see why the normal ideal op-amp conditions work for the amplifier configurations, but not for the Schmitt Trigger configurations. Come to think of it, if I saw a circuit using a Schmitt Trigger configuration back in first year EE, I would have slapped the ideal conditions onto it and just solved the circuit as if it were an amplifier, completely disregarding the terminal signs, which now I know is wrong, but I still don't understand why.

I just don't understand how they both have the same feedback resistors, yet their terminal configurations make them either positive or negative feedback.

Last edited: Aug 16, 2011
18. ### Wendy Moderator

Mar 24, 2008
21,012
2,744
The main thing to remember about a Schmitt Trigger is that positive feedback. It feeds upon itself. Once it starts to switch it runs away until it is locked firmly into the other state.

I don't have time right now, but I'll try to show how the voltages work (and indirectly, how to design for specific parameters). If you can use two 6V battery packs I'll show you how to turn your op amp and a 555 into what you are wanting, with a 4V p-p triangle wave.

19. ### blah2222 Thread Starter Well-Known Member

May 3, 2010
574
36
Okay, so after thinking about it for a bit longer, here's what I came up with for differentiating between an amplifier and a Schmitt Trigger.

If we take a look at the Inverting Amplifier:

Say initially Vout is at the negative supply, if we think about it, Vin can't be more negative than the negative supply, (or else the op-amp is useless), so the direction of current flow can be determined, therefore the voltage division can be determined as:

$V_{-} = (V_{in} - V_{out})(\frac{Rf}{Rf + Rin})$

With this equation, V- can never be less than zero, thus, Vout will remain negative and not change. For this reason, the amplifier will be stable and not oscillate. The same works if Vout was initially held at the positive supply voltage.

In the case of the Schmitt Trigger, the output voltage doesn't not stay stable and it will oscillate.

This more or less makes sense to me, but I'm still not sure where the ideal op-amp equations come into play with this, but it's a start.

20. ### Wendy Moderator

Mar 24, 2008
21,012
2,744
I'm going to bed.

Take a look at the voltages on the output and one the two inputs for a Schmitt Trigger. Since it operates in a digital mode it isn't very complex, and after you write them down on an actual schematic it becomes obvious.

Another hint, the set points are from what is basically a voltage divider.