Power Switch Basics - Page 1
Forum section: electronics / beginners

author: vulturebetrayer
author_rank: Contributor
timestamp: September 11, 2016, 01:11:56 am
content: Hello folks. I have successfully built a 12 volt power supply based off the following tutorial:http://www.instructables.com/id/Make-a-simple-12-volt-power-supply/I am using the following schematic:NOTE: the schematic in the instructables page had incorrect pin layout numbers for the 7812, I have corrected these to what is stated on this site:http://www.researchcell.com/electronics/7812-pin-and-circuit-diagram/I have this working to power a simple 12 volt fan that will be used to filter solder smoke out of the room.What would be the best way to include a power switch safely? Currently I can just plug it in and everything works fine. I'm not sure if I should wire after the transformer or before, and also if I should put a fuse (i'd like to) and what type of fuse I should use. I currently have a 1 amp 250 volt fuse with a fuse block sitting on an old parts board I could use, would this be good enough? If so, what would be the best configuration to wire this safely?parts include:14.5 volt DC 470 mA transformer4 1N4003 diodes2 100nF caps1 4700 uF cap1 1 uF cap1 LM7812The fan is pulling 12 volt dc at .16 amp.The output I'm seeing on this supply is around 11.68 volts.Also the LM7812 tends to get pretty warm, what are some good light cheap heat sinks I should consider?Thanks for reading and for any help you can provide this noob.edits: added 120v notation to schematic, renamed resistors to diode

author: basinstreetdesign
author_rank: Frequent Contributor
timestamp: September 11, 2016, 01:43:13 am
content: Congratulations on building a working power supply!Sure a switch should be included. It should be put before the transformer. It should be wired into the LIVE side of the mains supply with the other end of the Xfmr primary connected to the NEUTRAL side. If you built this into a metal box then, of course the safety ground wire is to be screwed to that and also the 0V side of the load if you want.If the switch you choose is a "double-throw" type make sure you connect the mains side NOT to the center common pole but to one of the two outer poles. The center pole then goes to the circuit. This prevents the other unused pole from becoming live when your box is switched off.A fuse is a very good idea, if not mandatory in your country. It should be the first item downstream from the switch. If you use a panel-mounted fuse holder, the live wire from the switch then should connect to the least-accessible terminal of the holder. The other then goes on to the transformer.The fuse should be a fraction of an Amp and (I believe) it should be a Slow-Blow type since when the switch is turned on the transformer and filter cap will draw several times the load for a fraction of a second before settling out at equilibrium. The 1 A fuse you have now would allow 250W to be dissipated downstream before blowing and that could be a lot of smoke.As for a heat sink, for a couple of watts dissipation look locally for something like this:http://www.digikey.ca/product-detail/en/aavid-thermalloy/534202B03453G/HS405-ND/1625685or this:http://www.digikey.ca/product-detail/en/aavid-thermalloy/7023B-MTG/HS410-ND/1625509If you have to dissipate more, like 5-10 watts, then maybe:http://www.digikey.ca/product-detail/en/aavid-thermalloy/529802B00000/HS276-ND/373764If you can peruse a local junk shop or electronic discount place then you should be able to pick up something for less than $1BTW: the 1N4003's are diodes not resistors, of course.Tim

author: vulturebetrayer
author_rank: Contributor
timestamp: September 11, 2016, 01:49:09 am
content: Wow, Tim, that explained everything very well for me.No idea why I called the diodes resistors. . . I think I had resistance on the brain for some weird reason, modified original to reflect in case someone new tries to duplicate this.Thanks a bunch.

author: basinstreetdesign
author_rank: Frequent Contributor
timestamp: September 11, 2016, 02:05:58 am
content: Umm, did you actually use a 240V to LV transformer? If so it will deliver only half of its rated voltage to the caps. This is still OK if that's good enough to keep your 7812 in regulation. What voltage comes out of the secondary? 35VAC would be too high for the 7812 as that would result in over 45 V on the caps and blow the 7812 if not the caps too.

author: basinstreetdesign
author_rank: Frequent Contributor
timestamp: September 11, 2016, 02:12:11 am
content: Quote from: basinstreetdesign on September 11, 2016, 01:43:13 amI should have said 120 Watts in stead of 250 W since I now realize you are in the states with 120 VAC mains not 240VAC.

author: vulturebetrayer
author_rank: Contributor
timestamp: September 11, 2016, 02:15:10 am
content: Quote from: basinstreetdesign on September 11, 2016, 02:05:58 amNo, I used a 120v 60hz transformer, the original schematic called for 240v transformer, but I knew that was not for US mains.updated schematic to reflect the change

author: exmadscientist
author_rank: Frequent Contributor
timestamp: September 11, 2016, 11:05:33 pm
content: Quote from: basinstreetdesign on September 11, 2016, 01:43:13 amNo -- the fuse should bebeforethe switch, not after it! In general you want the fuse as close to the mains outlet as you can get it, so it can protect you from as many faults as possible. Switches do fail and if and when something goes wrong there (clumsily-held multimeter probe accidentally shorting switch live terminal to ground, anyone?) you want the fuse to be able to protect you.The best option is an all-in-one AC inlet, combining IEC 60320 socket, fuse, mains switch, and sometimes a line filter, but that requires designing around such a module from the beginning and as such usually is not easily retrofitted. I also like to have a neon indicator or similar immediately downstream from the switch so you can easily see when the device is energized with mains voltage.

author: vulturebetrayer
author_rank: Contributor
timestamp: September 11, 2016, 11:09:14 pm
content: exmadscientist can you do me a favor and link some of these all in one AC inlets please?Thanks for the heads up.I haven't built the switch yet as I'm working on some 555 experiments this week.I'm also going to redo the entire board in a different manner using better soldering techniques as if I were to show you guys a pic of this jallopy you'd hang me.

author: exmadscientist
author_rank: Frequent Contributor
timestamp: September 11, 2016, 11:21:29 pm
content: Something like this would do just fine:http://www.digikey.com/product-detail/en/schurter-inc/DD11.0113.1110/486-1277-ND/1646863. (I am not necessarily recommending that specific part. There are many options available in that category on Digi-Key. Search around to find something that fits your particular needs. Note that fuseholders may or may not have a separate orderable part number.)

author: vulturebetrayer
author_rank: Contributor
timestamp: September 12, 2016, 01:47:25 am
content: wow! I had no idea you could even buy something like this in this kind of package.This is a beauty, I'll dig around to find one that fits to my needs, but this is a really neat idea and should save me loads of time as well as make it much safer.Since my enclosure is all plastic, how would you recommend attaching the ground wire?My enclosure is completely plastic, so I was thinking of just putting a little metal piece on one of the side walls and just grounding to that.

author: basinstreetdesign
author_rank: Frequent Contributor
timestamp: September 12, 2016, 02:00:21 am
content: Quote from: exmadscientist on September 11, 2016, 11:05:33 pmI stand corrected.Tim

author: mariush
author_rank: Super Contributor
timestamp: September 12, 2016, 02:55:01 am
content: 7812 gets hot because there's a low of power that needs to waste to bring the voltage down to 12v.Linear regulators like 7812 take a voltage above their output voltage and output the lower voltage and the difference is dissipated as heat. In the case of 7812, the datasheet of various 7812 regulators made by various companies specify the "dropout voltage" as 2v at 1A of output current. Naturally, if you're powering only a 0.2 A fan, the dropout voltage will be a bit lower, but it's a good idea to be conservative and just assume 2v.So let's go step by step.Your transformer will output 14.5v AC, probably at full load, when something uses those 470mA the transformer is capable of. At low current amounts, the transformer probably outputs a bit higher voltage, something like 15-16v AC could definitely be possible.But let's just go with 14.5v AC to keep things simple. When the AC voltage is rectifier by the bridge rectifier formed by the 4 1n4003 diodes, you get a DC voltage with a peak level of 1.414 x Vac = 1.414 x 14.5v = 20.5 volts but there's also some voltage drop on the diodes in the bridge rectifier. At any moment, the current flows through two of the four diodes in the bridge rectifier so the peak voltage drops a bit. If you look at ageneric datasheet for 1n400*, you can see on page 2 first graph that the forward voltage of such diodes is about 0.9v at 1A, so you can just substract 1.8v from the peak dc voltage of 20.5v, and you end up with 18.7v ... let's just round it up to 19v for easier math.The maximum current the transformer could output can be approximated with the formula I peak dc = ~ 0.62 x I peak AC = 0.62 x 0.47 = 0.29A .. let's just say 0.3 ASo basically, right after the bridge rectifier, you have a DC voltage with a peak voltage of 19v and up to 0.3AThe capacitor after the bridge rectifier helps keep the minimum DC voltage above a certain threshold. The formula for this is something like this :Capacitance (in Farads) = Current (A) / [ 2 x AC Frequency x ( V peak DC - V minimum DC) ]so since you're in US you have 60 Hz mains frequency, and we agreed that we want the voltage to be at least 14v DC all the time, and since the transformer is estimated to output up to 0.3A we can now safely estimate the capacitor size required :C = 0.3 A / ( 2 x 60 x (19-14) ) = 0.3 / 120 x 5 = 0.0005 Fards or 500uF.So you see, here's the problem in your circuit. Since you used a 4700uF capacitor, the minimum DC voltage that the linear regulator sees is always much higher than needed, which means more energy has to be wasted on the regulator to produce 12v.Let's go backwards and see what's the minimum voltage with the 4700 uF :0.0047 Farads = 0.3 A / 120 * (19-Vmin) ==> 0.0047 * (19-Vmin) * 120 = 0.3 => (19-Vmin) = 0.3 / (120 *0.0047) ==> 19-Vmin = 0.3 / 0.564 = 0.531 ==> Vmin = 19 - 0.3 = 18.7So basically, the linear regulator always has over 18.5v on it, and since it outputs up to 0.2A to the fan, it needs to dissipate (18.5-12) * 0.2A = 1.3 watts of power , and that's why it gets hot.So the easiest fix would be to replace your big capacitor with something smaller. A 820uF or 1000uF capacitor would be more than enough considering the maximum current capability of about 0.3 A and the minimum voltage requirement of 14v.---later edit.As for the fuse .. since you say it's a 14.5v Ac 0.47A transformer , you're in US so you have a ratio of 110 / 14.5 = ~7.58 , so the current drawn from mains will be 0.47 / 7.58 = 0.062 A , so less than 100mA.Of course, when you plug the transformer in the mains for a very short moment, that capacitor after the bridge rectifier behaves like a short circuit and pulls a lot of current filling up, the bigger the capacitor the worse it is. So you need to account for that when you choose a fuse, and the easiest way is to just get a TIME DELAY fuse, which will tolerate higher currents for a few ms, before it blows up.So since your current will be at most under 0.1, even accounting for shorts and everything else, a 0.2A .. 0.25A time delay fuse would probably be suitable.--Mains plugs .. there's loads of them on Digikey as you already saw. There's also plain ac plugs likethis oneor plugs with built in fuse holder likethis onebut considering this is just for powering a fan and that it's probably gonna be in a plastic or wood case, you may preferC8 connectorsmore (the mickey mouse connectors), they're tinier and there's thinner ac cables available, but the downside is they don't typically have fuse holders so you'd have to put fuse holder separately on pcb or on case.Digikey (same store i linked to in post) has fuse holders, has fuses, has anything you may need.--later later edit: someone suggested there should be a on/off indicator. That's actually a great idea, since it's not mentioned but most linear regulators do need a bit of minimum load to be happy, so it wouldn't hurt to have something like 0.5 mA on the linear regulator all the time.Easiest indicator would be to put a led on the output of the linear regulator, but you'll need to limit the current going through the led otherwise it would blow up.Red leds have a forward voltage of about 2v so for 12v power supply and 0.5mA current, you're looking at : Vdc - Vforward = current x r => R = (12-2) / 0.005A = 2000 ohm , so probably 2200 ohm resistor would work perfectly fine. The power dissipated in the resistor will be I*I*R = 0.005*0.005*2000 = 0.05 watts, so even a tiny basic 0.125w resistor will be just fine.Red leds are very efficient and even at 0.5mA they'll light up enough to give you nice indicator and not to blind you up.later later later edit : the 1 uF capacitor on the output of 7812 in the picture is just ridiculous. A 0.01 or 0.1uf ceramic is recommended on the output, the 1uF is kinda pointless. If you add capacitance on the output, you may just as well add a 33-47uF or a 100uF electrolytic capacitor, it would be more useful.

author: Brumby
author_rank: Unknown
timestamp: September 12, 2016, 07:37:57 am
content: This was said so clearly that I felt it worthy of repeating...Quote from: exmadscientist on September 11, 2016, 11:05:33 pm