I am working on a circuit for a microcontroller and the device needs 3.3Vdc. I also need to energize some relays. These can be either 5Vdc or 12Vdc to energize. I have US AC in which is 125 Vac.
In researching this, I've found that using a transformer to lower the voltage and 4 diodes to create a rectifier will convert the AC to DC and using a huge capacitor in parallel to the DC power will reduce the ripple.
I am seeing more stuff about isolating the DC power supply using a flyback but am getting a bit lost.
So, my first question is other than the simple circuit of a AC in to a transformer to a rectifier to a capacitor to a voltage regulator, do I need more than that? Also, if I need two different voltages, I take it that starting at the higher voltage and then using resistors in series to reduce it is the way to go?
I would normally just find DC from an external power supply to the circuit but in this case the relays are going to be high-voltage so I don't want to power the device with AC and then require an addtional DC in.
I'm old school so I would probably use an AC/DC transformer (120VAC to 12V center tap) then the bridge rectifier and capacitor. I am comfortable with that circuit and it can supply gobs of power if needed and the right components are used.
But then I would use a 5V voltage regulator and a 3.3V voltage regulator to get the final voltages needed (if precision is needed - they would probably take out the rest of the ripple too). If your relay is rated for 12V and minor fluctuations are OK, you could use the output from the power supply directly. Might be cheaper these days to pick up a computer power supply at a flea market rather than buy all the needed components.
There are probably a ton of state-of-the-art hi-tech solutions to this one, but I'm an old fa--.
My friend, John63 is giving you the correct advise. My two cents here is to keep you away from using drop down resistors to correct your power voltage, specially for fluctuating currents. Voltage regulation goes down the drain! Look for the LM12xx regulator series. the do an acceptable regulation job and are very easy to use.
If you are looking for the (plausibly) easiest overkill solution and you have the space.... 179-2268-ND
If you are looking for something fairly easy, and a bit more compact than above, take a look at these AC/DC on board power supplies. I believe most of the products in that link should be isolated, but check the datasheet for sure. I'm not really advocating these solutions over what was suggested by others; I just wanted to make you aware of their existence. Pair that with a 3.3V linear or switcher regulator and you should have a solution.
The other guys have it right. The step-down transformer can be an isolator if the coils are isolated. Most 120-12V transformers have isolation built in. as for regulators consider a buck/boost converter with built in mosfet. Some of them can supply up to an amp and they are far more efficient then regulators though a dollar or two more. all they require generally is an inductor a few caps and a feedback resistor. Some of them even come with multiple outputs and built in feedback lines. 3.3V and 5V's are popular digital levels so these active switchers will be available(remember buck to lower voltage, boost to increase it, the buck/boost or vice-versa are used for batteries that can swing either direction so you can be selective). some of them go one step further and have a built in inductor and only require an external inductor for certain current levels. However keep in mind ISOLATION ISOLATION ISOLATION..... i cannot stress enough how important this is. i personally have some experience with this and would chose a switching power supply like Ben suggested over building one. Remember that they come in smaller sizes its all relevant to current rating
Simple linear regulator circuits should do. Have two taps for the secondary(For 3.3 and 5V, or whatevr required)and use a bridge and 3 pin regulator separetely for both, Dependind on the current requirements the capacitors can be larger or smaller values. The best way to isolate is to have a flating(two pin connection input to the primary and secondary, Dont use the mains ground at all, Also dont tie up the Dc ground to AC ground, You may get noises, if you can put up with it,
Depending on how much current you need, and if you don't need isolation from the AC lines, you may find that small/cheap transformerless power supply + relay is a good fit. I recently made a prototype of my own to interface to my MSP430 Launchpad:
You can find more information about the board here. The supply shown can drive 3 relays simulatenously, but I've selected relays with 24V coils specifically to reduce the current consumption, and to keep the cost of my prototype low, this board only has one relay. It is a simple change of a zener diode to have 12VDC or 5VDC out instead of 24VDC out, but the current limit (about 30mA) stays the same, so you can't drive as many relays unless you can find some really low coil current devices. The second rail (3.3VDC) is actually a >6VDC rail with a 3.3V LDO, so that can easily be adapted to 5V if desired, and that 6V rail is also just a zener change away from being a different voltage. To get the dual output voltages, this particular circuit wires the return of the 24V out to the high side of the >6VDC rail, so I use an optocoupler to cross that boundary, letting the microcontroller drive the relay. This could also be done by using a small voltage regulator chip or two to step down a single output to a lower voltage level, but this is slightly more effort and I just haven't gotten to that point yet-- the nice part about doing that is you can support even more current (upwards of 100mA) at the lower voltage levels that way. For now, with my application of using a low power microcontroller to drive low coil current relays (that support a reasonable 7A of 120VAC through the contacts, and I also provided holes to support a 15A 120VAC relay), this approach seemed to fit best.
Of course, if you need electrical isolation from the mains, this type of circuit should be avoided unless you just need I/O isolation which can be provided from optoisolators/icouplers/etc. For more information on designing transformerless power supplies in general, Microchip put out a application note that covers a lot of the bases.