How to create a PWM voltage source with consecutively longer on times?

I use a voltage (pulse) source to simulate a PWM signal from a microcontroller. Say I have a period of 100μs, how can I create a PWM signal with a duty cycle that starts at 1% (1μs), then next period goes to 2% (2μs), then 3%, and so on until I’m at 100%?

You are looking increasing duty by “m%” in each “n” cycles?
I guess you need to write a C++ code block.

If just a continuously increasing duty, it can be done with a ramp source compares to a sawtooth.

I mean generating a signal that looks like this:

I don’t care what happens after I reach 100% duty, this setup is only to test the limits (low and high duty cycle) of what the circuit can switch and won’t be part of the final design.

It sounds like your second idea would work, but I’m not very familiar with spice simulation in general. Could you give me an example of how this setup would look like?

I created a custom symbol to simplify the work. Of course, you can build it with native components. I believe this type of circuit is available in many SPICE tutorials on YouTube or websites. Here is an example of using the custom symbol on my GitHub.

Basic-PWM.qsch (3.9 KB)

1 Like