Black-box design to create sawtooth waveform

• Engineering
Mentor
Ok so I set up the sources with the following frequencies, and got this:
6283
12566
18849
25132

View attachment 271863
Remember that you have to scale each resistor divide ratio to match the FS coefficients...

Also, when I use a simple Excel spreadsheet to plot the FS function you are given, it's closer to an inverse sawtooth instead of a sawtooth waveform. And of course it doesn't include the offset and scaling yet to give you the 0-5V sawtooth waveform that you are asked to produce with your circuit:

When I use the FS from Wikipeda for a forward sawtooth waveform (including the offset and scaling for the Amplitude = 5V), it looks a lot closer once the initial startup phase is done...

Is there some way to verify with the instructor or TA whether that is the right FS that they want you to use in the problem statement?

Attachments

• 1604080764096.png
7.3 KB · Views: 72
Mentor
The problem statement doesn't specify any particular value for ##\omega##, so I think you're free to choose anything you like. For example you could make the base frequency equal to 1000 Hertz and not worry about the associated angular frequency. That will make setting up your simulation easier. Frequencies for the voltage sources can then just be: 1000, 2000, 3000, 4000 (Hertz)

Edit: Looking again at the problem statement I see by the waveform diagram that they want a 1 ms period for the sawtooth. A 1000 Hz base frequency will at least get you close, and you can always fine tune the base frequency once you've sorted out the circuit design.

The problem statement didn't say that the given Fourier sequence was for a sawtooth of the exact form desired. It might well be an inverted version of the desired waveform and centered about zero volts. An inverting op-amp configuration might be a real benefit here

Using Mathcad to perform the summation:

Negating the function and adding a suitable offset value to "pull up" the minimum:

Still have the function maximum value to deal with since we want the peak to be around 5 V, but that's just fiddling with the stage gain.

Last edited:
berkeman
peasngravy
Yeah I think i will email him about that actually!

peasngravy
My brain is pretty fried by now, so thank you for your patience. I am getting there slowly but surely, I think

How do I relate my gain to the frequencies though?

Sorry for all the stupid questions - again, this is all very new to me, I think I'm too old to learn new stuff

Mentor
How do I relate my gain to the frequencies though?
You don't! For this circuit, without reactive components, the gain will be independent of the signal frequency.

This will hold true for ideal components (which you are simulating here), but in the real world you'd want to remain within a given op-amp's operating bandwidth. Outside of the "flat" region gain will roll off and phase shift with frequency will need to be considered. Such topics are likely outside of the scope of your current course. Maybe next term

peasngravy
Fortunately for me there won't be another term! This course is just something I did for my own benefit. I started it a couple of years ago when i was made redundant and thought I should do something to fill the time. Got another job pretty quickly though so its been much slower progress than I hoped

So regarding the gain - do I just want to divide the 4 inputs so that each one gives 1.25v?

Mentor
It might well be an inverted version of the desired waveform and centered about zero volts. An inverting op-amp configuration might be a real benefit here
Hah! That would be pretty smart to use the FS for the inverted Sawtooth, in order to save one opamp stage in the final circuit. I need to remember that trick...

Mentor
So regarding the gain - do I just want to divide the 4 inputs so that each one gives 1.25v?
You can adjust the gain overall by simply altering the feedback resistor, no?

Mentor
Hah! That would be pretty smart to use the FS for the inverted Sawtooth, in order to save one opamp stage in the final circuit. I need to remember that trick...
More than that, it also avoids dealing with the negative and positive terms separately!

berkeman
peasngravy
Do you think my circuit looks correct then, other than adjusting the feedback resistor?

I have now gone for the 1k, 2k, 3k and 4k frequencies like you said

Obviously I still need to add the offset and deal with the inverted output but i can do that once i get the correct waveform (which currently looks like this:)

Mentor
Do you think my circuit looks correct then, other than adjusting the feedback resistor?
You still need to adjust the series resistors for each of the AC Sources to get the FS coefficients. That is one reason you don't have a near-sawtooth waveform yet...

peasngravy
I have messed around with those but I am at a loss at what to try now. Should they be something like 10k, 20k, 30k and 40k?

Mentor
I have messed around with those but I am at a loss at what to try now. Should they be something like 10k, 20k, 30k and 40k?
Yeah, something like that...

peasngravy
peasngravy
Yeah, something like that...

I tried this circuit on different software and it's almost exactly what I'm after!

I was using simetrix - when I build the exact same circuit on circuitlab online, I get a completely different waveform

peasngravy
Thank you so much for your patience today and for staying with me - I have no idea why that software shows the waveform differently but at least I am there now.

berkeman