A critical component of robotics, motor control, and many other applications. We provide you with a simple PWM circuit, as well as versatile expansion options.
The 555 timer IC is an essential tool in the resource kit of any hobbyist, and indeed, of many designers and engineers. It is versatile, stable, cheap, and has a reasonable operating voltage range. As such, it is presented here as an astable multivibrator with a Pulse Width Modulated (PWM) output. It is intended that this output could be used to control the speed of a motor, or the brightness of a light; it could even control a heater element. This circuit will power a load that only requires very low current, less than 200mA, such as an LED. Following this article, there is a page titled "Step it up" that will provide you with two circuits to increase the load capacity.
The 555 can be run in either ‘monostable’ or ‘astable’ modes. In monostable, the device takes its trigger from an external source, performs a timer operation, and then resets to await further input. In astable mode, the circuit around the IC provides the trigger, so that the device continually performs its timer operation. This circuit is designed to do this around 100 times per second (100Hz). The ratio of 'on' time to 'off' time is referred to as the ‘duty cycle’, often expressed as a percentage of 'on' time to the whole cycle time. For a duty cycle of 90%, the output is on, or ‘high’ for 90% of the cycle, and off or ‘low’ for 10%. At a frequency of 100Hz, the full cycle takes around 0.01 seconds, with an on time of 0.009 seconds and an off time of 0.001 seconds.
Integrated circuits (ICs) are often drawn as a rectangle with each pin function labelled, and if you're lucky the pin numbers as well. Bread-boarding a circuit also requires the correct pins to be connected. Therefore, a pin-out of any IC you will be using is important to have when experimenting with electronics. Our circuit diagram on the next page shows the pinout in correct order. From the top left, moving anticlockwise, pin 1 is the ground pin, pin 2 is the trigger, pin 3 is the output, pin 4 is the reset, pin 5 the control voltage, pin 6 the threshold, pin 7 the discharge and pin 8 is the supply voltage. A more detailed description of each pin and what it does will be provided in future articles. For now, a working, versatile circuit is the aim - we'll cover some topics in greater depth another time.
BUILDING THE CIRCUIT
Building this circuit in its simplest form is quite straight forward. You only need a 555 timer, a few diodes (a DIYODE helps too), a potentiometer, as well as a few resistors and capacitors. We have illustrated a very simple breadboard-based diagram that you can follow to build your own, or view our additional step-by-step instructions online.
|1 x 555 Timer IC||ZL-3555||Z2755|
|2 x 1N4148 Diodes||ZR-1100||Z0101|
|3 x 100nF Capacitors||RG-5125||R2736B|
|1 x 100kΩ Potentiometer||RP-7518||R2207|
|1 x 120Ω Resistor||RR-0550||R7035|
|1 x 1kΩ Resistor||RR-0572||R7046|
The circuit here is set up to run from 12V. The 555 will work from 5 to 15 volts, and you can run this circuit from a 9V battery (your LED will not be as bright). When the circuit is first powered up, the output from pin 3 is high. Current flows from the output via a 120Ω resistor to whatever device you are driving. It also flows via one of the diodes, part of the variable resistor, a 1kΩ resistor, and arrives at the trigger pin. The trigger is linked to the threshold pin, and to a 100nF capacitor tied to ground. As this capacitor charges via the variable resistor/resistor network from the output, the voltage at pin 6 (threshold) rises. When it reaches 2/3 the supply voltage (8V in this case), the internal flip flop switches the output to ‘low’. Now the 100nF capacitor discharges through the 1kΩ resistor, the other half of the variable resistor and the other diode, until it reaches 1/3 supply voltage (4V). Now the internal flip flop connected to the threshold pin switches the ouput back to ‘high’, and the process repeats.
The relationship between the portion of the variable resistor involved in the charge current path and the portion in the discharge path, are what control the duty cycle of the output. The 1kΩ resistor gives a minimum value. If the potentiometer (the name for a variable resistor connected with all three pins as a voltage divider) is set to 0Ω, the charging current path is only the 1kΩ resistor, while the discharge path has the 1kΩ of the resistor plus 100kΩ from the potentiometer. This gives the longest ‘off’ time, or the lowest duty cycle. As the potentiometer is turned up, this ratio changes, and the duty cycle with it. A maximum of 95% and a minimum of 5% is possible with this circuit. Providing your circuit is working properly, you should be able to rotate the potentiometer and your LED will brighten and dim.
As presented, the circuit has no substantial output device. The 555 can source or sink (supply or pass to ground) around 200mA, which is enough to drive some loads such as an LED; however, most loads will require an output circuit. With the prevalence of modules designed for microcontroller interface, motor or light controllers accepting a PWM signal are easy to access. Most work with an independent load supply, eliminating contamination of the IC power supply with voltage spikes. Alternatively, an NPN transistor or N-channel MOSFET can be used for driving higher current loads which are described on the next page. These are very basic and additional components would assist filtering, back-emf protection, or isolation, however this is beyond the scope of this article.
Step it up: TRANSISTOR
This circuit steps-up the very limited output of the basic circuit, to drive something more substantial in the same way. PWM outputs are a great way to dim a group of lights, such as in a control panel or dashboard. We use a single TIP31 NPN transistor, which can provide up to 3A of current.
The transistor acts as a solid-state switch, amplifying the current available to the load. When the transistor receives a pulse from the PWM circuit, it allows current to flow through, allowing the load to draw power from the main supply. When the pulse stops, the current flow is also stopped. This high speed switching is imperceptable to humans, and we simply view it as a change in overall brightness in a light.
|ADDITIONAL Parts List:||Jaycar||Altronics|
|1 x TIP31 NPN Transistor||ZT-2285||Z1134|
|1 x 12V Dimmable Load (such as 12V Light Globe)||SL-2675||S4047|
Step it up: MOSFET
Here we’re using a Metal Oxide Semiconductor Field Effect Transistor, also known as a MOSFET. They're similar to transistors in some ways (mainly how they behave in a circuit), however they use an entirely different electrical principle to provide their function. The circuit is only marginally more complex than the transistor-based circuit. Using a 1N4004 diode and an IRF540N N-Channel MOSFET, and a single 10kΩ resistor between the gate and ground. Indeed, you can apply this motor and diode to the previous circuit up to 3A.
MOSFETs are particularly useful at driving high currents. I wouldn’t suggest driving the full 33A the MOSFET is rated for (there are more considerations when driving loads that high, including not melting the breadboard), but this gives you a simple motor speed controller.
|ADDITIONAL Parts List:||Jaycar||Altronics|
|1 x IRF540N 33A N-Channel MOSFET||ZT-2466||Z1537|
|1 x 1N4004 Diode||ZR-1004||Z0109|
|1 x 10kΩ Resistor||RR-0596||R7782|
|1 x 12VDC Motor||YM-2716||J0026|