Sometimes you don’t need ultra-precise PWM control. If it’s just a simple knob-to-control power that you need, then this is the project for you.
BUILD TIME: 20 minutes
DIFFICULTY RATING: beginner
There are so many benefits of PWM over things like voltage adjustment, for all sorts of applications from power tools to motor speed control, to dashboard lights in your car. We really wanted this simple controller to provide reliable PWM outputs for 12V systems, up to a maximum current of 5A.
THE BROAD OVERVIEW
We described basic PWM controller circuit in our very first issue, as part of our Fundamentals series. If you want a very detailed introduction to this PWM circuit, it would be a great primer to understand the inner workings behind this circuit. But it’s not really a prerequisite if you just want to build one.
When we first described this circuit, it had an educational purpose. While we created two “step it up” options, and provided breadboard adaptions so you could play around with the circuits, it’s proven to be one of the most popular articles in DIYODE Magazine, so we thought we’d convert it into a compact PCB to help you put it into the real world quickly and easy, with a reliable and robust build.
HOW IT WORKS
If you want to read more about how the 555 actually does this, it’s worth reading the Fundamentals column in Issue #1, as we won’t cover it in the same depth here. Effectively, we have integrated a high power MOSFET to step up our 555 timer’s PWM output to provide 5A worth of PWM control. The 555 itself can dim an LED or two, but that’s not a whole lot of power for most practical applications.
As a summary of this circuit though, we’re using the 555 timer to create a 12V pulse. The potentiometer allows us to change that pulse from a very low duty cycle (about 1%) to a very high duty cycle (about 99%). The peak voltage is still at 12V, so motors still have full torque regardless of the duty cycle output, although their speed will vary accordingly.
It is possible of course, to vary voltage in other ways, such as an adjustable voltage divider. However there are several downfalls of a setup like this. For example, you often have to dissipate a lot more heat since the current has to go somewhere, and motors won’t have full torque available at lower voltages the same way they will with PWM.
The PCB is a double-sided design. There isn’t actually a whole lot going on the second layer, but it helps keep the board layout compact - it measures just 61mm x 36mm, so it’s pretty tiny.
The second side only has a few tracks, but it keeps the overal layout far cleaner than would be possible on a single-sided board. You may notice that with our prototype, we have components on both sides of the PCB. This is because our prototype was routed on our Bantam Tools Mini Desktop PCB Mill. As a result, there’s no through-hole plating, solder masking, and other features you’ll find in a commercial board. Occasionally this requires some workarounds to keep things from shorting other tracks, or to make connection with the right layer.
For a production PCB (especially if you buy this as a kit from one of our favourite electronics retailers), you can mount everything in the normal way. In this case, it would be components on the top, soldering everything to the bottom layer. So please take note that our photos will look a little different. While it looks rather funky having components on both sides, it’s just to work within the limitations of our mill-based prototyping.
We have taken consideration with the layout to keep things compact, while keeping in mind that 5A of current (60W at 12V) needs to have some beefy tracks to not burn out too. Therefore the power in, and PWM outputs are kept close together, with thick high current tracks running between them, and through the fuse. This provides the most copper (without getting silly) to the higher current areas.
We have left room for a TO-220 compatible heatsink, which is an essential addition if you’re expecting more than about 1A from the circuit. The MOSFETs can actually often handle much more than 5A, which is the limit we’ve set here - however more current requires more copper, and therefore a much bigger PCB too. 5A is often going to be plenty for most applications that can utilise simple PWM such as this, without requiring more complex features such as a soft-start.
Most of our tracks for this PCB are actually on the top-side of the PCB too. This could easily be reflected to change to the bottom layer if you’re making your own PCB. For a solder-masked/ through-hole plated PCB (as is now effectively the standard) however, it makes little difference.
If you are indeed making your own PCBs, whether by milling or etching, you'll probably already be aware of the extra care required when working with these boards. Commercial PCBs are VERY rugged by comparison, and can often take a little more before you run into problems. However the speed of prototype and the ability to 1-off a PCB is worth the additional care during construction in many cases.
|1 x 555 Timer IC||ZL3555||Z2755|
|1 x IRF540 MOSFET||ZT2466||Z1537|
|1 x Red LED||ZD0100||Z0700|
|2 x 1N4004 Diodes||ZR1004||Z0109|
|2 x 1N4148 Diodes||ZR1100||Z0101|
|3 x 100nF Ceramic Capacitor||RC5360||R2865|
|1 x 120Ω Resistor||RR0550||R7536|
|1 x 220Ω Resistor||RR0556||R7542|
|1 x 1kΩ Resistor||RR0572||R7558|
|1 x 10k Resistor||RR0596||R7582|
|1 x 100k Linear Potentiometer||RP7518||R2246|
|2 x PCB Mount Screw Terminals||HM3172||P2032B|
|1 x TO220 Heatsink||HH8516||H0640|
|1 x 5A M205 Fuse||SF2178||S5729|
|1 x M205 Fuse Clips||SZ2018||S5983|
|1 x DIYODE Custom PCB||-||-|
Check your PCB for broken tracks, corrosion, or other manufacturing defects. Give it a good clean with some isopropyl alcohol or circuit board cleaner, to help remove any grease or residue that may exist, which will help reduce the incidence of dry joints and other problems. Use the lowest temperature possible for the solder you’re using, to help avoid overheating the IC and other components. It also helps to avoid overheating the tracks on the PCB, which can quickly be damaged by excessive heat.
As with all PCB builds, we follow a hardware, passives, semiconductors type construction pattern. That means you should install the terminal blocks and fuse holders first (you can install the fuse also, or do it at the end). Then move to the resistors and capacitors, as well as the potentiometer. Then insert the four diodes, LED, and the MOSFET, taking care with orientation of these components (marked accordingly on the overlay).
Lastly you can install the 555 timer. Take care with orientation - it should be marked on your overlay, but the notch points into the board, not outward. If you’re not entirely confident in your soldering skills, use an IC socket as an added safety measure. These can take more heat without damage, and you can test your solder joins before inserting the IC. The 555 timer is a fairly robust chip, but as with all ICs, static precautions should be taken as static can quickly kill an IC. Use a grounding strap, or at the very least touch your hands on an earthed item like a metal computer case, a soldering station case (not the hot part of a soldering iron!), or something else you know has a good earth!
If you’re using a heatsink you can install this after testing, to save removing it if something requires adjustment on the PCB.
A NOTE ABOUT DIODES: If you’re using this circuit for a large inductive load like a motor, add a 1N4004 or similar diode across the motor terminals. This prevents voltage spikes back into the circuit which are created during the PWM cycle, as the magnetic field in the motor collapses when the current is switched off. We have a 1N4004 (D4) installed on the PCB across the PWM outputs, but these are most effective when across the motor terminals. Do yourself a favour and install both for good measure - your components will thank you.
THE 3D PRINTED CASE
The case design is very simple. It effectively just provides some stand-offs and cut-outs for the potentiometer and terminal blocks. This PCB would easily fit into a standard off-the-shelf jiffy box, but with the 3D printed version the cut-outs are already done for you.
Because of the rectangular cutout for the screw terminals, it’s best to print with supports to get a good top line. Most printers won’t struggle with the circle for the potentiometer, but a horizontal cutout is rarely successful without supports.
There are two case files provided in the digital resources. One for a standard desktop case for general use, and another for with bulkhead mounts to make fastening it to something else a whole lot easier.
Visually inspect your PCB and all mounted components carefully. Look for solder that’s bridging things it shouldn’t, any solder joints that don’t look perfect, or any other foreign matter such as component legs and things that can create shorts.
Apply 12V power (take care to ensure the correct polarity) to the circuit and you should see the LED illuminate. This LED runs directly from the 555 timer’s output, so will vary in brightness based on the PWM output. If your LED doesn’t illuminate, there are two possibilities. Either your PWM output is very low (i.e., your potentiometer can be adjusted and it illuminates), or you have a problem with your circuit.
Adjust your potentiometer through it’s range, and you should see the LED illuminate. If you don’t, immediately disconnect power. Check the fuse is installed and not blown. Check the orientation of your 555 timer, and all diodes. Confirm the MOSFET pinout matches the PCB if you’re not using an IRF540N also, as these can vary from model to model.
If you have access to an oscilloscope, probe the output to look at the duty cycle. Adjust the potentiometer with a full sweep from fully anticlockwise to full clockwise. You should see a clean variation in the PWM output from 1% to 99% duty cycle (approximately). If you see any strange variations as you sweep through the potentiometer’s range, you could have a faulty potentiometer, or another problem in your circuit such as a bad solder join.
If everything seems well, connect a dimmable 12V load (such as a 12V LED strip), or a 12V motor to the output terminals (taking care to ensure the correct polarity). You should be able to now adjust your light’s brightness or motor speed with the turn of the potentiometer. AWESOME!
WHERE TO FROM HERE?
It might seem simple, but this is a powerful project. PWM, whether from a microcontroller or a simple 555-timer based circuit like this, has massive potential. With so many 12V lighting sources, it can be used in caravans, cars or boats with dashboard lighting, or homes with 12V dimmable lighting too.
This is about as far as we’ll take this simple circuit. In future we’ll use a similar principle with a microcontroller, for a programmable soft-starting PWM controller, useful for large motors and pumps.
It’s also important to note that the MOSFET we’re using is actually rated at 33A, not 5A. The main reason we have limited this circuit to 5A is to keep the PCB size down (33A would quickly burn out the PCB tracks), since this is a good current limit for many applications anyway. The circuit as it stands, fitted to an appropriately scaled PCB, could just as easily run to the limits of the MOSFET. However motors and other loads which require such high current would often have a requirement for soft-start or high inrush current if using PWM control, so it’s unlikely to perform as well on such high loads.
As it stands, CHOPPY is a great PWM controller. Enjoy!