Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

A triangle-wave generator using discretes

Status
Not open for further replies.

carbonzit

Active Member
Hi, all: I'm back after a long hiatus. Good to see the place is still around.
Current project (at least in the pencil-and-paper stage): building a working triangle-wave generator using only "discretes" (i.e., no ICs).
Disclaimer: this project is strictly for my own amusement, not for commercial or other "serious" use, so accuracy, etc., is not an issue at this point.
So here's what I've got so far: I'm using a multivibrator (my favorite simple oscillator) to drive two things, a gated current source and a gated current sink. The current source's load is a capacitor, used as an integrator to create a (hopefully) linear positive-going ramp. The sink is used to discharge the cap. Here's the circuit:
Triangle wave gen 2 (LTspice).gif

and here's the LTspice plot from running the simulation:
Triangle wave output 2.gif
So, not too bad for the 2nd pass, but there are problems:
  • The upward slope of the wave is pretty damn good, better than I expected from such a simple implementation. You can see the current waveform (purple trace) slopes down a little bit, but not too shabby, which leads me to believe that the up-slope of the triangle wave is fairly linear. The down-slope, however ... pretty much sucks. Has the typical exponential shape of a discharging cap, not a nice straight line.
  • Much smaller problem, but the triangle wave never goes below about 3.5V. It would be nice to have it reference 0V, so probly needs to be level-shifted.
Remember, one of the rules of my game here is no ICs. I would also like to keep this as simple as possible. So why is my downward slope so crappy? I suspect it may be because there's just too little current through it (<1mA) to properly control it. These were actually the best results I got with this simulation by playing around with resistor values. You can clearly see the problem in the plot of current-sink current (red trace). Paradoxically, the larger I made the resistors, the worse the results (steeper downslope).
Clearly I'm missing something here in my understanding of how all this stuff works, and would appreciate guidance here.
I like the multivibrator: a nice simple, fairly reliable source of square waves (conveniently of both polarities); the duty cycle appears to be 50%. The current source seems fairly elegant and seems to work well. But that discharge circuit: ugh.
Is there a simpler/more elegant way to do this? I'm open to suggestions.
BTW, my further motives for this circuit are to use it in such applications as fading LEDs, PWM control, maybe even a "poor man's" class D amplifier. (Yes, I know that wave would have to be pretty damn linear to reduce distortion!)
So I look forward to your ideas. The main thing here is to increase my understanding of electronics.
 

Attachments

  • Triangle-wave generator 2.asc
    3.7 KB · Views: 583
Below is your circuit modified to improve the fall linearity. I just connected the discharge current-mirror the same way you had the charge current-mirror connected and made the current determining resistors to have identical values.
Is that about what you wanted?
 

Attachments

  • Triangle-wave generator 3.asc
    3.4 KB · Views: 581
You mean I was that close???

Dang, I was expecting about 10-15 back-and-forth posts before getting anywhere. I'm almost disappointed ...

But seriously, that seems to be exactly what I was looking for. Triangle wave looks just about perfect.

Still can't help wondering, though: is there a more elegant way to do this? Was thinking of a single current-source/sink that could somehow be used for both charging and discharging, maybe with steering diodes or some such? And I was hoping for something a bit simpler, maybe 5-6 transistors if possible.

Anyhow, thanks! And just for my own boneheadedness' sake, let me confirm what you did there: by connecting the discharge-gating transistor to V+, there's plenty of power to run the current sink. And while the current sink is actually providing current (through Q8), it works to discharge the capacitor by providing a low-impedance path to ground, except that this low-impedance path maintains constant current. Have I got that right?

(Yes, I'm aware that this is really "sorta-constant current", due to Early effect, temperature, Vbe fluctuations, etc., etc., but plenty good enough for now.)
 
.....................................
Still can't help wondering, though: is there a more elegant way to do this? Was thinking of a single current-source/sink that could somehow be used for both charging and discharging, maybe with steering diodes or some such? And I was hoping for something a bit simpler, maybe 5-6 transistors if possible.
I can't think of any simple way to get the same current mirror to both charge and discharge the capacitor, but that doesn't mean there isn't. ;)
And just for my own boneheadedness' sake, let me confirm what you did there: by connecting the discharge-gating transistor to V+, there's plenty of power to run the current sink. And while the current sink is actually providing current (through Q8), it works to discharge the capacitor by providing a low-impedance path to ground, except that this low-impedance path maintains constant current. Have I got that right?
.........................
Not quite. A current source actually has a high-impedance (in this case the collector impedance) so that the current is independent of the load voltage (that's why it charges/discharges the capacitor in a linear fashion even though its voltage is constantly changing).
 
I was hoping for something a bit simpler
Something based on this perhaps?. It would, though, be somewhat temperature dependent because of Vbe change.
DualConstCurrent.gif
 

Attachments

  • DualConstCurrent.asc
    1.9 KB · Views: 206
Also temperature dependent, but there is an optimal point where the tempco is small. That's approximately when the voltage across R1 (R2) is .7 volts below the JFET pinch-off voltage.
 

Attachments

  • Untitled picture.png
    Untitled picture.png
    50.8 KB · Views: 415
Hola carbonzit

Not a solution / answer to your question but there is an IC (asked Dr. Alois but couldn't recall which one) where there were two current sources, one sourcing Ic and the other sinking in turn, 2*Ic.

The block diagram looked simple. IIRC, the first run continuously.
 
Last edited:
Wow; I love it when circuits come out of the woodwork like this! Thanks, Alec and ccurtis for those. I "built" both of them (in LTspice) to see how they work.

First yours, Alec:

Triangle wave gen 4 (LTspice).gif

Triangle wave output 4.gif

That's a pretty good-looking triangle wave, with just an itty-bitty glitch at the corners. Not bad at all for only 4 jelly-bean transistors.

So it looks like a push-pull amplifier; in fact, I think that's what it is, with the integrating capacitor as load: is that right? And how do we get constant current out of it? In any case, very clever.

Now for ccurtis' contribution:

Triangle wave gen 5 (LTspice).gif

Triangle wave output 5.gif

This one is even more interesting because of its simplicity; I have to admit I really have no idea how this works.

Unfortunately, I couldn't get a good waveform out of it (see attached plot), even after playing around with component values (mainly the cap). The other problem is that it won't stand any output loading; the smallest load I could get away with was 1 megohm. Still, an intriguing circuit. (Maybe it could be tweaked for better performance.)

By the way, you may notice that my multivibrator has changed. I took the new version from a circuit from **broken link removed** (see Fig. 18 at the bottom of the page). This oscillator has waveform-correcting diodes and it's what they call "sure-start". I was having a lot of trouble with my simpler MV circuit in LTspice; sometimes it just wouldn't start. It's worth the few extra resistors and diodes. (Apparently they didn't have this problem in the old days with germanium transistors, but higher-gain silicons sometimes won't budge from the starting line.)
 

Attachments

  • Triangle-wave generator 4.asc
    4.1 KB · Views: 195
  • Triangle-wave generator 5.asc
    4 KB · Views: 200
Last edited:
By the way, Carl, I ran your mod and found it to be the best so far:

Triangle wave gen 3a (LTspice).gif

Triangle wave output 3a.gif

This was running at 27 KHz.

(I really need to get a 'scope ...)
 

Attachments

  • Triangle-wave generator 3a.asc
    4.7 KB · Views: 200
Hey, I think Alec's version might be good enough for a simple function generator (square & triangle, anyhow). Add a rotary switch and a bunch of Rs & Cs for freq. selection.) Whaddya think?
 
Carbonzit, the Jfet circuit needs tweaking for the higher frequency. Use 2n3819 for the jfets. 1K for R1 and R2. 47nF for the cap. Also, reduce R11 to 500 ohms. And, yes, loading of the cap on any of the circuits will impact the quality of the triangle, to one degree or another, as the load will steal some of the current from the cap.
 
Last edited:
My bad, shoulda tested them with a load. Looks like mine (Carl's mod, post #9 above) is the best, as it'll tolerate a load of 5K with not too much waveform degradation. Alas, the simple one (Alec's) will only handle 10 meg (yours is a little better at 5 meg).

Guess they'd need a stage or two of amplification to be useful.
 
................................
By the way, you may notice that my multivibrator has changed. I took the new version from a circuit from **broken link removed** (see Fig. 18 at the bottom of the page). This oscillator has waveform-correcting diodes and it's what they call "sure-start". I was having a lot of trouble with my simpler MV circuit in LTspice; sometimes it just wouldn't start. It's worth the few extra resistors and diodes. (Apparently they didn't have this problem in the old days with germanium transistors, but higher-gain silicons sometimes won't budge from the starting line.)
Sometimes oscillators don't start in a simulator because the parts are exactly matched and there is no intrinsic noise to get things started. One solution is to use either the "Skip Initial operating point solution" (uic) or "Start external DC supply voltage at 0V" in the "Simulation Command" Transient window which usually helps to get the oscillation started.
 
Carbonzit:
I congratulate you for your interest in discrete electronic circuits.

There was the time when that was all that designers had to implement complex circuits.

And if you think transistor circuits require a lot of thought, imagine what it was like with vacuum tubes!!!
The lack of complementary devices added a significant design challenge.
 
...............................
And if you think transistor circuits require a lot of thought, imagine what it was like with vacuum tubes!!!
.............................
Not to mention the excitement of probing/troubleshooting a circuit with a couple hundred volts (or more) floating around.
 
Hola carbonzit

In post #7, not acknowledged by you, I mentioned recalling a triangle signal generator based on 2 current sources. One sourcing Ic (continuously) and the other sinking 2Ic half of the time.

Insomnia is not good but helped me many times to solve problems of my work or, as in this case, to recall where I have seen it referenced.

I simulated it and seems good enough to deserve some tweaking.

El generador de Agustín.png
 

Attachments

  • Triangle wave generator Agustín 01.asc
    2.3 KB · Views: 241
I posted this complete circuit on the other website. Its output level is as high as is possible:
 

Attachments

  • triangle wave gen.png
    triangle wave gen.png
    44.1 KB · Views: 454
@atferrari: I didn't acknowledge it because I wasn't sure what it was you were proposing, plus you mentioned "IC"s. But now that you've presented this, yes, it is interesting. I hooked it up to my all-purpose multivibrator and ran it:

Triangle wave generator Agustin 2.gif


Notice I had to rejigger things since you're using a negative-going pulse, so I just "moved ground around". It works pretty well:


Triangle wave output Agustin 1.gif


but notice how long it takes for the waveform to settle:


Triangle wave output Agustin 2.gif


Oh, well, I guess 1 second isn't too long to wait for a high-quality instrument to come ready! I'm guessing this is on account of the weird power-supply scheme (mixing single- and double-ended supplies)?


So to summarize how this works: the current source is always pushing a current C, but on alternate half-cycles the current sink pulls 2C, which brings it down to zero and then to V-; is that correct? Kinda kewl, as it only requires one gate instead of two.
 

Attachments

  • Triangle wave generator Agustín 2.asc
    4.4 KB · Views: 187
One thing I don't like is how glitchy the square-wave input is to the gate:

Triangle wave output Agustin 3.gif


But the good news is that adding a load (remember: note to self: always model a load!) quickly stabilizes the output. Plus the current source can easily drive a 5k load (it'll go down to 1K, albeit with some distortion).

I did change R8 to 1K and R5 to 22K to try to isolate the current sink from the oscillator, which helped somewhat. Actually, that spike on the rising edge doesn't seem to make much difference anyhow.
 

Attachments

  • Triangle wave generator Agustín 3.asc
    4.5 KB · Views: 190
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top