Very often when designing some stuff I need a square wave signal generator with variable pulse width and frequency to control power MOSFETS.
You can use such a tool when designing DC-DC converter or switch-mode power supply, you can use it to emulate PWM from microcontroller when developing some new embedded design, or maybe you want to design your own wireless charger… This is only some of the things you can use it for.
So, I’ve decided to build very simple PWM generator.
Here is my PWM Generator design criteria, that can be changed in process, but that’s pretty much what I want for now:
- 100Hz to 500kHz Variable Frequency
- 5% to 85% Variable Duty Cycle
- Should Have Independent Frequency And Duty-Cycle Adjustment
- 1V to 10V Variable Signal Amplitude (maybe even higher, like 15V)
- 50 Ohm and Low Impedance (LOW-Z) Selectable Outputs
- Two Outputs For Push-Pull or Single-Ended Operation
- Output Stage Buffers Should Be Able To Source And Sink 500mA Or Higher Current Continuously
- Output Stage Buffers Should Be Able To Drive Inductive Load (Output Protection)
- Should Be Built From Jelly-Bean Components
So, now when I’ve got list of features that I want to implement – it’s time to look for some sort of IC that can generate sawtooth (usually PWM is made from sawtooth signal and comparator) or PWM signals. And I should not forget that this should be jelly-bean part.
First that comes to mind is to use specialized PWM controller. Of course I can use op-amps to generate ramp and then use other op-amp or comparator to convert it to PWM signal, but that’s more complicated than using specialized controller.
Another choice is to use MAX038 – signal generator IC. But it’s not a jelly-bean part and on top of that it was discontinued and I couldn’t find any viable replacement. It’s not a jelly-bean part anyways.
So PWM controllers for the win!
Probably two the most popular pwm controllers is TL494 and SG3525A(KA3525A). They cost less than $1 manufactured in big quantities by different companies and everyone uses them. This is definitely fits under “jelly-bean” part!
They both can operate from 100Hz to 500kHz frequencies. Both have two outputs, error amplifiers, and other stuff.
SG3525A has totem-pole type outputs, meaning that it can source AND sink current, unlike TL494 that has single transistor outputs that can only do one thing at a time.
But with TL494 it is much easier to switch between push-pull and single-ended modes of operation. It has separate pin to control that.
So, in the end I’ve decided to use TL494.
Inside it has pretty much everything that you would need for PWM controller. It has oscillator, that can give you 100Hz to little bit more than 500kHz and which is controlled by resistor and capacitor values.
Bandgap 5V voltage reference. Internal logic, error amplifiers, PWM comparator and output transistors, which can source or sink up to 500mA each. And all this is for less that $1!
Pretty cool, isn’t it?
Now when I know what chip I will use, I can draw preliminary sketch of future device.
It would consist of signal PWM signal generator (TL494), totem-pole output buffers (meaning, they can source and sink current), power supply specifically for those output buffers and output resistors with switch for changing output impedance.
You would be able to adjust signal frequency, duty-cycle, amplitude and output impedance. Plus select mode of operation between push-pull and single-ended (switch not shown on the diagram).
Using TL494 you can adjust duty-cycle from pretty much 1% to almost 90% (more likely 85%).
It’s time to dust-off my breadboard and make first prototype of PWM generator.
(by the way it’s not a high-frequency design, so it is OK to use a breadboard)
On the left is TL494 and on the right is very simplistic two-stage totem-pole amplifier which drives 100 Ohm load.
And here’s how it looks on the scope:
Channel two is connected to output of second stage of the amplifier(which drives 100 Ohm resistor).
I can change frequency (duty-cycle stays the same):
And I can adjust duty-cycle from less than 1%:
To 85% (frequency is not affected by changing duty-cycle):
Also amplitude can be from lower than 500mV to any voltage that output transistors can handle:
(amplitude can be lower than shown on this screenshot).
That’s it for today. Stay tuned for updates!
Comments are welcome!