EditoralsJanuary 1, 1970

Recently I was alerted to the below video:

story image illustation
This is a 1kHz square wave generated by an oscilloscope's test waveform. Notice that it really does look "square" in the corners.
This is a 1kHz square wave generated by an oscilloscope's test waveform. Notice that it really does look "square" in the corners.
Here is a zoomed in view of one transition from the above 1kHz square wave.
Here is a zoomed in view of one transition from the above 1kHz square wave.
story image illustation
story image illustation
story image illustation

https://youtu.be/FNnMuJl5gJ8

In this video, a very pleasant woman delicately explains why everyone other than her is an idiot and can't build cars properly. But, she isn't wrong that this is an actual problem. Electric vehicle manufacturers are loathe to put AM radios in their cars, not because AM is old but because EV systems put out a lot of AM noise and the radio wouldn't work anyway. So, what can be done about this? And, why does it happen? This is going to be quite a technical blog post so buckle up! Note to electrical engineers: While technical, this will be one of my usual posts aimed at non-EE types and thus several liberties will be taken with the way electricity really works.

In electric drive trains a particular process needs to happen. The car has an on-board battery pack with some voltage worth of batteries. Then, the motor will need different voltages at different speeds. Many motors also need some form of AC power. The batteries are DC. So, there is a motor controller that turns the battery power into the correct power for the motor. As explained in the video, this is done by PWM switching.

Essentially this is like being able to flick a light switch thousands of times per second to control how bright a light looks. The ratio of the amount of time the switch is on vs off changes how bright the light looks. In the car, the switches tend to be able to be flipped to one of three positions - connecting to the + end of the battery, connecting to the - end of the battery, or connecting to neither. But, usually when driving the last choice - connecting to neither - is not used. That's used mostly just for coasting and when not driving. So, what really happens is that the switch will be rapidly flipped between + and - ends of the battery. This actually allows the DC input voltage to be "flipped" and run negative as well. This is how AC power is generated from DC sources like the car's battery. As in the above picture, one usual goal of this PWM is to generate a varying voltage that approximates a sine wave.

The switches in cars can make their transitions very rapidly. The switch might be flipped upwards of 8000 times per second but it actually can turn on or off in around a tenth of one millionth of a second. That's fast! You want the transitions to be fast as during the transition the switch is not fully on or off. It's sort of sliding toward the new value and it can get hot during this time. If the time is very short then things are pretty efficient. But, there's a problem. Fast transitions between on and off are noisy electrically.

In the above zoomed in view you can see that the square wave transitioned from off to on in about 2 millionths of a second. That's fast but it is still about 20x slower than an IGBT could switch on in a motor controller. This shows that even things that look square might not quite be when you zoom in. But, this is close. So, what is noisy about output like this? Well, the noise is in how square waves are generated and how they manifest in reality. Without going too far into the weeds, let's take it for granted that a square wave can be generated or represented as a series of sine waves added together such that you take the frequency of your intended square wave and then add odd multiples of it's frequency as sine waves. So, in our case the first frequency in this square wave is 1kHz. The next one is the next odd multiple which is 3. So, it's 3kHz. But, for each odd multiple we use, we also divide its power by the multiple. So, 1kHz * 1, 3kHz / 3, 5kHz / 5, 7kHz / 7, etc. If you add all these sine waves together you get a square wave. To make it square you need quite a lot of multiples all added together. So one could think of the pictured square waves as a series of, say, 100 odd multiples of the frequency of the wave. This is where noise comes from. If you have a 10kHz PWM output from a motor controller then it is truly outputting a 10kHz sine wave, a 30kHz sine wave, 50, 70, 90, 110, 130, 150, 170, 190kHz, etc. Thus, what you are actually doing is transmitting a LOT of sine wave frequencies all at the same time. Some oscilloscopes can show this as a picture. This is called an FFT plot:

Above we see a view of all the frequencies in the 1kHz square wave. Notice that the graph goes from 0Hz to 2MHz and there is still a signal there at 2MHz. That's from a 1kHz square wave! Now, the above graph introduces another thing that must be explained - decibels. The vertical axis is in decibels. What is a decibel? Well, the easiest way to explain is to say that 10dB is an increase in power of tenfold. -10dB is a tenfold decrease in power. These are cumulative. 20dB is 10dB * 10dB = one hundredfold increase in power. So, by 2MHz on this picture, you see the signal only gets up to about -50dB. How powerful is that? 1 / (10 * 10 * 10 * 10 * 10) = 1 / 100,000 or one hundred thousandth of the original power. That's... not a lot of power. But, technically there is still some signal there. And, as we'll see later, -50dB is not actually that weak of a signal in the right circumstances.

Here is an FFT plot from a different oscilloscope that was monitoring PWM output from a motor controller (that was not connected to a motor). Here you can see a similar thing - there are spikes in the frequency graph at regular intervals and as frequency increases, the dB or power of the signal goes down.

A natural question to ask when looking at the motor control PWM picture is "I see that the PWM is actually a bunch of spikes up and down, how do these spikes turn into smooth curves?" Well, that's an excellent question and very relevant to how all this noise happens. Most people know about the basics of electricity. You have three main quantities that all balance out - volts, amps, and ohms. They are related through a simple equation: I = V/R. For reasons beyond the understanding of mortals, I means current (in amps) in this case. V = voltage and R = resistance (in ohms). So, in English, The current flowing in a line is the voltage in the line divided by the resistance of everything in the pathway. So, if you have 100 volts and 20 ohms of resistance then 5 amps will flow. It's easy and you can rearrange the equation to get any of the three if you know the other two. Resistance can be thought of as like pinching off a garden hose. The more you pinch it, the less water flows. But, pinching isn't all you can do. The hose has some resistance to flow too. It isn't perfectly smooth and only so much water can flow in a given space inside the hose at a particular pressure. Lots of actual effects conspire together in hoses to yield the actual amount of water that can flow in a give time period. To explain some oddities in electricity, let's suppose there is a balloon attached in line with the hose. When you first turn the hose on, the balloon is empty. As water pressure starts to build up, the balloon begins to fill with water. It's stretchier than the hose so the water wants to fill the balloon. If you hold the end of the hose closed you'll find that water still flows, but now it flows into the balloon. If the balloon is strong enough then it will keep expanding until it has stretched so much that its internal pressure is equal to the water pressure from your spigot. Now, nothing flows. The balloon is expanded but it has reached its limit and so no water flows. Now, say you let go of the end of the hose and let it flow freely. What happens? Well, the balloon has lots of pressure in it so it will help to push water out the end of the hose until the pressure in it is once again equal to the pressure in the hose. This pressure will be less because now water can flow out the end of the hose. Likewise, there are "balloons" of the electrical world that can absorb pressure and act like a storage place for electricity just like the balloon acted like storage for water. These electrical things are called inductors and capacitors. They act like storage places to help equalize the pressures. But, in the case of electricity, they act somewhat differently. Inductors oppose changes in current. If you have 5 amps flowing and that tries to drop to 3A, the inductor will not find that funny. It wants to maintain the 5A if it can help it. So, it will feed energy back into the system to try to make 5A still flow. Generally it will do this by trying to increase the voltage. Capacitors are similar but they do not like the voltage changing. If you have 100 volts and it drops to 50 volts, that makes the capacitor sad. A sad capacitor will try to push energy into the circuit to bring the voltage back up where it was. In all cases - balloons, capacitors, and inductors - they will steadily run out of energy to give back. So, the amount they give will drop off over time. But, when they are not full they can absorb from the stream to fill back up.

Now, what does that amusing story have to do with PWM and how it goes from spikes to smooth curves? Everything. If you were, for instance to turn your spigot on and off with a balloon in line with the hose, you'd find that the pressure doesn't spike because the balloon is stretchy and can accept water. Likewise, capacitors and inductors are electrically stretchy and will accept energy. This smooths out the transitions so that sudden jolts of energy entering or exiting the system will not actually spike the voltage to extremes immediately. Instead the voltage is drug around by the PWM. So, are there capacitors and inductors in an electric vehicle drive train? Yes, to both. Though, the answer is also weirder than it first appears. Basically all motor controllers have capacitors in them. These capacitors are generally on the input side and help the battery. Otherwise, what happens is that the battery is asked to provide 500 amps for, say, 30 millionths of a second, then no amps for 100 millionths of a second, back and forth. This is not something that the battery can actually do. Batteries are the result of chemical reactions. They can't respond instantly to current requests. So, a large capacitor is put in parallel with the battery. The capacitor can act more quickly than the battery and this gives the battery time to ramp up its chemical reactions. Then, on the output side, the motor is basically a giant inductor. So, both capacitors and inductors are found in the drive train system. But, I said it was also weirder than it first appears? How so? Well, EVERYTHING is a capacitor and EVERYTHING is an inductor. In engineering textbooks you have pure inductors and pure capacitors but they don't exist outside of textbooks. This makes the world strange as inductors have capacitance, capacitors have inductance, and wires have both. Oh, all three have normal pure resistance too! Isn't that exciting?! The fact that wires have capacitance and inductance is normally not of much concern. The values are usually very small and can effectively be ignored. But, wait, was it confusing enough yet?! No? It turns out that the values can change with frequency too! EXCITING! MAGICAL! FANTASTIC! A wire that looks like it doesn't have much inductance might have more at a higher frequency. How perfect! This, by the way, is why it is so important to have the correct network cable for ethernet cables. Why do you need CAT6 cable for super fast networking? Well, because they had to specially manufacture that cable to have suitable values at the speed that ethernet signals happen at. But, I promise, this is pertinent to discussions about electric drive trains and why AM radio gets zapped.

So, let's say that the switches in a vehicle's motor controller can switch on and off each in a 1/10th of a millionth of a second. Let's say the voltage on the wire is currently 0V and we close the switch in the controller to connect to the battery's + terminal. It then takes 1/10th of a millionth of a second (so 100ns or 0.1us is how that's written) for the voltage to ramp up. This transition time is fast. It is equivalent to a 10MHz signal. But, it is heading into a motor that has inductance. As mentioned, inductance tends to act like a balloon where it tries to absorb energy. It wants to limit how much current can flow and thus rounds off the edges a bit. If it rounds off the edges down to 1MHz then what happens? Now we have a signal that looks like a 1MHz pulse going down the wiring toward and through the motor. Here's where we go off on another fun tangent.

You see... it turns out that electricity doesn't exactly travel down a wire like you were lead to believe. Instead, it sort of travels around the wire as well, following the wire wherever it goes. In reality, you knew this but didn't know you knew it. Think back to school demonstrations when they wrapped a bunch of wires around things. Maybe you had to do an experiment where you wrapped a bunch of wire around a nail, connected each end to a battery, and were then able to lift up iron things with your energized nail. Why did that work? Well, because electric fields don't travel just inside wires but around them. The flowing electricity caused a magnetic field to form and you were able to use that to lift up iron things. Whether you have DC or AC on a wire, any time current is flowing you have electrical fields around the wire. Here's where it gets a bit weird. What happens starts to depend on how fast the voltage changes levels. A full discussion of all the intricacies could put a caffeine addict to sleep but briefly, another revelation is that electricity and magnetism are not different. In physics, they are both part of the electromagnetic spectrum. Magnets and electricity are both essentially two sides of one coin. This is important for what comes next. At low frequencies, generally accepted to be below 100kHz (100 thousand direction cycles per second) the effects of the electricity around the wire tend to be felt mostly as magnetism. But, above this point, the effects felt become mostly radio waves. The magnetic effects are called the near field and the radio waves are called the far field. This is where NFC comes from - near field communications. In essence, NFC chips use a magnetic field to talk back and forth.

Now, with that out of the way, you might see something interesting. Remember back when there were FFT graphs and they showed that even a 1kHz square wave could have 2MHz components? Do you see a problem? Even 2MHz is over our 100kHz threshold. Oh no... So radio waves? Yep, radio waves. Why is the far field called the far field? Well, guess what carries radio waves around? Photons! Yes, photons like what light is made of. Literally, the wiring of your motor controller is launching invisible photons out all over the place. Wouldn't you know, AM radio is carried from 540kHz up to 1700kHz (that's 1.7MHz). Since our square wave is comprised of a series of sine waves of decreasing amplitude, some of them happen to overlap with the AM radio. So, what do these nefarious photons leaking out from our wiring do to the AM radio antenna? They go ahead and take a vacation in there. Thus, the wiring of the motor controller will literally become it's own AM broadcast station. This happy event makes AM radio reception very difficult unless the static is soothing to you.... OH NO! TAKE THE WHEEL! TURN BACK ONTO THE ROAD! NOOOOOO!!!!!!!

I suppose it might be best to take a step back and discuss another aspect of this. Radio waves don't just immediately jump off of all wires equally. There's a reason some of us had to be mommy and daddy's special antenna adjuster back in the day. Anything that can broadcast or receive a wireless signal is basically an antenna. But, not all antennas are meant for all signal sources. Some are better at certain frequencies than others. Think back to the first picture of PWM:

That is what is called a full sine wave. It goes from zero to maximum, back to zero, to minimum, back to zero. This is relevant because antennas are sized to the wave length of the signal they are meant to send or receive. Antennas are best if they are a multiple of the quarter wave. Why a quarter wave? Well, look at the picture. See how the wave gets up to maximum at the quarter point and minimum 75% of the way through? That sets the "size" of the wave. It's at its special points every quarter of the way through. Because of this, quarter wave antennas are very common. You can have half wave and full wave antennas as well but they're still a multiple of quarter wave length. So, what's the wave length of radio waves? Glad you asked! The wavelength is the speed of light divided by the frequency of the signal. The speed of light is around 300k kilometers per second (it's a bit less but shhhhh!) Of course, someone up above is laughing uncontrollably because it isn't always that speed. It's around 300Mm/s in space but the speed of radio waves is slower in air and slower still in water. So, the answer is complicated but let's just assume the speed of light is at it's maximum. This is standard practice because getting the real value is complicated, confusing, and irritating so people mostly ignore that it could get slower. So, what is the speed of light divided by 1MHz? It's 300 meters. A quarter wave of that is thus 75 meters. That's... well, that's longer than your whole car. And the car behind you, and the one after that, etc. 75 meters is quite long. So, why do radio waves still jump off your wires? Because radio waves are jerks and they'll still do that, just not as well. So, if our goal was to build an excellent AM radio jammer, we failed. But, it turns out to be a decent enough radio jammer that it's still kind of annoying.

So, time to bring up decibels again. In the example 1kHz wave I showed, there was a signal strength of about -50dB at 2MHz. That's pretty close to the AM band. So, let's say our noise is roughly -50dB in the AM band. How bad is that? Well, let's say your radio has a sensitivity of about -70dB and we say that a signal over that power should be able to be "tuned into." Well, maybe we have a problem then. Our noise is around -50dB. Because our wiring is not an ideal antenna it does not actually transmit the full power. But, -70dB is 100x more sensitive than our potential noise signal. So, we're probably going to pick up some of it.

It should be noted that this same scenario holds for all frequencies. Technically there will be some noise even at 100MHz. But, since the noise gets progressively less as we go up the frequency spectrum, at some point it's so low in power as to be able to be ignored. That's why a motor controller is not very likely to affect your cellphone or wifi. WiFi runs at 2.5 to 6GHz. WAY WAY WAY above all the frequencies we've been talking about. At those frequencies the noise we're generating is likely -100dB or less.

A lot of time in the video was spent in dragging engineers for not realizing that ground planes... aren't. She's correct, at high frequencies a ground plane will not in fact be a common ground all at the same voltage. The reason has to do with wavelengths as we just discussed. At 1MHz a ground plane might as well be a plane of constant voltage because it'll damned near act like it. 75 meters is still long! But, what if there are 1GHz signals on a circuit board? At 1GHz the wavelength is 300 millimeters. This may be more problematic. Remember that the maximum change in voltage on a sine wave happens at the quarter wave points. That's 75 mm which is 2.95 inches. Are the circuit boards in motor controllers larger than 3 inches across? Yes, almost certainly. So, if 1GHz signals were milling about then one could not trust the ground plane of a circuit board. Is that terribly relevant to the discussion we're having? Only slightly. But, future and current electrical engineers take note, ground planes do not act 100% like ground planes at high frequency and this must be accounted for.

Then there is her idea of using resistors. Well, the number one problem here is that resistors do exactly what is written on the tin. Let's say that calculations suggest that adding a 0.01 ohm resistor in series would help. All by itself, a 0.01 ohm resistor limits the current flowing to 360v / 0.01 = 36000A. So, doesn't seem like much of an issue. But, let's say we have an average of 1000A flowing through a motor. We add the 0.01 ohm resistor to change the RF aspects. Heating in a resistor is Current * Current * Resistance (I2R) = watts dissipated by the resistor. Ut oh…. 1000 squared is a big number. Our resistor fix is dissipating 10kW during the 1000A acceleration! Let's say our average driving current in the motor is 120A. Now our fix only wastes 144 watts which is better but it does that basically all the time. Is that making the motor more efficient? Probably not. My guess is that automotive engineers don't want to add resistance because that almost always ends up wasting power and generating extra heat.

She talked about resonance which is true, that is going on. But, it's a hideously complicated topic that is tough to explain. I suppose one could think of capacitance and inductance like springs at 90 angles to each other attached to a large weight. When the weight is stationary nothing happens. But, if you pull on the weight one way or the other then you load up the springs and they begin to resist the movement. If you let go they try to dissipate their energy but since they're at 90 degree angles to each other they can sort of fight each other and effect how the other moves the weight around. If you get the forces just right, you could cause the weight to move in spirals once you let it go. The two forces could even sort of help to cancel each other out. If you take a wiffle bat and periodically smack the weight with the same force over and over in the same way every time then you might find that at some intervals and some force of hits you could get the springs to react strangely where suddenly things get really violent and the springs begin to pulsate at a frequency that resonates and everything begins to violently shake more or less in place. Modifying either of the spring tensions, the frequency of your hits, or the force of your hits could all dampen this effect so that it goes back to being more chaotic. Electrical waveforms can be sort of like the above contrived example. In electrical engineering, there are three basic things involved in resonance tuning - R, L, C - Resistance, Inductance, Capacitance. You can change the value of any of the three to change the resonant frequency. So, she's advocating adding R to change the balance. I mentioned why I think that could be a problem. The other approach would be to change L or C or even to avoid the resonance just by avoiding sending energy into the circuit near that resonant frequency. This can be done by changing the PWM frequency or the switching time of the transistors.

So, there are lots of ways to solve the problem, they all have problems. Complex engineering is never a clean sort of thing where one size fits all and everything is roses. No, there are downsides to everything you do. At some point one has to accept the limitations of the design and ship it. That's not to say that we can't do better in the future. But, everything has trade offs.

One interesting way to help with things, that they are already doing, is to increase the voltage so that you can decrease the current. Many bad effects are related to current flowing so if you can double the voltage you halve the current. Remember above for example - I2R. If you halve the current you QUARTER the heat losses. If you can go to four times the voltage, you cut your heating losses to a 1/16th. Alas, higher voltages require thicker wire insulation and that has its own downsides. It's always, always a bunch of tradeoffs.

Story Tags