now I'm sure you've all seen one of these before this is a power supply it takes Main's voltage in so that's 240 110 Vols 50 or 60 HZ AC and then it gives out some lovely isolated DC on the output and we use these throughout our homes to power all of our amazing modern technology but have you ever wondered what's going on inside a power supply like this well the internals will typically look something like this and over the next 20 minutes I'm going to try and explain what the majority of these components are doing however before we dive into the technicalities I want to quickly show the amazing evolution of modern power supplies so for now I'm going to push these aside so that I can show you this Beauty made by a company called Aztec in the 1980s because of its age this power supply is a fairly different topology to what we're going to be going over today but it's absolutely perfect for a size comparison to see how far we've come in the last 40ish years so this power supply puts out 12 volts at 2 amps so that's 24 wats and I also have a state-of-the-art 30 W power supply from a small anchor phone charger so how much smaller do we think that's going to be after about 40 years of progress in Power Electronics half the size a quarter of the size a tenth of the size it's actually over 50 times smaller isn't that amazing 24 Watts 30 wats and what I find really interesting is that there's been no golden bullet in the last 40 Years of power electronic development it's just been repetitive gradual improvements as we can see from these four power supplies they may be slightly different power but the Improvement in power density between each one is almost perfectly linear as you can see in this nice graph back to how these power supplies actually work there is one very important component we need to have a good understanding of before we can fully dive into them and that's inductors which are these yellow things and how we can use them to store energy so when used in power electronic circuits an inductor that's this is actually very similar to a spring that's this how come let's take a look so the live and neutral pins of this plug are connected directly to that inductor so just pretend this plug is an inductor I have my power supply turned on and set to an output of 2 volts if I now connect my 2 volts across this inductor we'll see something interesting happen I want you to watch this number this shows the current can you see how it slowly Rises and then stabilizes at about 1 amp because there the resistance of our inductor is stopping any more current from flowing for the two volts that we're putting in now for the spring if I push down that's the same as when we have a voltage across our inductor and the current builds up until it can't take anymore so if I hold the positive terminal on here we've got current flowing and that's the same as my squished spring we are currently storing energy in this case it's in a magnetic field and in the case of the spring it's in the form of tension speaking of which what happens if we release that energy and for our inductor now let's look at both together what we get is a high voltage Arc between the positive connector and the inductor and this is thousands of volts and is actually quite dangerous not only to people but more importantly to circuitry and that's the result of all the energy stored in our inductor suddenly getting released all at once exactly the same as in the spring when all the energy we've stored by squishing it is released in one go and it goes flying across the lab but how is any of this relevant to our standard power supply that we might use for say charging our laptop I don't know about you but my laptop definitely doesn't need 5 kilovolts to charge well first off there's no reason that we have to release all the energy that we've stored instantly for example I could spend 3 seconds squishing my spring and then get the energy out of it in 1 second and for the case of an inductor the ratio between how long we spend putting energy into it so applying voltage across it and how long we spend taking energy out of it that's the ratio between our input and our output voltage so let's take a quick look at what these waveforms might look like for example we want to apply 10 volts here and we're going to do that for 2 seconds so the width of this is 2 seconds and next we're going to release that energy so because we're releasing it our voltage is actually going to be negative but let's say we're going to do that in half a second so that means it's going to come all the way down to here and we're going to have minus 40 volts and the amount of energy we're storing is roughly equivalent to the voltage multiplied by the time so that means we can represent it by this area and because the magnitude of our voltage down here is much greater our time is going to be a lot less to get the same amount of energy out we can't create free energy so we're going to say this is about half a second and let's say that we do our 10 volts for 2 seconds every 3 seconds then that means we're going to go back up to 0 volts and we're going to sit there for another half a second before the cycle repeats itself so we can use this Theory to increase a voltage and of course we can sort of flip these times around so spend less time charging and more time discharging our inductor to get a smaller voltage out than we put in there's just a few small problems with this first off is that of course the voltage we're getting out is negative that's a bit annoying what if we want it to be positive the second problem is that we can't have a massive difference between our input and output voltage because let's say we were putting in 100 and we wanted one volt out we'd have to run at what's called 1% duty cycle so that means the amount of time we're extracting energy from our inductor is going to be tiny compared to the amount we're putting in and that's just generally going to give us a lot of problems finally and most importantly this circuit has no isolation which is what we're going to take a look at now so what is isolation well it's absolutely crucial to the safety of modern appliances and it boils down to the fact that the mains that we get out of a plug so that's live here and neutral here is not isolated and what I mean by that is that where the power comes into your house there's just two wires a live and a neutral there's no Earth Earth is created where the power comes into your house where neutral is joined to the ground we do this for several reasons which maybe I can go into in another video but the problem with it is it means that if you touch the Live Wire you don't necessarily also have to be touching the neutral for current to flow you just have to be stood on the ground and current will flow through the ground and then back up to neutral this is clearly very dangerous and is the reason why the output of our power supplies need needs to be isolated you're not going to find any power supply for anything even from the dodgiest parts of the world that aren't isolated at least I hope so essentially isolation just means if we peer into the barrel Jack of our DC power supply we have our positive on the inside we've got our negative on the outside and there's no direct current path between either of them to ground so our little friend could touch the negative he could touch the positive as long as he's not touching them both at the the same time he'll be fine also in most cases these power supplies are such low voltage he can touch both at once and still be fine so that's a quick look at isolation but how do we realize this in a power supply let's take a look first off I'm sorry to break it to you but an inductor is nothing special it really is just a coil of wire or in this case several coils the only thing that really makes them special at all is the fact that most of the time they're wound on some kind of Ferris core and that's just to amplify and concentrate the magnetic field so let's just draw our coil of wire we've got our input coil of wire and an output that's an inductor now as I mentioned we have a core so let's draw some lines so for low frequency inductors or Transformers this will typically be something to do with iron now the important thing to remember is whilst our energy is coming in through this wire and leaving through this wire the energy is actually stored in the magnetic field in the core so our energy is in here and this means we can do something very clever we can use this coil to put the energy into our core but then to get our isolation and the other things that we wanted we can add a second coil so it starts to look a bit like a Transformer if you know what that looks like but the crucial difference is that this is designed to store energy a Transformer is designed to transfer energy so if I quickly replicate our voltages that we had before this time on our primary our voltage is going to come up we're going to have 10 volts and then it's going to go to 0 Vols what's happened to that- 40 Vols well that's going to now appear on the secondary and because this is a completely separate coil what we can do is we can just flip it around to get rid of the negativity of the voltage before so while the core is charging up from the primary we're not getting anything out and then when we stop charging it the energy is going to come out of our secondary like this and this is going to be our 40 volts but what about my example before what if we want a really big ratio between the two let's say our input is 110 volts well we just put more turns on our primary again just like a Transformer so by separating the input and output of our inductor which makes it into a coupled inductor we've solved all of our problems put energy in through the primary take energy out through the secondary right we're almost ready to start going through all the components and what they do there's just one final thing I want to go over with inductors and that's to do with their size as you can see this inductor on the oldest power supply is probably about twice the size of this one and this new one is about a quarter of the size of that intuitively the amount of energy an inductor can store is roughly proportional to its size its volume so if we shrink our inductor down it can't store as much energy which sounds like a bit of a party stopper but there's one very simple solution and let's take a look so here we have two buckets the yellow on the left represents the primary or input to our inductor and the green on the right represents the output of our inductor or the secondary winding I have two inductors I can use the big one and the small one so first let's use our big inductor we're going to fill up the core with energy and dump it out onto the secondary winding and we're going to repeat this process so that we get a constant power out of our power supply next let's have a go with our smaller inductor as you can see it holds less energy so to get the same power the same total energy out in a given time we have to scoop more often something worth noting is that we're leaking more if you look on the floor between the two buckets there's more water pouring out now let's compare the two together as you can see we're having to fill and empty our smaller inductor a lot faster and this translates to a higher switching frequency the switching frequency is how many times per second we're charging up and discharging our inductor and this water leakage represents a few losses such as switching loss and core loss in our inductor these losses are a fixed amount of energy that we lose every time we fill up our inductor with energy so by doing that at a higher rate it means we have more losses and fundamentally that's what limits how fast our switching frequency can be right now that we have a solid understanding of what's going on at the heart of our power supply let's take a look at everything else so what I'm going to do to make this nice and digestible is I'm going to go from the Main's AC input to our isolated DC output and I'm going to start by going through the bare minimum components you'd need for this circuit to work and then we're going to keep going through adding in a new parts of the circuit and I think you might be surprised it has simple it actually is so first off our power comes in here we've got three pins Earth neutral and live as I've mentioned several times this is AC and the first thing we need to do is turn it to DC so for that we use this black component up here this is a full Bridge rectifier and contains four diodes in a special configuration to essentially get the negative part of our AC wave and flip it around so that it's always positive although this means our current is no longer alternating I'm not sure we can call it Direct because it's very up and down to sort that we then add a large capacitor so that is what this thing is here in this specific power supply it's got a big sticker on that tells us the specs but here are some other capacitors now something very important to note about this capacitor that is true for all switch mode power supplies is that it is charged directly from the rectified Mains which in most of the world means you're going to be looking at about 350 volts on this capacitor and they can hold their charge for days and weeks so I'm not going to try stop people from opening power supplies in fact I encourage it but make sure you have a multimeter a resistor some things to discharge this capacitor and check it is discharged and know your fingers don't count next we have a pair of components that work together there's our inductor which we already know everything there is to know about and there's also our mosfet which is up here so the T in mosfet stands for transistor and this is our electronic switch this is what we use to connect the input winding of our inductor to this capacitor that we've charged up so this mosfet is directly used to control how much energy we put into our inductor and in a simple topology like this it's actually the only thing we control in the entire circuit on the output side of our inductor to take the energy out we have a diode and the diode's job is to stop energy from going into the output of our inductor we want to turn on the mosfet that'll charge up the inductor and then when we turn it off the energy can only go out of our output through the diode which is essentially an electronic one-way switch and after it's been through this diode it is then stored in these four capacitors these are our output capacitors and just like the input capacitor their job is to smooth some very lumpy DC into some nice smooth clean DC and that's it the circuit would work functional and usable with just those components so that means we actually understand how to build a power supply we could do that ourselves please don't but now let's start going through some of the other components and see why they've been added surely they're not needed if it would work without them first and I think simplest to understand we have an LED to show when the board is powered and that also has an accompanying current limiting resistor to stop it blowing up this led just comes on when the output is on so the LED being off doesn't necessarily mean that there's no AC on the input it just means there's no DC on the output next up we have another inductor which is this small inductor here if you watched my previous video you'll recognize this thidal shape of inductor and this is placed in the surface CC it after our DC output has passed through these three capacitors and before it goes into this final output capacitor this inductor combined with a very small capacitor on the back of the board acts to further filter and smooth our DC output as large capacitors alone often struggle to remove all of the very harsh on and off signals present in these power supplies next we have two small resistors again on the back of the board these are placed across two of the output capacitors and their job is to discharge the capacitors when the power supply gets turned off this is just so that when you turn your power supply off the DC output drops to nearly 0er volts within a few seconds maybe a minute and this is so that if the output got shorted or anything like that you wouldn't get a big Spar as all of these capacitors suddenly discharged into whatever had shorted it the reason we don't need resistors like this on the big capacitor is because there's no direct connections from the outside onto this capacitor in my opinion this capacitor should still have a bleed resistor because it's still very dangerous especially in open power supplies like this that aren't potted in a plastic enclosure next we have yet another thing on the back these three resistors they are all very low resistance and wired in parallel and the whole group of them is put in series with our mosfet what's the point of these well these form what's known as a current shunt and these are used to measure current you may or may not have heard the equation V equal I which is telling us the voltage across a resistor or set of resistors in this case is equal to the current multiplied by the resistance as we know the resistance we can measure the voltage across these resistors to work out how much current is going through them and this is used by the controller to monitor the current going through our inductor next we're finally back to the front with this section these three gray capacitors and this special inductor together these components form our input filter their primary purpose is to stop any of the high frequency switching signals that come from our flyback circuit over here from making it out onto the mains and interfering with other products such as TVs this inductor is known as a common mode choke and as you can see from the schematic symbol it's actually got two windings one for the live and one for the neutral and it actually looks very similar to our coupled inductor that we use for transferring our power and that's because in construction it is almost identical the idea of a common mode choke is that the polarity of the windings is configured in such a way that any noise that appears on both get cancelled out but the Main's AC that is going in the opposite direction in one than the other can pass through without being blocked the gray capacitors are here because as the frequency across a capacitor increases its impedance decreases and essentially what that means is that they will soak up more energy from higher frequency signals so with the three of these placed in parallel between live and neutral they will absorb quite a lot of that high frequency switching noise that we don't want to get onto the mains whilst having virtually no effect on the Main's current which is at 50 HZ instead of about 65 khz that this circuit switches at next in front of our input filtering we have our input protection this is here to protect the power Supply from the mains if the mains does something dodgy and protect the mains from the power supply if the power supply does something dodgy first and foremost we have this red thing which is a fuse I'm sure you all know what a fuse does but if not it's essentially a very thin piece of wire that's designed to be a lot thinner than all the other wires in the circuit so that if too much current flows this will break first and because it's designed to break it breaks in a safe way over here we have this large black disc this is an NTC themister and it job is to limit the inrush current the current that flows when Mains is first connected to the power supply to charge up this big capacitor an NTC themister has a high resistance until it heats up a bit and then it drops so when you first turn the power supply on and the NTC themister is cold its high resistance limits how much current can flow into this capacitor once the circuit's been running for a while it's heated up and its resistance has dropped so that it doesn't really affect the circuit at all then down here we have this blue thing which looks similar to the thermister but quite a lot smaller this is a Mau or metal oxide varista and this is placed between live and neutral a varista is essentially a voltage dependent resistor so the bigger the voltage across a mauve the lower its resistance is this is designed to clamp spikes and is one of the components you'd find in a typical Main's surge protector big Ms like this one are used to absorb energy from lightning strikes on large switch gear and are quite beefy components the final part of the input protection circuit is the two small resistors on the back these are between live and neutral and and are mostly there to discharge the gray input filter capacitors because if you happen to unplug this power supply just at the peak of the AC wave these capacitors could be charged up to the same voltage as this capacitor maybe 350 volts and unlike the big capacitor these are before the rectifier which means they are accessible on the Main's input so for that reason we have more bleed resistors just like the ones on the output to ensure these are always discharged next we have even more discs these two blue capacitors these are known as class y or just y capacitors and these connect one of the inputs and one of the outputs of our rectifier to ground as with the gray capacitors these are mostly there for filtering to prevent all the bad switching signals from getting out and interfering with other stuff just by passing through the air a bit like a radio this interference is known as Emi or electromagnetic interference and we'll notice as we go along that quite a lot of these components are just here for EMC which is electromagnetic compatibility basically Bally we have to make a lot of effort to make sure our circuit doesn't mess up other people's circuits and it's a bit of a hassle really in our final step of adding bits we've got a load of small components mostly resistors and capacitors and a single diode these form circuits known as snubbers and they are placed in parts of the circuit where spikes in voltage might occur so we can see one on the input winding of our inductor and that's because whilst most of our energy is stored in the core of the inductor and will come out the core through the secondary like we want it to do some energy will unfor fortunately come out of the primary and to prevent that energy producing a massive voltage like we saw at the very start of the video we add this snubber circuit on the snubber circuit across the output diode is there because when the diode is forward biased so that means there's current flowing through our diode everything is happy with the world but then when we put a voltage across it the other way and we expect it to block there's going to be a period known as the reverse recovery time when current actually flows in the wrong way through our diode and again this current can lead to a big voltage Spike so we put another snubber circuit across our diode and finally we add a very small capacitor across our mosfet and this is also to protect that from any potential voltage spikes these snubbers serve two main purposes first is to protect the devices they're connected to and second is yet more EMC as these voltage spikes can produce a lot of interference now there are still some other components on the board everything I haven't mentioned is to do with the control of the power supply so for example this black Chip going from the input to the output is how the controller knows what the output voltage is this little white circle is a potentiometer so we can put a screwdriver in there and turn it to adjust our output voltage but generally we've gone over every component in this power supply and we know what they all do they all serve a purpose even if that purpose is just to meet annoying EMC regulations we made it we Now understand not only what is in here but why it's there and it only took us about 20 minutes so please if you like the video subscribe it really means a lot if I get enough requests maybe I'll make some more videos about switch mode power supplies such as going into a lot more detail about why this modern gulum nitride power supply can be so tiny but until then once again thank you very much for watching goodbye [Music] [Music]