The Classroom

Pulse Width Modulation

More Than You Might Think

Daniel Koch

Issue 49, August 2021

We take a deeper look at Pulse Width Modulation, including some points to consider in some situations and when designing a controller.

Pulse Width Modulation (PWM) is something almost any maker has come across. It is used in everything from motor speed control to LED light dimming, to battery charging on middle-of-the-range solar controllers (Maximum Power Point Tracking, the premium charging method, is another concept for another time). However, while PWM can be very simple and a controller made with a basic NE555 circuit, there is far more to PWM than many people realise.

This article started out as a side-read from research on a possible future article involving motors. We stumbled across a forum discussing the use of ‘Pulsed’ controllers on model railways, and whether they damage modern model train motors. While we quickly concluded PWM is not the only ‘Pulsed’ controller method around in model railways (some people use it to describe unfiltered Direct Current (DC), and others for a very crude speed control that isn’t regulated or consistent enough to be called PWM), the discussion still made us realise that there are a lot of factors regarding PWM and its use that we often don’t think about. In some situations, they’re very important

Accordingly, we’ll take a look at "what" PWM is, and how it can be generated. We’ll look at the different parameters including the ones that may not always be considered important, and look at how these affect different loads. In particular, we’ll examine how these factors can affect the operation of, and even damage, some DC motors. We’ll wrap up with an experiment to measure some of the effects of different PWM parameters on small DC motors before proposing some solutions. If you’ve ever needed to speed control a motor or brightness control a light source, there may be something here that you never even knew you needed to know.

While researching for this article, because we never write Classroom based on our own knowledge no matter how sure we are, we found a series of articles aimed at the model railway field but nailing some of the finer and more obscure points of DC motors and PWM. While the author is knowledgeable, he points out at several places that he is not an electrical engineer. Notwithstanding that, his articles are worth a browse, and we have linked to the main one of interest on Pulse Width Modulation in the ‘Reading and Resources’ section. You can navigate to this and click in-article links to find extra information on DC motors, DCC, and how it all works together.

RECAP: DC ELECTRIC MOTORS

Before launching into any motor control discussion, it helps to remember exactly what makes a DC electric motor work. Alternating Current (AC) motors are an entirely different situation, so none of this applies outside some of the basic magnetics.

Whenever an electrical current flows in a wire, a magnetic field is generated around it. If the wire is wrapped into a coil, the magnetic field is concentrated. If two magnets are set so their opposite poles face each other, and a current is passed through the coil, the magnetic field generated by the magnets is opposed by the magnetic field generated when current is passed through the wire. If that’s all there is to it, the coil rotates until it is perpendicular to the field between the two permanent magnets and stops as everything is in equilibrium.

Careful design of coils, commutators and brush placement, number of coils, and so on ensure that the magnetic field never does reach equilibrium and the motor rotates. That’s why home-made simple motors often need to be restarted with a finger if they lose momentum.

However, there is another property of magnetic fields and conductors. If a moving conductor passes through a magnetic field or vice versa, a current is generated in the conductor, and it has a magnetic field oriented so that it opposes the one that created it. In a DC motor, this current flows opposite to the current that created the magnetic field that got the coil moving in the first place. This is called a backwards electromotive force, or back EMF. In a motor with no load, this current gets reasonably high and therefore limits the forward current that can pass through the motor. As a motor is slowed down by load, the back EMF effect is reduced, and so forward current increases. This is why loaded motors draw more current than free-running motors. It is also why stall current as well as unloaded current are part of a motor’s data.

One final point to remember is that the motor coils have a magnetic field around them, and this is generated by the current flowing through them just like any other coil. Therefore the motor is also an inductor. If the current to any inductor ceases, the magnetic field collapses and causes a current to flow in the coil that is opposite to the current which created the field. This happens quite suddenly, so the voltage generated can be quite high, much higher in some cases than the original motor voltage, as can be seen later in the oscilloscope shots. However, the collapse is not instant and has its own time scale. For an inductor, there is a theoretical model applied to the rate of collapse as we covered in issue 44 of the Classroom, and this Universal Constant is often used in motor discussions. However, it does not take into account the effects of back EMF.

Because the motor will generally have physical momentum from its mass, the moving coils continue to generate back EMF after power is removed. This can add to the back EMF from the collapse of the coil’s magnetic field or extend its duration. This becomes very important later.

WHAT IS PWM?

PWM is an acronym for Pulse Width Modulation. It is a method of controlling the speed of a motor or the brightness of a light by rapidly switching on and off power to the load, frequently enough that the motor never stops or the human eye does not perceive the flicker in the light. This allows the full voltage to be used to drive the load, but because the load is not switched on all of the time, there is a speed or brightness difference compared with running on straight DC voltage. The width of the high or ‘on’ pulse varies, and therefore so does the amount of power the load receives in a given time. This is where the ‘pulse width’ bit comes from. The word ‘modulation’ refers to turning the signal on and off. So, PWM is an on/off cycle with a varied length of ‘on’ time.

The voltage applied to the load is the supply voltage, minus any losses in the driving circuit, such as across a transistor or MOSFET used to do the switching. The voltage applied, which is the amplitude of the pulse, does not change. Not by design, at least. There can be impacts, such as heat from the output device causing increased internal resistance. There are other factors too, but they’re not deliberate, they’re often not controlled or known, and they’re usually not an issue. The point is, PWM does not achieve speed or brightness control by changing the voltage to the load, like the simple rheostat model railway controllers of days gone by used to do.

DUTY CYCLE

Before making sense of the rest of PWM, it makes sense to discuss ‘duty cycle’. This term is used in two different, but related, ways. It describes the on time of a situation as (usually) a percentage of the total cycle time. The remaining percentage, then, is the off time. We make note of these differing uses because the term applies to things like some designs of pumps and power supplies, as well as signal generator circuits like the ones that produce PWM control signals.

In equipment, ‘duty cycle’ refers to the amount of time something can be operated or run before needing a rest. A sump pump, for example, may be rated for a duty cycle of, say, 30%, which means that out of an hour (or some other specified time) the pump can operate for eighteen minutes, then must be off for the next forty-two minutes. Other equipment that works this way may be rated similarly. Even some high-current power supplies have a duty cycle, because of heat dissipation. The main reason for making something this way is that it is usually much cheaper than making something to operate continuously (often for heat reasons) when the end-use does not demand continuous operation. This is still ‘duty cycle’ but is not what the term means within a circuit or the like. However, we describe it because many people will have come across ‘duty cycle’ used this way and it’s a very related concept that could get mixed up.

In terms of circuits and signals, PWM is similar to the above explanation, but the time scale is much shorter. ‘Signals’ means any low-power electrical current such as found within most circuits, before the output device which boosts the current, voltage, or both, to usable levels. A PWM signal has a fixed frequency, which means that every second, there is the same number of on/off cycles of the same total length. What changes is the amount of ‘on’ time versus the amount of ‘off’ time. The total time stays the same.

For example, a duty cycle of 10% means that the signal is high (on) for 10% of the frequency period, then off for the remaining 90% of the period. A 50% duty cycle means half and half, and a 90% duty cycle means a high time of 90% of the total.

FREQUENCY

The frequency is how many whole on/off cycles occur in one second. No matter what the duty cycle is, the frequency will be the same for a given controller. The circuit is constructed to a given frequency, and then the duty cycle is varied. The frequency of a PWM signal is nominal and can be decided on in many cases, such as when building your own controller. If you are working with something like a DCC model railway controller, there will be a series of choices based on different standards. The idea is the same between them, however. Frequency does matter: If the frequency were to be 1 Hz, or one cycle per second, there would be a significant problem, which we’ll explain soon. Very high frequencies are not always desirable either.

THE RELATIONSHIP

Because duty cycle is a relationship of parts in a whole, it does not change when the size of the whole changes. This means that a 10% duty cycle is the same at 1 Hz (one cycle per second) as it is at 10 Hz (ten cycles per second). However, the times change. At 1 Hz, the ‘on’ time would be 0.1 seconds and the ‘off’ time would be 0.9 seconds. At 10 Hz, the ‘on’ time would be 0.01 seconds, and the ‘off’ time 0.09 seconds. However, at 10 Hz, there are 10 cycles in a second, so across one second, the total ‘on’ time is still the same as it is at 1 HZ: 0.1 (10 x 0.01) seconds. It's just spread evenly across the second with the off time equally spread in between. Note that even 10 Hz is an uncommonly low frequency, but it’s about the highest we can draw to scale in the page width.

EFFECTS OF FREQUENCY

If the frequency of a PWM signal is too low, the motor will not turn smoothly, or the light will visibly flicker. In a light, the flicker is just annoying, but it also doesn’t really give an impression of reduced brightness. It also, at certain frequencies, has the ability to trigger certain types of epilepsy. Even if the light does not visibly flicker, many people experience headaches when the frequency of a PWM signal is too low. There is a threshold that is hard to define (in other words, the research results vary), for a minimum frequency below which lighting should not be allowed to flicker.

When it comes to motors, there is a bit more to the frequency consideration. The most obvious one when you are around a PWM-controlled motor is noise. The lower the frequency, the more vibration exists from a motor. The rotating part of a motor, which could be the coils and armature or the magnets depending on the design, has inertia. If it is stationary, Newton’s First Law of Motion tells us it wants to stay that way. It also wants to stay spinning if it already is, but a variety of forces like friction and of course the load will slow it down. If you hold even a small DC motor in your hand while switching on power, you will feel a rotational ‘kick’ as the motor starts. That’s because Newton’s Third Law of Motion says that every action has an equal and opposite reaction. The stationary and rotating parts push each other in opposite directions, giving a force called a ‘turning moment’.

The effect of this is that if a motor is allowed to slow down too much between pulses, there is significant physical force involved. In extreme cases, this can make a motor jump around if connected loose on a bench. At slightly higher frequencies, the motor will vibrate audibly. This noise will likely transmit through any solid mounting, as well as being audible from the motor itself. However, if the frequency is too high, the motor does not slow down enough to make a difference to its speed. The physical momentum of the moving parts is just too great. The frequency this occurs at is quite high, however, the exact threshold depends on many factors and varies wildly.

Again referring to model railway, a common upper frequency is 16 kHz. This is known as the ‘supersonic’ frequency even though it is not supersonic, because the noise is generally not audible to the listener. Granted the theoretical range of human hearing is 20 Hz to 20 kHz, but by the time most people have passed their teens, the upper limit of sensitivity is around 17 kHz and drops off quickly. In fact, the World Health Organisation’s metastudy of existing data for hearing sensitivity loss has its data stop at 8 kHz. A realistic limit for most people above 40 years old is 15 kHz. For reference, the highest note a human can sing is close to 3 kHz, so these are very high-pitched noises.

This frequency is still low enough to allow the motor to slow and therefore affect speed control in most situations and motor designs. However, the exact frequency at which the ability to control speed starts to evaporate will vary with the type of motor and the load. There is such a range of factors involved and such a heated debate even among experts with good credentials, that we don’t even want to suggest a number. Realistically, it will vary by situation. Hopefully by the end of this article you will know enough to be able to conduct and interpret your own research for the specific motor, load, and circumstances you have. Additionally, noise is the main reason for wanting to push the upper limits. If that isn’t an issue for your situation, then choose a middle-ground frequency.

However, there is more to the frequency of a PWM signal than just noise. Running a motor takes both voltage and current. If you apply 12V to a 12V DC hobby motor but from a supply that can only provide 1mA, it won't do much. The motor voltage would crash, too, probably to less than 1V. Similarly, a 1V supply with a capacity for 1A won’t do much either, because the voltage needs to be high enough to push the current over the DC resistance and the inductive reluctance of the coils, and then maintain it against back EMF. However, current in a coil does not behave instantaneously. Coils, including motor windings, are inductors. With the coil completely discharged, current increases at a known rate. It’s not the easiest calculation to fit here and not of enough relevance to most makers, so check out the ‘Hyperphysics’ link in ‘Reading and Resources’.

This formula holds true in reverse, which is a collapsing magnetic field. In real terms, this means that from stationary, it may take something in the milliseconds range to gain full current in the motor winding. However, at 100 kHz, each full cycle is only ten microseconds long. If you want to get a motor started at 10% duty cycle, it’s not going to happen. That’s one microsecond to overcome inertia. The limited amount of current built up in the coil will well and truly dissipate before the next pulse, and the motor is unlikely to start moving at all. The frequency chosen must be low enough that the length of ‘on’ time can actually start the motor. In fact, the recommendation is that the pulse time be longer than five RC time constants as determined by the formula above. Of course, you could just turn up the duty cycle but sometimes PWM is used in a fixed configuration for a permanent speed setting.

The references we consulted all acknowledge that none of this factors in back EMF, which alters the time constant away from the theoretical. The challenge is that because the back EMF is so variable depending on magnet strength, instantaneous current, supply voltage, rotation speed, armature material, winding inductance, and more; it is rather hard to calculate. It’s certainly well beyond The Classroom. If you want a closer look, we have a link to one of the resources we found that outlines the maths and a deeper discussion of the factors. Look for ‘Controlling Brushed DC Motors Using PWM’ in the ‘Reading and Resources’ section.

Once the motor gets going, the current will not begin to decay fast enough to make a difference if the frequency is too high and the pulses too close together. Unfortunately, there is no one answer that fits all problems. Add to the unknowns of motor parameters the fact that inductance changes with frequency in the plain iron or steel used for motor armatures (which is why ferrite is used for cored inductors), and you have a bit of a dilemma. Fortunately, most motors are fairly tolerant of all these considerations, but some are quite fussy indeed. In many cases, it is good enough just to manually start the speed high then lower it to the desired level, or engineer a solution (such as a capacitor and PNP transistor) to give a longer pulse of the supplied voltage straight from the rails, not the PWM circuit. This is why sometimes, with basic PWM circuits and certain motors in certain conditions, you have to turn the speed dial up a bit before the motor starts, then back down to a desired slow speed.

FREQUENCY AND LOSSES

Further to all of that, the rising and falling current level involved in PWM causes eddy currents. These are currents induced in the metal components in the same way that current would be induced in a wire. The difference is that these currents flow around the metal component wherever they can, defined by internal resistance, impurities, other induced currents, other magnetic fields, and more besides. Eddy currents in the motor armature and even in the adjacent windings are only produced by changing currents. Once the current is steady, no more induction of eddy currents takes place. However, in many PWM situations, the current never does stabilise. Therefore, these eddy currents represent a loss, as energy is consumed in their generation, and impacts the eddy currents have in their electromagnetic relationship to everything else going on in the motor. Eddy currents also contribute to heat. The solution is to keep frequency as high or low as can be achieved, so that the current does not fluctuate as much. At high frequencies, the current doesn’t fall far between pulses. At low frequencies, the current spends more time at a constant with each pulse.

BACK EMF AND PROTECTION

Another effect of the collapsing magnetic field is the sudden back EMF mentioned earlier. This is distinct from the back EMF generated by the coil rotating in a magnetic field. When the magnetic field collapses, the voltage spike can be quite high indeed. This is actually enough to damage many output devices such as bipolar transistors and MOSFETs. Some sources we consulted provided good arguments that this was in fact the source of damage to the very fine motors used in modern model trains: the high voltage pulse when the motor is otherwise unconnected (cheap controllers use a plain MOSFET with a reversing switch rather than a H-bridge) is thought to damage the very fine motor windings. Again debate rages, and people with qualifications have opinions either way.

Regardless of the truth of that, these voltages will almost certainly cause problems with a PWM circuit. Even if they do not damage the output device, they will cause fluctuations on the supply voltage and can affect other components in the circuit. The solution in straight-up DC motors is always to put a reverse-biased diode across the motor terminals, called a ‘flyback’ diode. This gives the higher voltage a path to dissipate and is a common solution to voltage spikes.

However, if the motor is operated in a forward/reverse configuration, the polarity changes, and suddenly a plain diode isn’t the answer: In one direction, it will be a short circuit. Because forward and reverse switching is usually done with a H-bridge, the answer is building the flyback protection into this. Many commercially available H-bridge modules and circuits already have this built in. If you’re using a reversing switch, the diodes can be added to this in the correct polarity. In any case, having a small capacitor directly across the motor terminals helps slug out spikes, too.

The majority of this information so far, both regarding frequency and back EMF protection, relates to motors. That’s because, when it comes to driving LEDs, very little of this, if any (perhaps with the exception of larger LEDs with built-in driver circuits featuring inductors and capacitors) applies. There’s a section on controlling the brightness of lights towards the end of the article.

EFFECTS OF LOAD

A physical load on a motor can affect the way PWM controllers affect the motor. A heavily loaded motor always draws more current than one free-running, as outlined previously. That means that a PWM frequency that gives a high enough operating current (remember the operating current is the average current across the cycles) on an unloaded motor may not give the same results when loaded. However, because PWM uses bursts of full supply voltage at whatever supply current is available, they do give much more consistent control for a motor whose load may vary, when compared to something like a variable voltage motor speed controller.

USING MOSFETS (gate current at high frequency)

Many PWM control circuits use MOSFETs as their output stage, to take the low-current processing circuit signal and boost it to something that can drive a motor. However, as we discovered in The Classroom Issues 32 and 43, MOSFETs are driven by a voltage applied to a gate terminal which has a significant capacitance. This capacitance means that enough current must flow before the gate becomes fully saturated and turns on. While the MOSFET is between starting to turn on and fully turn on, it is quite resistive and subject to heat. That means a PWM circuit must be able to deliver a significant current in order that the MOSFET turns on quickly. For some MOSFETs, this is an appreciable amount of current.

While using a dedicated MOSFET driver and a great enough supply current will solve the problem of the MOSFET getting hot, the PWM frequency must be low enough to allow the gate to charge. The datasheets for MOSFET drivers and indeed MOSFETs themselves will contain the relevant information about gate transition times and currents, so consider this when designing a PWM driver circuit. In addition, this turn-on, turn-off time will affect the frequency chosen. In other words, the on/off period will be different at the output compared to the purely theoretical output from the PWM circuit’s nominal frequency.

USING PWM TO CONTROL LIGHT BRIGHTNESS

The vast majority of the information presented so far relates to motors. This is because most of the challenges and considerations when it comes to PWM relate to inductive loads. LEDs in particular are devoid of most of the problems. While inductive light sources like incandescent globes share some of the motor caveats, incandescent globes are very rare today. They also have a small inductive component when compared to their resistive component, as the hot filament becomes highly resistive. However, they are more inductive and less resistive when cold, so incandescent lights still have an inrush current at turn on like a motor does. In addition, some sources claim that noise can be emitted from a light globe if PWM drive is used in the sonic range. We haven’t been able to verify or refute this.

The thing to consider when using LEDs are the switch-on times stated in the datasheets for the LED to reach full brightness after power is applied. While instantaneous to the eye, there is still a very small transition time between off and on when using LEDs. This needs to be considered when planning the PWM frequency, as a very high frequency will mean that the transition time of the LED will be a large percentage of the time period. Lower frequencies mean that the amount of time spent in transition is much less of the total, and therefore the actual on/off period of the LED will be closer to the theoretical value based on the PWM duty cycle.

INTELLIGENT CONTROLLERS & THE RELATIONSHIP TO DCC

That is a lot of information to consider. The reality is that many motors and end-use situations, like using a small DC motor to run a fan, are not going to be noticeably different if you get anything wrong, except maybe for audible noise. Certain motor designs, very fine windings, and other factors mean that some motors and applications do care.

During our research, we came across many articles about PWM and DCC, and they have a lot to say to the maker even if you never have or will have a model railway layout. DCC is Digital Command Control, and is really the standard today on model railway layouts. The premise is that voltage is applied to the tracks, and digital signals superimposed on it for the controller within the train to use. Some people say this voltage is AC, but other sources suggest in more detail that it may actually be a DC sine wave of varying current. Remember, to be Alternating Current, the current must change direction, not just amplitude, and the value must cross zero. The shape of the wave does not define this. However, the biggest consensus is that the power is delivered via an AC square wave, which does indeed cross zero. Note in the image, the blue 'Z' tag at the left, near the 'T' trigger tag, that indicates 0V. Note also that this is the track signal, not the decoded PWM signal.

From: https://dccwiki.com/DCC_Sniffer

However to works, and fed to the motor via an internal PWM controller. However, it is a responsive controller. The layout operator sets the DCC controller to run the train at a given speed. It's a percentage expressed as a number between 0 and 255, with 0 being 0% and 255 being 100%. However, the DCC module in the train monitors current and also pauses the PWM for a few cycles every so often (multiple times per second) and samples things like back EMF from the freewheeling motor. Some even have a tachometer and measure RPM.

From: http://off-the-clock.timothy-nicole-marks.com/computers-and-electronics/dcc

All of these parameters are used to adjust the duty cycle of the PWM output so that the motor speed remains constant compared to what has been set. Obviously, there are limits. If you set a train to run at 100% speed, then put one hundred wagons on the back of it and send it up a 1:30 grade, it will not run at full speed. However, unless the motor is being asked to do more than it can, this system results in very good consistency. In addition, most DCC controllers also give several time periods of high duty cycle to start the motor, as described earlier. This overcomes the problem of PWM never raising the current required to overcome a motor’s inertia. DCC has a host of other features but they relate to model railway operation and not motors in general.

From: https://gothamrailmarine.wordpress.com/dcc-installation/

For those not making model railways, there are commercial PWM controllers which have similar features to DCC controllers. If you’re buying a controller or designing your own, the idea of pausing and measuring back EMF is very useful. Having tachometer inputs could also alleviate many of the issues highlighted earlier. You could also monitor heat, current, vibration, or anything else you wanted to if designing your own controller.

Please be aware, none of the DIYODE team owns a model railway, and none of us are experts on DCC. All this information is second-hand, from differing and often conflicting sources. We relayed it because it helps illustrate practical, precise application of PWM in a field that most makers researcing PWM will probably find at some point.

If you are building a model railway and want to investigate DCC, please talk to an expert. Most model railway clubs and retailers are happy to help.

Hands On: Experiment

Parts Required:JaycarAltronics
1 x Solderless BreadboardPB8820P1002
Packet of Wire LinksPB8850P1014A
1 x 240Ω Resistor *RR0557R7543
1 x 1kΩ Resistor *RR0572R7558
1 x 10kΩ Resistor *RR0596R7582
1 x 100kΩ 16mm PotentiometerRP7518R2246
1 x 47pF Ceramic CapacitorRC5320R2818
1 x 680pF Ceramic CapacitorRC5334R2832
1 x 10nF Ceramic CapacitorRC5348R2846
2 x 100nF MKT CapacitorsRM7125R3025B
1 x 470μF Electrolytic CapacitorRE6194R5163
2 x 1N4148 Small Signal DiodesZR1100Z0101
1 x NE555ZL3555Z2755
1 x IRLZ44N MOSFET or other suitable device--
1 x Small 5V Motor %YG2900J0016

Parts Required:

% We used three, one per frequency, but you don't have to. We also removed the motors from their gearboxes. * Quantity required, may be sold in packs.

MOSFET and potentiometer deliberately transparent to show wiring underneath

To see how much of an effect the mainstream maker can expect from these factors, and to help explain some of them visually, we’ve set up a small experiment. You might like to try it too. We have (slightly) modified the basic NE555-based PWM circuit from all the way back in Issue 1 when we were finding our feet. The circuit was slightly added-to in Issue 9 as ‘Choppy’. While very simple, the circuit is far from perfect. The frequency actually changes as the duty cycle is altered, within a tolerance. In addition, the N-channel MOSFET inverts the output, so we used 75% duty cycle on the PWM to achieve 25% on the motor side of the MOSFET. However, the arrangement will still satisfy the experiment.

We chose three target frequencies: A value of 10nF for C1 gives 750Hz - 1kHz, approximately. A 680pF value yields 9kHz to 15kHz (ish), while 47pF provides a range of 82kHz to 112kHz. We used our new favourite tool, the PCBite Oscilloscope Probe kit and PCB holder, to take the measurements; a digital tachometer for the RPM; and a non-contact thermometer held at 12cm for the temperature.

We wanted a fair test, so all factors are the same: The motors are identical and a new one was used for each test to avoid any contribution from wear, overheating, or damage. Supply voltage was taken from a regulated lab power supply, air temperature in the room was kept constant, and duty cycle was set to the chosen percentage via the oscilloscope for an actual, rather than calculated, output. Additionally, while we show here the test with the PWM circuit, we later built a MOSFET output stage and drove it from a frequency generator with tightly regulated frequency output and variable duty cycle. Because most makers don’t have this tool, we’ve kept those photos for social media rather than presenting them here. This task allowed us to verify our results with more defined PWM signals. We chose 1kHz, 15kHz, and 100kHz.

What we were looking for was the RPM, heating, and oscilloscope graphs for each frequency when set at 25%, 50%, and 95% (remember, that’s PWM circuit output of 75%, 50%, and 5% because of the MOSFET inversion). We ran the motor for a period of ten minutes, timed by stopwatch rather than wall clock, and recorded the RPM and heat at power-on, five minutes, and then at ten minutes. In terms of the screenshots, we were more interested in the effects of back EMF and current. Current probes are worth more than our oscilloscopes are, and the only other option is a current shunt. However, we ended up using one oscilloscope channel to monitor the output from the circuit (blue trace), and the other to monitor the activity on the motor side of the MOSFET (yellow trace).

The results confirm the differing behaviour between frequency and a specific motor. The middle frequency in this case, nominally 15kHz, exhibits the greatest spread. However, to a fair degree the difference may be in measurement inaccuracies. While the screenshots make it look easy to count the graduations, particularly the intermediate ones along the middle of each plane, in reality, there was a lot of ‘shake’ in the live display. Heating was not significant, to the point where we didn’t even give space to the results. Maximum temperature rise was 10°C and that’s not out of line for such a basic motor. One thing that is worth noting is that at 1kHz, the physical vibration from the motor was enough that it worked its way loose from the Blue Tac holding it to the PCBite post within a couple of minutes, and had to be pressed down again several times throughout each ten-minute block.

WHY USE PWM AT ALL?

Pulse Width Modulation, despite its caveats, has plenty of advantages. Many of the factors we examined here only apply to certain situations or motor designs, and you may never notice them if you use nothing more than an NE555-based 1kHz PWM controller for all of your motor needs.

However, hopefully now you are aware of what may be in play, and why certain things may have been observed. For many makers, PWM remains a simple and effective way of controlling motor speed.

You may have heard PWM referred to as a ‘highly efficient’ control method. Many of these statements do not clarify that in fact, PWM can cause more losses in a motor than a variable voltage and steady current can. However, the circuits for those controllers usually involve turning excess voltage to heat, and therefore are terribly inefficient from a circuit standpoint.

PWM is also very useful for controlling non-inductive loads like LEDs. Just be aware of the possibilities, and most makers can continue using basic PWM circuits with confidence and no consequences. However, now you know what to look for and what to be aware of if your needs are more specific or if problems have been encountered.