PWM-Generator - Page 1
Forum section: electronics / beginners

author: Xenon_K
author_rank: Contributor
timestamp: March 24, 2025, 08:43:03 pm
content: Hi everyone,I'm trying to simulate a PWM generator using the SG3525A in LTspice. I'm following the common application circuit for generating a 40 kHz PWM signal (see attached image). I also found a working .lib model for SG3525A, and the simulation runs without errors. However, the outputs OUA and OUB remain stuck at 0 V, and I can't get any PWM waveform.

author: Zero999
author_rank: Super Contributor
timestamp: March 25, 2025, 11:20:39 am
content: I notice you've used your own symbol: why? Just use LTSpice's built-in symbol. It can be found in Misc DIP16. Insert it into the schematic, click on it and set the value to SG3525A.Post the .asc file, along with SG3525A.LIB, or better still, open SG3525A.LIB in a text editor, select all the text, pres ctrl+C to copy it, open the .asc file in LTSpice, click insert SPICE directive and paste it into the text box by pressing Ctrl+V. Now you only have one file.

author: daisizhou
author_rank: Super Contributor
timestamp: March 25, 2025, 12:09:54 pm
content: Why not consider using a LM358 pwm circuit?

author: Zero999
author_rank: Super Contributor
timestamp: March 25, 2025, 01:33:21 pm
content: Quote from: daisizhou on March 25, 2025, 12:09:54 pmOther than the fact the SG3525A has many other features: voltage reference, high current outputs which can drive MOSFETs and anti-phase outputs with dead time etc.The LM358 is slow, so the output rise and fall times will be long, so 10V voltage swing will take over 30µs, which is far too slow to PWM a MOSFET beyond a few hundred Hz.

author: Xenon_K
author_rank: Contributor
timestamp: March 25, 2025, 03:19:39 pm
content: Thanks, I didn’t know that the IC was already in the database. I’ve now added it using your method, but I’m still running into the same problem. I think I might have something wired incorrectly.This is my first project, so I’m still figuring a lot of things out. I’m trying to build my own buck converter from scratch – fully dimensioned in LTspice and later designed in KiCad.Does anyone have a better idea for how I could generate a PWM signal for this kind of application? I’d prefer not to use a microcontroller for it.Thanks in advance for any tips!

author: Zero999
author_rank: Super Contributor
timestamp: March 25, 2025, 11:04:11 pm
content: You forgot to post SG3525A.LIB.Was it this one?https://sourceforge.net/projects/pspice-models/files/SG3525/I downloaded it and pasted it into the .asc file.It doesn't work, but I don't know if it's the circuit which is wrong and I don't have time to investigate further at the moment.

author: daisizhou
author_rank: Super Contributor
timestamp: March 26, 2025, 12:12:20 am
content: What is your plan? Please tell me the details.

author: Zero999
author_rank: Super Contributor
timestamp: March 26, 2025, 08:37:12 am
content: I've corrected it. The oscillator connections were wrong.

author: Xenon_K
author_rank: Contributor
timestamp: April 10, 2025, 07:01:23 pm
content: Yes, it finally works now – thank you so much @Zero999!

author: MathWizard
author_rank: Super Contributor
timestamp: April 10, 2025, 11:18:44 pm
content: I recently made a boost converter, and I wanted to make it from discrete parts, so I made a 2-BJT square-wave oscillator, and a buffer, and 2 or 3 BJT gate drive for a single mosfet. And then I made a difference amplifier with a few more BJT's. Overall I could remove a few of them I guess.But you could make a basic buck converter, with a few BJT's, and/or 555-timer, and single MOSFET and diode, and inductor, and some load.Look up a 2 BJT, or even single BJT, astable multi-vibrator circuit. Then just buffering that into a buck converter mosfet, will get you started.

author: JoeyG
author_rank: Regular Contributor
timestamp: April 11, 2025, 12:28:41 am
content: Xenon_K - can you capture some waveforms and put them up here?Consider looking at the LTspice forum herehttps://groups.io/g/LTspice47,000+ members