Black-box design to create sawtooth waveform
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
49 replies · 5K views
Physics news on Phys.org
peasngravy
- 72
- 6
berkeman said:Yes, the diagram shows a peak amplitude of 5V and you said the bade frequency is 1kHz. You increase the frequencies of each AC Source as shown in the FS. Can you paste a screenshot of your AC Source definition for the first one?
(i spent far longer than I should have trying to post this reply by hitting OK on the screenshot
peasngravy
- 72
- 6
Remember that you have to scale each resistor divide ratio to match the FS coefficients...peasngravy said:Ok so I set up the sources with the following frequencies, and got this:
6283
12566
18849
25132
View attachment 271863
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
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.
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:
peasngravy
- 72
- 6
Yeah I think i will email him about that actually!
peasngravy
- 72
- 6
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
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
You don't! For this circuit, without reactive components, the gain will be independent of the signal frequency.peasngravy said:How do I relate my gain to the frequencies though?
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
- 72
- 6
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?
So regarding the gain - do I just want to divide the 4 inputs so that each one gives 1.25v?
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...gneill said: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
peasngravy
- 72
- 6
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:)

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:)

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 said:Do you think my circuit looks correct then, other than adjusting the feedback resistor?
peasngravy
- 72
- 6
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?
peasngravy
- 72
- 6
berkeman said: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
- 72
- 6
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.
Similar threads
- Callum Plunkett
- · Replies 44 ·
- Engineering and Comp Sci Homework Help
- Replies
- 44
- rforrevenge
- · Replies 2 ·
- Engineering and Comp Sci Homework Help
- Replies
- 2
- phsyics_197
- · Replies 1 ·
- Electrical Engineering
- Replies
- 1
- Jdo300
- · Replies 4 ·
- Electrical Engineering
- Replies
- 4
- vig
- · Replies 7 ·
- Electromagnetism
- Replies
- 7
- Brian Moughtin
- · Replies 2 ·
- Introductory Physics Homework Help
- Replies
- 2