PCB design with 5v and 120v - Page 1
Forum section: electronics / projects

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 10, 2024, 07:27:46 pm
content: Hi, I've only designed 2 or 3 PCB's ever and this project includes 120v AC, which I have not worked on with a PCB before. I was hoping to find out if this is safe or if there is anything I should be doing differently.This project uses a 5v Trinket to turn a 120v vibratory pump on to a specific pressure, then hold it there (an extremely minimal and simple version of the Gaggiuino).I'm planning to do a single sided prototype at home and maybe send it out at a later date after testing for some time. All components are mounted on the top, except a SMD triac that is mounted to the bottomThanks for the help!

author: Ian.M
author_rank: Super Contributor
timestamp: March 10, 2024, 08:05:42 pm
content: There should be no tracks whatsoever under the optocouplers (their pin spacing allowing for standard pads is designed to provide enough creepage and clearance distance but there little or none to spare). Keep *ALL* low voltage tracks and parts to the left of them and all mains tracks to the right of them.How are you going to power the 5V side?

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 10, 2024, 08:28:12 pm
content: Awesome, thanks for that info, I will adjust those traces and repost in a little bit!I think I'm going to use a USB wall wart to power the trinket

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 10, 2024, 08:57:40 pm
content: Any better?

author: Ian.M
author_rank: Super Contributor
timestamp: March 10, 2024, 09:19:49 pm
content: Looks OK from the creepage/clearance safety viewpoint. As long as your circuit design is good, it should be OK.However why not neaten it up a bit so its clearer at a glance to anyone working on it where the division between the hazardous mains and safe low voltage sides is? I'd move the MCT2EM right two grid squares and up one so it lines up with the other opto. You'll also need to move the zero ohm jumper up one. That gives you a straight line running under the middle of both optos, safe zone to the left and 'hot' zone to the right. Mark your proto pcb accordingly.

author: shapirus
author_rank: Super Contributor
timestamp: March 10, 2024, 09:41:00 pm
content: That 10k resistor on the bottom is begging to be turned and placed alongside the other one; or vertically, parallel to the three traces. Or 45 degrees! Its right hand lead is sticking too much in the direction of the high voltage zone, even if the clearance may technically be sufficient.There's a good advice above: lay it out in such a way that it will be very clear at a glance to anyone where the low voltage and high voltage areas are and that they are well separated.Make it so that your leftmost rows of pads of the optocouplers become the rightmost pads of any of the low voltage side. Likewise for the high voltage side. Align the optocouplers vertically along the same axis.You seem to have the luxury of enough space on the board, so why not use it to arrange everything in a neat and tidy way?

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 11, 2024, 01:58:27 am
content: This was all super helpful! Thanks so much!I did take your advise and move them so they are vertically inline and I also moved that resistor to a 45 degree angle.This traces are so small, I'm not sure if I'll be able to make them here at home, but I'm still going to give it a try.Thanks!!!

author: Ian.M
author_rank: Super Contributor
timestamp: March 11, 2024, 03:45:34 am
content: So double the width of all the low voltage traces!Also the TRIAC could do with a lot more copper area for heat dissipation, so put its tab on a rectangular fill extending up from the 'PUMP' trace between the opto and the pump connector (but you'll need a high power soldering iron with a fat bit to solder the tab), and double the width of 'ACL', only necking down to the TRIAC pad width just before the pad.

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 11, 2024, 03:47:53 am
content: Will do! I was messing with Trace width and pad diameter, but I assume I can't change the pad diameter for the AC components, correct?

author: Ian.M
author_rank: Super Contributor
timestamp: March 11, 2024, 04:04:00 am
content: Pads come with the component foot print which is generally a PITA to mess with if you don't have to. OTOH if you can easily use larger pads for the AC side passives and diode, without running into clearance issues, you might as well.

author: floobydust
author_rank: Super Contributor
timestamp: March 11, 2024, 04:38:57 am
content: Don't forget a fuse, OK?

author: tggzzz
author_rank: Super Contributor
timestamp: March 11, 2024, 09:24:50 am
content: Quote from: ImpulsiveJames on March 10, 2024, 07:27:46 pmWhen a teenager, I did something similar with 240V..During testing and debugging, eventually I touched a neutral track with one hand and a component's live metal case with a finger on the other hand. Both biceps instantly and forcefully contracted, breaking contact.A lucky escape.If the muscle contraction hadn't broken the contact, I expect I would be dead. At least nowadays you could (and should!) power your circuit from an RCD/GFCI/ELCB with a <=30mA trip current.

author: shapirus
author_rank: Super Contributor
timestamp: March 11, 2024, 10:57:47 am
content: Quote from: tggzzz on March 11, 2024, 09:24:50 amThese will only protect against current leaking to earth (which isn't even shown in the circuit being discussed), but not when it's flowing between hot and neutral (which will look like any normal load), so high voltage circuits need to employ all practically reasonable safety measures, which basically boil down to "avoid using metal objects which can potentially become connected to hot or neutral, and isolate those you can't avoid". Oh and yes, there is a good reason why an experienced electrician never touches even his wife's boobs with two hands.That said, the mentioned earth leakage breakers should be present in the breaker box anyway.

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 11, 2024, 01:01:06 pm
content: Luckily we are 120v here, so a tiny bit better, but yes, I will try to be careful. Luckily this is going in a espresso machine, so it's not like the whole chassis is metal or there is water and wires everywhereI'll look up the data sheet of the pump and use an appropriate fuse.. Can I probably can't use an 12v automotive fuse huh? I would put the inline with ACL?Thanks!

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 11, 2024, 01:21:16 pm
content: As far as I can tell, the pump uses 50w, so 2.4A. Is a 3A fuse good or is there a fuse calculator out there? This pump should only be on once a day for about 40 sec

author: Ian.M
author_rank: Super Contributor
timestamp: March 11, 2024, 01:49:51 pm
content: The pump *does* have a mains motor (or are you designing this board for sh!ts and giggles)?50W/120V=0.417AHowever motor inrush (starting) current can be an order of magnitude higher so I'd go for a 4A slow-blow fuse, probably 20mm 250V glass. Ideally you'd find space for a clip type fuseholder, but if you cant, one can get push on caps with leads that turn 20mm fuses into axial thru-hole solderable components, and there's certainly enough space for one mounted vertically. Insulate its top lead with small bore sleeving or heatshrink. Glass fuses can rupture if dead-shorted on a mains circuit, so sleeving the fuse body with heatshrink or pushing silicone/glassfiber sleeving over it is helpful to contain the carnage. OTOH you can pay the premium for a ceramic body, sand filled HRC fuse that is far far less likely to rupture, so doesn't need sleeving.Edit: I fubared the units above.Now fixed.

author: shapirus
author_rank: Super Contributor
timestamp: March 11, 2024, 01:51:07 pm
content: Quote from: ImpulsiveJames on March 11, 2024, 01:01:06 pmTechnically you can, but a) test it before you use it; b) still it's better to design it properly and use a standard cylindrical fuse instead, ideally in a ceramic case -- and test this one too.

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 11, 2024, 01:53:02 pm
content: Doh, I did 120/50, I knew 2.4 seemed way high for AC....Slow blow it is. Thanks!

author: tggzzz
author_rank: Super Contributor
timestamp: March 11, 2024, 02:00:54 pm
content: Quote from: Ian.M on March 11, 2024, 01:49:51 pmMy freezer is nominally 90W, but I have seen >1.2kW for between 0.2 and 1s.

author: Jeroen3
author_rank: Super Contributor
timestamp: March 11, 2024, 02:05:54 pm
content: Setup your design rules for minimum distances between net classes.At least 5mm between low and high side.

author: sparkydog
author_rank: Regular Contributor
timestamp: March 11, 2024, 07:52:31 pm
content: Quote from: Ian.M on March 11, 2024, 01:49:51 pmOkay, I'm curious, is there some reason why axial glass cartridge fuses are preferred over radial leaded fuses? The latter are equally available in 250V, take up a lot less board space (and aren't that much taller!), and you can still use them with holders. I've drawn (but not yet built) a number of boards using e.g. Littelfuse 370/372s with 559/560 holders. Are these somehow worse than glass cartridge fuses in clips?

author: floobydust
author_rank: Super Contributor
timestamp: March 11, 2024, 08:23:08 pm
content: For a fuse, non-replaceable I would considerBelfuseMRT or 0697 series, that package. I guess it depends on how well behaved the pump is, if it ever jams and you get nuisance fuse blows. Note a 1A part blows in a few seconds at 2-3A. I think a 4A fuse is too high. Ballpark overload is 2x rated motor current and fuses are rated for the current they will carry forever. 5x20mm fuses are great but take up a lot of room.I have a concern about the triac overheating, it's good to maybe 0.5A using the minimum PCB footprint before, it's too hot. Make the tab copper pad much larger if you can. I don't like tiny triacs like that, they don't any abuse.Your snubber cap 10nF is usually a square part, so I find the footprint might be oddball.

author: Ian.M
author_rank: Super Contributor
timestamp: March 11, 2024, 11:01:16 pm
content: @Sparkydog,Call me biased by too long in the service trade!Axial glass fuses are cheap and nasty for mains use. However *any* repair workshop can be expected to have a good selection of plain 20mm glass fuses, and the push-on axial end caps I suggested, although supposed to be use once can be reused several times. We used to stock both fuses (in fast, slow blow and some values of ceramic HRC), and axial end caps.The various styles of radial fuse are generally much much nicer, and typically are immune to the rupturing problem I noted at typical domestic mains receptacle peak short circuits, but good luck having the correct one in stock for a repair. Sometimes we were able to match up the radial fuse to one we did stock, but often the markings left us guessing about its characteristic, or what we had was a different pin spacing, so we were stuck with closing up the item to get it off the bench, and waiting for a parts order. Spend enough time closing stuff up only to have to strip it down again next week, and you too will develop an irrational dislike for the part causing the delays!

author: ImpulsiveJames
author_rank: Contributor
timestamp: March 12, 2024, 06:13:30 am
content: I'll probably just go inline so I don't have to make the board any bigger.I just realized when I created this, I placed a dc cap next to the pump and that was just wrong. Can anyone recommended a cap for this circuit? Do I use ceramic disk? Do those come in 120v?

author: Ian.M
author_rank: Super Contributor
timestamp: March 12, 2024, 06:30:46 am
content: Traditionally one would use an appropriately rated metallised film or high voltage disc ceramic capacitor for a line voltage snubber. Nowadays, there are a lot more choices, and you may suffer from choice overload! You'll pay a little more for it but any capacitor of the right value with a class X safety rating (for mains line to line or line to neutral applications) will do the job.Incidentally, thru-hole disc ceramic capacitors are available with ratings up to several kilovolts. However with the demise of the CRT TV and monitor industry, many of those are no longer in production, so there's a lot less choice nowadays.