# Variable Sawtooth Core Oscillator

#### drmanmachine

Joined Mar 12, 2016
68
Greetings,

I wanted to ask you all for your assistance with a circuit I am trying to build. Essentially, I am trying to put together a circuit that produces a sawtooth wave on the output and also allow the user to sweep the frequency from 20 Hz. to 20 kHz. I tried searching the forum for answers, but couldn't find the specifics of what I was after. I found a video online of someone who made a dual sawtooth oscillator using what I believe to be transistors?

I have also attempted to build some circuits I found online, but I'm not sure what the frequency formula would be to be able to decide the right RC combination.

I have attached the schematic of one circuit that I have found online. Any advice would be greatly appreciated. Also, I apologize if this thread doesn't belong in this section of the forum.

Thanks!

#### Attachments

• 35.3 KB Views: 73

#### wayneh

Joined Sep 9, 2010
17,155
First let's rule out a software solution. There are apps that allow you to use your smartphone as a signal generator. The frequency range you gave is obviously in the audible range and would be easy to produce with great precision.

The next question is whether you need exactly that waveform, and how accurate does it need to be. For instance it's easy to generate a triangle wave that resembles a sawtooth.

I would abandon simple discrete components and use a 555 an/or some ICs such as op-amps and/or comparators. It will make things so much easier.

#### Marley

Joined Apr 4, 2016
424
You are trying to make an oscillator with a 1000 to 1 ratio. This is not easy to do.

I don't know how much you know about electronics but the circuit you attached works by the capacitor charging from a constant-current source created around the first transistor. When capacitor voltage gets to a certain threshold (half the supply voltage + 0.6V actually), it is quickly discharged by the other two transistors.

The rate at which the capacitor charges is directly proportional to the charging current. So to get the range you need the current has to be variable over a 1000:1 range. Example 1uA to 1mA. Possible but not easy.

The constant charging current can be varied by adjusting the value of the emitter resistor on the first transistor. I would go for a smaller range, say 10:1 and have a selection of capacitors that could be changed with a selector switch.

There are many improvements that could be made to this circuit. I would start by replacing the discharging part of the circuit with a 555 timer.

#### drmanmachine

Joined Mar 12, 2016
68
First let's rule out a software solution. There are apps that allow you to use your smartphone as a signal generator. The frequency range you gave is obviously in the audible range and would be easy to produce with great precision.

The next question is whether you need exactly that waveform, and how accurate does it need to be. For instance it's easy to generate a triangle wave that resembles a sawtooth.

I would abandon simple discrete components and use a 555 an/or some ICs such as op-amps and/or comparators. It will make things so much easier.
To answer your question about whether or not I need exactly that waveform, I do. I would prefer not to start with a different waveform and then modulate it to become a sawtooth.

Can a 555 output a sawtooth? I have only encountered a 555 sending out a square wave. Also, I ordered the ICL8038. From what I read on the datasheet, the user can have precise control over the range of frequencies and can also output multiple waveforms simultaneously.

Last edited:

#### drmanmachine

Joined Mar 12, 2016
68
You are trying to make an oscillator with a 1000 to 1 ratio. This is not easy to do.

I don't know how much you know about electronics but the circuit you attached works by the capacitor charging from a constant-current source created around the first transistor. When capacitor voltage gets to a certain threshold (half the supply voltage + 0.6V actually), it is quickly discharged by the other two transistors.

The rate at which the capacitor charges is directly proportional to the charging current. So to get the range you need the current has to be variable over a 1000:1 range. Example 1uA to 1mA. Possible but not easy.

The constant charging current can be varied by adjusting the value of the emitter resistor on the first transistor. I would go for a smaller range, say 10:1 and have a selection of capacitors that could be changed with a selector switch.

There are many improvements that could be made to this circuit. I would start by replacing the discharging part of the circuit with a 555 timer.
Thanks for the advice. I understand the behavior of the transistors and charging/discharging capacitor. I think my issue was being able to know which components do I adjust so that I can vary the frequency?

I wanted to have precise control over adjusting the sawtooth frequency between 20 Hz. and 20 kHz..

When you say you would replace the discharging part of the circuit with a 555 timer, what do you mean exactly?

Last edited:

#### wayneh

Joined Sep 9, 2010
17,155
Can a 555 output a sawtooth? I have only encountered a 555 sending out a square wave.
Not directly, no. The usual output of a 555 is a pulse train. You might call it a square wave but it's not always a 50% duty cycle so not always truly square. You can also use the near-triangle wave of the voltage on the timing capacitor. It's ramps up and down are not linear but RC timing curves. It's good enough for many applications.

I think to get a genuine linear ramp up you'll need an op-amp integrator. Something like this, maybe.

#### drmanmachine

Joined Mar 12, 2016
68
Not directly, no. The usual output of a 555 is a pulse train. You might call it a square wave but it's not always a 50% duty cycle so not always truly square. You can also use the near-triangle wave of the voltage on the timing capacitor. It's ramps up and down are not linear but RC timing curves. It's good enough for many applications.

I think to get a genuine linear ramp up you'll need an op-amp integrator. Something like this, maybe.
Thanks Wayneh. I looked at that circuit previously. I'd really prefer to have a sawtooth output instead of putting the 555 output through an integrator. This may seem generalized, but I attached a basic block diagram of what I am trying to accomplish.

#### Attachments

• 55 KB Views: 35

#### drmanmachine

Joined Mar 12, 2016
68
Here is a video of someone who created a dual sawtooth oscillator. I wish I had more information about what he/she did to accomplish this, but I am not sure. Maybe someone can tell?

#### wayneh

Joined Sep 9, 2010
17,155
I'd really prefer to have a sawtooth output instead of putting the 555 output through an integrator.
How are those two things different?

#### drmanmachine

Joined Mar 12, 2016
68
How are those two things different?
To my knowledge, no difference. By taking this approach, will I have any issues when it comes to varying the frequency?

#### wayneh

Joined Sep 9, 2010
17,155
To my knowledge, no difference. By taking this approach, will I have any issues when it comes to varying the frequency?
That will take some calculations because, as noted, getting 1000-fold range requires design effort.

The circuit in that video is probably a transistor sweep generator such as described here. Or maybe a Miller sweep generator. (see slide 6)

#### drmanmachine

Joined Mar 12, 2016
68
That will take some calculations because, as noted, getting 1000-fold range requires design effort.

The circuit in that video is probably a transistor sweep generator such as described here. Or maybe a Miller sweep generator. (see slide 6)
What would the formulas look like?

For the 555, I was using this formula:
0.693*(R1+R2)*C1 = t1
0.693*(R2)*C1 = t2
Tt = t1+t2
f = 1/Tt

If I get the frequency range of 20 Hz to 20 kHz on the output of the 555, when that signal reaches the integrator, will that frequency change?

#### wayneh

Joined Sep 9, 2010
17,155
If I get the frequency range of 20 Hz to 20 kHz on the output of the 555, when that signal reaches the integrator, will that frequency change?
No, the frequency is set by the 555. But I'm not familiar with the details of the integrator circuit, and whether it can function over such a wide range of frequency. There is some information in the link I gave.

#### drmanmachine

Joined Mar 12, 2016
68
No, the frequency is set by the 555. But I'm not familiar with the details of the integrator circuit, and whether it can function over such a wide range of frequency. There is some information in the link I gave.
Thanks. I'll take a closer look. I just wasn't sure if the frequency set by the 555 would be altered by the integrator circuit.

#### wayneh

Joined Sep 9, 2010
17,155
Thanks. I'll take a closer look. I just wasn't sure if the frequency set by the 555 would be altered by the integrator circuit.
No, but the integrator may have trouble maintaining the wave shape. A steep rise or drop and 20Hz may look like a gentle slope at 20kHz.

Do take a look at that Miller sweep oscillator. It could very well be what is in the video.

#### drmanmachine

Joined Mar 12, 2016
68
No, but the integrator may have trouble maintaining the wave shape. A steep rise or drop and 20Hz may look like a gentle slope at 20kHz.
Thanks Wayneh. I appreciate your assistance on this. I will post again later after I experiment a bit on the breadboard based on the advice you've given.

One more question before I go, the miller sweep oscillator has a Vin. I'm thinking that it needs a signal coming into it. Would the 555 be the way to go?

#### wayneh

Joined Sep 9, 2010
17,155
I must plead ignorance on that, but it seems reasonable. That wouldn't explain the video. Maybe a bit more research is warranted.

#### drmanmachine

Joined Mar 12, 2016
68
Thanks Wayneh. I was able to make a little bit more progress with your help. If I run into anymore trouble, if you don't mind, would it be okay if I reached out?

#### crutschow

Joined Mar 14, 2008
28,177
Here's the LTspice simulation of an LM339/393 bootstrapped sawtooth generator.

The LM339/393 is configured as an astable multivibrator.
Q1 is an emitter follower that drives the bootstrap capacitor C2 which provides a constant voltage across R2 and U2 to generate a linear charging of C1.
Q1 is a PNP since, as an emitter follower, they have a higher output slew rate for negative going signals, occurring here during the fast sawtooth fall.

The frequency is adjusted a little over a 10:1 range with the 100k pot U2, so to cover the full 20Hz to 20kHz range you need to switch capacitor C1 between 15nF, 150nF, and 1500nF.

The simulation below of the highest frequency range superimposes two simulations for pot settings of 0% and 100%.

#### Attachments

• 2.5 KB Views: 18

#### drmanmachine

Joined Mar 12, 2016
68
Here's the LTspice simulation of an LM339/393 bootstrapped sawtooth generator.

The frequency is adjusted a little over a 10:1 range with the 100k pot U2, so to cover the full 20Hz to 20kHz range you need to switch capacitor C1 between 15nF, 150nF, and 1500nF.

The simulation below of the highest frequency range superimposes two simulations for pot settings of 0% and 100%.

View attachment 120442
Thank you for the thorough explanation and content to go with it. Just a question though. You mentioned that I would need to switch the C1 capacitor between 15nF and 1500nF to get the 20 - 20k range. Could I have a fixed capacitance and a variable resistor to accomplish the same thing?