A DIY Square Wave Signal Generator with Pulse Width Modulation
This circuit is very simple and has a fantastic range of potential uses. The two potentiometers (variable resistors) allow the frequency and pulse width to be varied independently and without affecting each other like in the super simple signal generator.
By incorporating a rotary switch, the value of the timing capacitor (C1) can be adjusted. This allows the frequency to be adjusted over the full range that the 555 timer can support.
A separate chip (LM393) is used to control the pulse width so that it will not effect the frequency. The LM393 is a 'Low Power Low Offset Voltage Dual Comparator' The pot (VR2) is used as part of a voltage divider so that the voltage on the inverting input of the comparator can be smoothly varied. This voltage determines the pulse width of the final output signal.
Like this circuit? Check out our range of Pulse width modulation circuits.

| IC1 | LM555 |
| IC2 | LM393 |
| R1 | 10k |
| R2 | 10k |
| R3 | 2.2k |
| R4 | 10k |
| VR1 | 1M |
| VR2 | 10k |
| C1 | 47nF |
| C2 | 4.7nF |
| C3 | 470pF |
| C4 | 47pF |
| SW1 | 4 Pole Rotary |
Since the pulse width is relative to the input voltage on the this input, it is possible to use the circuit in conjunction with a multitude of robotic interface boards. This signal can be used to drive a H-Bridge or power transistor which is ideal for varying the speed of a DC motor. We have some circuits based on this idea on the Cyber Circuits page. We also have a simple DIY version of this device here
Potential Uses Might Include:
DC Motor Speed Control Control
Boosting or Variable Dimming for LED's and Light Bulbs
Transformer or Ignition Coil Driver
This circuit was used in the Power Pulse Generator project as part of the Ignition Coil Driver



The information provided here can not be guaranteed as accurate or correct. Always check with an alternate source before following any suggestions made here.
This one wokred first time and provides exactly the frequency and duty cycle vairiability I needed for my motor speed controler.
Thanks
You can download the datasheet for the LM393 here.
I think what Timothy wanted was the connection details. Same as you did for the LM555..
See Example.
EXAMPLE ONLY.. CHECK FOR THE CORRECT CONECTION..
If it is not used the output signal will be too flat.
You cant drive a large speaker with this circuit, but adding a transistor like in the Pulse controller will work.
With the 47nF cap The low frequency end is 30Hz, You'll need capacitors in the uF range to get really low frequencies.
The circuit will even oscilate without a capacitor if there is enough parasitic capacitance elsewhere. I measured 222kHz, but the signal was quite small and not square.
It depends which pins you use on your pots for the direction.
VR2 can be set to 0 resistance at either end of its turns, but ot will always be 10k between 2 of its terminals. It's wired as a potential divider. If you turn it so that there is 0 resistance between R4 and the inverting input, pulse width will be maximum.
The scope will be the reliable reading, I guess your DMM isn't meant to be used for frequency in this way.
You could also try the Tesla Coil Tuner circuit. This goes up to around 450kHz.
thank you
First off, great website. Second, im in the process of building this now, and i just put in LEDs between the dial and each capacitor. Will this have any negative effect on my circuit? Its really just for aesthetics, so when you turn the dial, the LED assigned to that certain capacitor lights up.
Many thanks!!!
P.S. Love the site!
LM339 should work ok.
lol! That's a pretty interesting result. Part of the circuit must be coincidentally tuned to match the broadcast frequency of those Spanish people!
Get back with me at: 65t@commcast.net
Thanks, Tom
To make it switch a different voltage you would disconnect the load from V+, connect V+ to the input of your regulator, then connect the output of your regulator to the loads +ve termial.
How can I use a 555 noise maker kit from Maplin to drive an IRF740. The reason is to isolate the 555 circuit from the coil switching mosfet (and as a kit it's easy to build!).
I admit I am struggling with some fundamentals here but I assume the gate has to be grounded after it is pulsed in order to shut off the IRF740. How could this be done? I guess thats what the LM393 does but can I do it without?
Many thanks
Yes there needs to be a path to ground from the gate pin because it is effectively a capacitor and it needs to discharge to switch off the MOSFET. The 393 will do this to a limited extent, but it is common to just place a resistor between the gate and GND to drain off any remaining charge on the gate.
Look at the ignition coil driver page for a circuit to drive coils.
If I try 100K R2, R4, and VR2 the effect is even worse. Any advice? The input saw tooth from 555 is clean. I zoomed in to limit file size. Thanks in advance.
Ward
Is your circuit somehow different such as a series capacitor on the 193's input?
Circuit is same except R3 is 2K Vs 2.2K. It is on bread-board right now so I can play with it. I will try different components and report back if no ideas. Thanks.
Ward
If so would reversing the polarity on the battery cause the output to be pulsating positive current?(positive offset)?
Thanks
bravo!
However a problem: In tuning the circuit I have found out that the frequency is not constant but is is varying, especially at low freq, i.e. at 20 Hz up to 10%. Already output freq. from 555 in not constant. All measured with DDM.
Any clue what's happening?
1.Another thing, for adjusting min and max level of duty cycle on needs to adjust 10K resistors on 393 input... a little inconvenient. I have connected upper end of 10K variable resistor to the pin 5 (threshold), which properly selects upper voltage level (about 2/3 Ucc) of comparator or min. duty cycle. Max. duty cycle (min voltage level aout 1/3 Ucc) still manually adjusted.
Any comment on that?
2. I found LOG variable resistors for freq. more linearly adjustable, especially for high freq.
If it will fry it, which components would need to be replaced to make it work with 12v? Likewise, which could be replaced to allow it to operate up to 20 or 30 amps?
Thanks!
If you want to switch large currents you need to use a large transistor on its output like in this circuit
I can only assume you mad a mistake in your wiring or that you have a faulty component.
Ed Lipton,
You can connect this direct to a 13.5V supply. The voltage limit is simply determined by the ratings of the two IC's. You can Google for the datasheet to get the max voltage of each.
a couple of questions though, i need the output signal to be 5vdc,or ttl level, if i power the circuit with 5vdc as vcc will i need to change any of the resistor values? if so what are the changes?
thank you in advance, cary
thank you again for the reply and a GREAT site, cary
can you use a tlc555 IC instead of 555
If so what component changes are needed
thank you
also which type pot(VR1) would give a more gradual adjustment for the frequency, audio or linear taper?
thank you for a great site and great circuits! packrat
47nF - 14Hz to 2.5kHz
10nF - 71Hz to 10kHz
1nF - 710Hz to 87kHz
470pF - 1.5kHz to 170kHz (after this point the pulse shape is significantly rounded)
100pF - 6kHz to 263kHz
47pF - 10kHz to 870kHz
Logarithmic pot is best for frequency
is ther a way to make the frequency vary over a smaller amount? maybe change the value for VR1?
thank you again for your help. packrat
e.g. Use a 1M pot, set the frequency to 40kHz then remove the pot and measure its resistance. Do the same at 2kHz. The first value you get would be the value for a resistor that you would place in series with a pot rated for the second value you got.
thank you for giving me the information i have been looking for!!!!!
packrat
thank you again for all your help and patience.
i'm confuse for the IC2 part..where to connect it to another part? where is the pin number for the IC2 ? unlike the IC1 part
on IC2[LM393] what is the meaning of + - sign ?
the IC2 part is LM393 which have 8 pins..
very thank's for anyhelp
I've built this circuit and it works as you stipulate. I observed that the higher I bring the frequency, rounder is the attack of the square wave output. Is there a way we can keep the full squareness of the wave at all frequencies? I've got to drive a 200 A mosfet.
Thanks, great site!
This is due to capacitance in the components. This is especially apparent when driving a MOSFET becasue the gate pin is basically a capacitor.
To overcome this you need to drive the gate at a higher voltage using a transformer or a special MOSFET driver chip.
Shannon,
That is beyond the scope of this article. You would need to use a microcontroler for the frequency counter.
Generator,
That is for adjusting the frequency output.
Thanks
i would like to have a circuit that has one output at 10% duty cycle and the other at 75% duty cycle, but switching at the same time.
using the 555 to feed both sides of the lm393 would be the easy way to do this. but will it work?
thank you for all your help!! packrat
thank you for a really GREAT site and all the help you give us electronics newbies.
again thank you, packrat
Also...do you sell these already assembled?
Thanks!!
We sell such circuits, our PWM-OCX range.
Any type will work. Larger capacitance will cause a lower frequency.
That voltage should be fine. You can also use the output for driving several injector drivers together.