I want to take a short dive into line-operated power supplies. The details of building one vary with the requirements, but they're well within the range of things amateur builders can design, build and get running. For low power supplies, say the 1 to 2 amp supplies that you might be familiar with for little things around your house, there are literally less than 10 parts in the entire thing. More parts are required for something like that 12V 20 to 30 amp supply, but aren't really much more complicated, conceptually.
Broadly speaking, power supplies can be divided into two kinds: linear and switching. Linear supplies use components called voltage regulators which are analog components; that is, the voltages and currents in them and through them are smoothly varying, continuous in time. These regulators operate like the feedback circuits I've talked about before. Somewhere inside the regulator is a reference voltage. The output voltage is compared to this reference continuously, producing an error signal that causes the circuit to turn the voltage up if it's too low and turn it down if it's too high.
Switching regulators, as the name implies, use switching techniques to change the input voltage to the output voltage, so they're on-off circuits more like digital than analog. They use components called regulators as well, but they work on different principles; a very common technique is Pulse Width Modulation. Briefly, the switched on/off voltage they're producing gets filtered into clean DC, and if it the voltage runs too low, they keep the pulses on longer (so that they're wider) and if the voltage is too high, they turn the pulses off sooner (making them narrower) reducing the output voltage.
The advantage of switching regulators is they tend to be more efficient, sometimes reaching efficiencies of 85 to 90% or higher. The linear regulators are lower efficiency. That might matter to you for running things when the grid is down and you're trying to stretch every watt you can produce. The advantage moves over to the linear regulator when you want an electrically "quiet" regulator. The fast switching voltages in the switching reply produce broad spectrum electromagnetic interference (EMI). Nevertheless, I can assure you that every system I worked on in military, space and commercial aviation for the 40-ish years I worked in those fields were switching power supplies. Their drawbacks can be designed around. After almost 30 years using the same linear supply in my ham station, I switched to a switching supply 15 months ago and haven't heard it on the receiver at all.
The biggest advantage of the linear regulators for the hobbyist and experimenter is that they are incredibly easy to use. How easy? How about "just add two parts?"
This example is based on the series of parts called the "seventy eight hundred" series. The last two digits are the voltage. Over the years they've been produced (since the late 1970s) they've been produced in 5V (7805) 8V (7808) 12V (7812) 7815 and more. Furthermore, they're available in different packages and can deliver different currents depending on the package they're in. They're the 78L series (low power) 78M series (medium power) 78P (high power) series, for example. There's also a 79XX series for negative voltages.
The bigger the case, the more power dissipation the part can handle. The TO-3 (TO is from Transistor Outline) is the highest power (78P05, for example) while the TO-92 would be the lowest power 78L05.
What makes these so easy to use is they're extremely rugged; they've been designed to handle anything that could happen to the regulator. Too much current? It'll shut down, and then turn on again periodically to see if the condition cleared. You could short the output to ground and it will just stay shut down until the short is removed. If you over heat the part by drawing too much current, it just shuts down. If you see the power turning on and off, that's the first thing to suspect.
Practically, the input voltage will be coming from a transformer that drops the wall voltage down to "a few" volts above the desired regulator output voltage, rectified with a diode bridge and filtered with a large capacitor (although not as large as if there were no 78XX regulator there). It never hurts to read the datasheet, and the sheets for these, along with other design notes and help, are extremely widespread on the 'net. The power dissipation in the regulator is the voltage drop across the regulator times the current it's delivering, so say you're putting 8V into a 7805 putting out 5V at 1 Amp; that dissipation is 3W (8V-5V)*1A.
That's not all in the world of linear voltage regulators; there are adjustable regulators - and ways to make the 78XX series adjustable, too. There are higher power regulators, and ways to make higher power with lower power regulators. There are regulators optimized for lower voltage drops across the part, Low Drop Out or LDO regulators, so that instead of putting 8V into a 5V regulator you'd use 6V or 5.5V (depending on the part).
It's literally an entire world of circuit design open to anyone interested in making something useful.