For ac, if you have say mains input, 230v or 115v and want to get an output of say 12vac, then you use a transformer and transformers can be very efficient, like 97-98% which is awesome. And even there is some regulation imposed on the minimum efficiency of transformers, tho i forgot details on that. To scale ac down or up, transformer is a great tool, but its expensive and heavy. Then you convert the ac to dc, and that is also efficient, no significant losses, the diodes will loose a little but capacitors will not. At this point the system still has awesome efficiency, but this point onwards its dc current.
For dc, if you have 12v input and you want to get 5v output with 1A consumption, you will have to dissipate as heat the difference of 7V * 1A, e.g. 7 watts. For the values mentioned, we waste more than we use. This is what LM338 is doing, so depending on input and output, the efficiency can sometimes be terrible. Its a linear regulator, good ripple control, but losses ca not be controlled.
This is where smps comes into play. To get 5v from 12v, the switchmode regulator will keep interrupting the voltage with a duty cycle D. The energy released in the on cycle gets stored and released in energy devices which are inductors and capacitors. And the amazing trick is that inductors and capacitors have zero losses so the system is basically quite efficient especially across big differentials. Because input is on for D time and its off for (1-D) time, the output will average down to less value than input, according to the duty cycle D. Turning input on and off and have energy stored and released all the time is brutal behaviour, so even if there will be good capacitors on output, the ripple cannot be as good a linear ones. But the losses can be controlled, e.g. it is possible to see where losses come from and can take appropriate measures to reduce those losses. Sometimes depends on operating frequency or switch implementation chosen, there are trade-offs to do, but things are quite manageable.
The computer ATX psu (power supply) is a smps (switched mode power supply), from mains power down to its outputs. First, it rectifies the ac input to dc directly, like 300vdc and then scales that down to 12v, even multiple outputs, and does that with some efficiency in the range of typically say ~75-85%, and provides tens of amps at that value, which is quite amazing. Compare that to a regulator approach which if we want 12v@1a, the linear regulator would have to dissipate heat for the entire difference of 288v@1A, which is to say not really feasable. We cant get around with dissipating 288watts for each amp we want at 12v. That is the role of smps supply and why it is necessary.
If you want to build your own psu that is great. Easy diy, if you have an dead or defective UPS unit you can use that transformer, with that case, slap a diode bridge and some caps, and after caps feed directly to steppers, maybe to hotend and perhaps even to hot bed (if trafo is powerful enough, but probably wont be). The if you want a regulated 12v, perhaps for supply of uC, then you can use a LM338 or equivalent and even if its linear it will only have to provide a small amount of amps so it wont dissipate much. As long as most power is drawn right after the filter capacitors, and only a fraction passes through LM338, then it would be easy to get efficiency even higher than of a smps. I think its a great starting project to do and can learn quite alot from it. Have fun.
For dc, if you have 12v input and you want to get 5v output with 1A consumption, you will have to dissipate as heat the difference of 7V * 1A, e.g. 7 watts. For the values mentioned, we waste more than we use. This is what LM338 is doing, so depending on input and output, the efficiency can sometimes be terrible. Its a linear regulator, good ripple control, but losses ca not be controlled.
This is where smps comes into play. To get 5v from 12v, the switchmode regulator will keep interrupting the voltage with a duty cycle D. The energy released in the on cycle gets stored and released in energy devices which are inductors and capacitors. And the amazing trick is that inductors and capacitors have zero losses so the system is basically quite efficient especially across big differentials. Because input is on for D time and its off for (1-D) time, the output will average down to less value than input, according to the duty cycle D. Turning input on and off and have energy stored and released all the time is brutal behaviour, so even if there will be good capacitors on output, the ripple cannot be as good a linear ones. But the losses can be controlled, e.g. it is possible to see where losses come from and can take appropriate measures to reduce those losses. Sometimes depends on operating frequency or switch implementation chosen, there are trade-offs to do, but things are quite manageable.
The computer ATX psu (power supply) is a smps (switched mode power supply), from mains power down to its outputs. First, it rectifies the ac input to dc directly, like 300vdc and then scales that down to 12v, even multiple outputs, and does that with some efficiency in the range of typically say ~75-85%, and provides tens of amps at that value, which is quite amazing. Compare that to a regulator approach which if we want 12v@1a, the linear regulator would have to dissipate heat for the entire difference of 288v@1A, which is to say not really feasable. We cant get around with dissipating 288watts for each amp we want at 12v. That is the role of smps supply and why it is necessary.
If you want to build your own psu that is great. Easy diy, if you have an dead or defective UPS unit you can use that transformer, with that case, slap a diode bridge and some caps, and after caps feed directly to steppers, maybe to hotend and perhaps even to hot bed (if trafo is powerful enough, but probably wont be). The if you want a regulated 12v, perhaps for supply of uC, then you can use a LM338 or equivalent and even if its linear it will only have to provide a small amount of amps so it wont dissipate much. As long as most power is drawn right after the filter capacitors, and only a fraction passes through LM338, then it would be easy to get efficiency even higher than of a smps. I think its a great starting project to do and can learn quite alot from it. Have fun.