Designing a Time Delayed Relay

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Sure, PIC12F675 is fine, might even be better as it is a slower clock speed, less susceptible to poorly designed PCB's :rolleyes::p

And now the ever poorly understood ground/neutral questions...

On the schematic we are using neutral line on 110v for our ground reference on the pic and 0V rail. I assume that I should only include the ground wire from the mains to the box to ground the box, but the board should be left floating? If this is correct (I assume this because neutral and ground are tied in the can) then I should spec 2 pin connectors or as you mentioned multiple smaller ones to make up the rating.

Trace lines - is there a mathematical way to determine trace width needed to service x amps? Do I convert circular mils from standard wiring practice to a flat trace and de-rate somehow because of the short distance traveled?

Thanks!
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
On the schematic we are using neutral line on 110v for our ground reference on the pic and 0V rail. I assume that I should only include the ground wire from the mains to the box to ground the box, but the board should be left floating? If this is correct (I assume this because neutral and ground are tied in the can) then I should spec 2 pin connectors or as you mentioned multiple smaller ones to make up the rating.
Right. Ground the box if it's made of metal, or use a good thick plastic box. All three of the connectors to the board need to have two conductors, but the current monitoring input and the relay contact output should have many pins per conductor unless you use really big meaty connectors. I think smaller connectors will work out cheaper and may be easier to work with, despite the extra wires needed.
Trace lines - is there a mathematical way to determine trace width needed to service x amps? Do I convert circular mils from standard wiring practice to a flat trace and de-rate somehow because of the short distance traveled?
Google PCB trace width calculator. The copper thickness is also a factor; I suggest you go for the "thick copper" option, although this may make it a bit harder to solder the SMT components, and put matching copper on both sides of the board for the high current areas. You may need thermal reliefs for the connector pins. This is another reason in favour of connectors with many smaller pins - they will be easier to solder in place.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Great! Thank you. I found some other interesting information about thermal reliefs. The poster claims there is only a 90 microhm difference on a 1oz board created by the thermal relief - at 30 amps. Would that be acceptable?

I found a 2 oz. copper double sided FR4 for a fair price, do I need to look at the 4oz instead?

If I want to add a LED to indicate that the circuit is live, can I simply tap off the +24v rail and add a resistor to bring the voltage down to the LED's requirement? For instance, if the LED requires 2.2v and 20mA should my resistor be 1100ohm (rounded up)? Will the rail still be able to provide enough current for the rest of the circuit? (I could only figure out the draws of the LED @ 20mA, ACS7 @ 13mA, PIC was 100microA, relay 16.7mA)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Great! Thank you. I found some other interesting information about thermal reliefs. The poster claims there is only a 90 microhm difference on a 1oz board created by the thermal relief - at 30 amps. Would that be acceptable?
Yes!
I found a 2 oz. copper double sided FR4 for a fair price, do I need to look at the 4oz instead?
No. 2 oz should be fine, if you make the high-current traces wide and on both sides.
If I want to add a LED to indicate that the circuit is live, can I simply tap off the +24v rail and add a resistor to bring the voltage down to the LED's requirement? For instance, if the LED requires 2.2v and 20mA should my resistor be 1100ohm (rounded up)? Will the rail still be able to provide enough current for the rest of the circuit? (I could only figure out the draws of the LED @ 20mA, ACS7 @ 13mA, PIC was 100microA, relay 16.7mA)
It's better to add the LED in series with the power supply. That will mean it will glow brighter when the relay is ON, which might be a good thing. Here's an updated schematic. I've also shown the connectors (but not the multiple terminals on CN2 and CN3) and I've highlighted the high-current paths.

268425.004.GIF

The LED is a bit vulnerable but I doubt there will be a problem. The diode connected across it protects it from reverse voltage, and the 220 ohm resistor will take some of the current. Choose an LED that's rated for at least 50 mA.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Thanks for highlighting those areas Kris, it confirms the areas I had confined on some of my tries at pcb layout. I am currently stuck! Eagle software is not easy.
I am getting 12 warnings when I run the ERC. Two types of errors, 1. net N$x overlaps pin and 2. only one pin on net N$x. I have highlighted the affected areas. The SOIC is the cause - it seems all of its pins have the overlap issue once that issue is resolved I am sure the other issues will disappear as well. I redrew the SOIC on 0.1 grid as that was an issue for my connectors as well. I erased the existing devices on the schematic and loaded new ones with the updated grid spacing. I even went so far as to redraw the ic device again with more spacing but I am still getting the errors and its preventing me from redoing the layout!
As for the LED - I used a 2 pin molex to allow it to be placed on the cover of the box - and to be serviceable. Isn't the potential across the LED's leads in the schematic 110vac? Do you have a source for 50mA LED? I did some searching but couldn't find anything on digikey that wasn't smd. I find many LED's on ebay - very inexpensive, but most are 20mA.

Picture_zpsa0b7ef5c.png
 
Last edited:

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I can't help with the Eagle problem. They have a forum on their web site don't they?

No, the voltage on the LED is 24V. The Everlight MV5053 is a 5 mm red LED, rated for 100 mA maximum continuous current. http://www.digikey.com/product-detail/en/MV5053/1080-1099-ND/2675590

I will check it out there.

I thought the voltage became 24v after the IC. Are there any tips in learning how to determine the potential between areas?

Thanks for finding that! I was looking in the wrong categories - getting panel lights etc.
As soon as I can fix my Eagle issue, I will post what the pcb may look like and perhaps you can help me troubleshoot it :)
Thanks again.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Eagle support responded, but the help indicated didn't resolve my issue. I ended up redrawing the entire schematic as well as the redeveloping the two devices I built and it worked. Long learning curve for a hobbyist, but learning a lot along the way so thank you for your patience!

Results - I was able to spec everything out and have completed a BOM. Here is the PCB layout.

I have to learn how to create planes of copper fill areas for certain routes. I thought it would be smart to do a ground plane on the bottom layer, but wasn't sure about which components could be placed there aside from one lead of D4, R4 and one post of terminal 1.

What would be the intelligent way of approaching plane construction so that there are fewer traces?

pcb_zps7ffa470f.png
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I played with a few more iterations and I was able to get ground planes and power pads set up. I was trying to set up some traces with a star topography, but couldn't get it to workout. This is the result of some hand layout and some autorouter. What do you guys think? Does it need more revision or is it ok? The blue is the ground plane the red pads are the high current area. Thanks in advance!

3c_zps0bffd2d0.png
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I found this on the Allegro's chip spec sheet "The Allegro evaluation board has 1500 mm2 of 2 oz. copper on each side, connected to pins 1 and 2, and to pins 3 and 4, with thermal vias connecting the layers." After reviewing the layout above, I felt the pads were not sufficient!
I used the top (red) layer for the right terminal of the connector (top left corner). For the left terminal, I created a smaller top layer polygon and then created a larger bottom layer and stitched them together with some vias (wasn't sure if the one leg from the through hole of the terminal was enough).

Will this area start to emit RF or other interference? I have the decoupling cap directly next to the IC and I spaced the ground plane and other components away, but I have no experience to make that call. Any other critique/tips on layout would be welcomed as well!
Thanks in advance.


6d_zpsa9c35a9f.png
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
OK, my suggestions re the layout.

The paths from CN2 to the Allegro chip need to be THICK and should be duplicated on both sides. Also, when you get the board made, make sure it has plated-through holes. (That should be standard for double-sided boards.)

For the connector pins, you will need thermal relief on both sides, and I would use a grid of vias around the pins, with holes around 50 thou. And I thought you were going to use a connector with lots of pins to improve the current-carrying capability, for the high-current circuits.

The connections to the IC pins should be made with tracks the same width as the pads, only in the direction away from the IC, and joining onto the large copper areas from the connector a few mm away to provide some thermal relief for the pads, and vias as well. Actually you can continue those tracks through the pads and into vias as well, going through to copper on the other side.

Connections to the other side of the Allegro chip should all flow away from the IC (don't have that track running off to pin 3 of the PIC). Tracks from the decoupling capacitor to the GND and VCC pins of the Allegro chip should be the same width as the pads, to minimise impedance.

The relay should be done the same way, but with identical fat tracks on both sides. It would be better to use a relay with the contacts at the opposite end of the coil, but in any case, keep the tracks from both sides well clear of each other, i.e. don't run the track from the contact at the top right corner between the two pads at the bottom left. Those tracks are FAR too thin.

Again, I thought we were going to use a connector with lots of pins to share the current. Are you planning to use Phoenix Combicon connectors or something similar? In that case I would use a 6-pin for the Allegro chip circuit and an 8-pin for the relay contact circuit, or 8-pin and 10-pin respectively, to prevent confusion, and a 2-pin connector for CN1.

If Eagle has netlist capability, use the ratsnest while you're placing components to optimise the positioning to keep the fat tracks short and direct. If you need to swap pins, either edit the netlist (if the PCB editor has that feature) or edit the schematic and regenerate and re-import the netlist.

There are three high-voltage sections and they should all be kept towards the outside of the board. The microcontroller should be near the middle of the board, or in an isolated corner as you currently have it.

For the input power supply, everything up to the output of the bridge rectifier should be considered live - the diodes should all be in a row, and they should straddle the isolation barrier. That's not exactly true for this design but it's the simplest way to explain it.

There's no need for a groundplane although you could use one in the low-voltage circuitry area. Don't use one in the high-voltage sections!

BTW the schematic in post #44 has two CN1s. I've changed the ICSP connector name to CN4.

Also, check that the BC517 has the same pinout as the MPSA42.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Thank you for the suggestions Kris! The connectors were chosen because of space constraints and power handling capabilities. I will redraw and create new devices and see if I can squeeze in a 6 or 8 pin for the Allegro.

The relay is switching 120v 15A - can I get away with a smaller connector here or do I have to move up to a 4 pin or 6 pin?

Do you have any suggestions on connectors that you would use?

You lost me on the BC517 and MPSA42 - we have a MPSA14 at the end of the line helping to trigger the relay I believe, but what are you referring to?

Thanks again :)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
The relay is switching 120v 15A - can I get away with a smaller connector here or do I have to move up to a 4 pin or 6 pin?

Do you have any suggestions on connectors that you would use?
I suggest the Phoenix Combicon MSTB series. These are pretty widely used and there are several brands who make knock-off versions. The plugs have rising clamps so they won't mangle the wires. Here are some specific suggestions:

For the AC input to the circuit:
http://www.digikey.com/product-detail/en/1755736/277-1150-ND/260518 2-pin vertical header
http://www.digikey.com/product-detail/en/1757019/277-1011-ND/260379 2-pin plug
For the Allegro chip current monitoring circuit:
http://www.digikey.com/product-detail/en/1755778/277-1154-ND/260522 6-pin vertical header
http://www.digikey.com/product-detail/en/1757051/277-1015-ND/260383 6-pin plug
For the relay contact circuit:
http://www.digikey.com/product-detail/en/1755794/277-1156-ND/260524 8-pin vertical header
http://www.digikey.com/product-detail/en/1757077/277-1017-ND/260385 8-pin plug
Those connectors are rated for 12A per pin but it's never a good idea to operate components at or near their rated maximums. The AC input to the circuit needs very little current, so a 2-pin connector is fine, but for the the other two circuits, I would use at least three pins per side, which is why I suggest 6-pin and 8-pin connectors. You could use 6--pin for both, but then you could get the plugs swapped. That wouldn't cause a problem, but it's better to avoid confusion.

You lost me on the BC517 and MPSA42 - we have a MPSA14 at the end of the line helping to trigger the relay I believe, but what are you referring to?
Your PCB in post #52 has Q1 labelled as a BC517.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
For the Allegro chip current monitoring circuit:
http://www.digikey.com/product-detail/en/1755778/277-1154-ND/260522 6-pin vertical header
http://www.digikey.com/product-detail/en/1757051/277-1015-ND/260383 6-pin plug
For the relay contact circuit:
http://www.digikey.com/product-detail/en/1755794/277-1156-ND/260524 8-pin vertical header
http://www.digikey.com/product-detail/en/1757077/277-1017-ND/260385 8-pin plug
Those connectors are rated for 12A per pin but it's never a good idea to operate components at or near their rated maximums. The AC input to the circuit needs very little current, so a 2-pin connector is fine, but for the the other two circuits, I would use at least three pins per side, which is why I suggest 6-pin and 8-pin connectors. You could use 6--pin for both, but then you could get the plugs swapped. That wouldn't cause a problem, but it's better to avoid confusion.
.

Do you mean the 8 pin for the Allegro circuit as that will have the 220, 30a passing through it vs. the relay portion will only be switching 110, ~15a? This is the part I was spec'ing (20a per pin)

Thanks for the recommendation, but I think for the price I will use multiple 2 pin units! I will draw a new layout in a few days.


Your PCB in post #52 has Q1 labelled as a BC517.
Ah! Sorry, I forgot I used a generic package just for the physical size! - Ignore that, thank you :)

I noticed on the schematic from Allegro that they use a 1 nano farad cap while in our schematic you have a value 100 times that for filter to ground pins 5 and 6. I assume this was for ease of construction and that the higher capacitance doesn't affect this portion of the circuit.
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Do you mean the 8 pin for the Allegro circuit as that will have the 220, 30a passing through it vs. the relay portion will only be switching 110, ~15a? This is the part I was spec'ing (20a per pin)
http://www.digikey.com/product-detail/en/1987724/277-9146-ND/2513900
OK. If the Allegro circuit needs a higher current rating than the relay, then swap them round.
Thanks for the recommendation, but I think for the price I will use multiple 2 pin units! I will draw a new layout in a few days.
I wouldn't do that. I would keep all the connectors different so there's no chance of confusion. Also I would stick with a known good quality brand. But of course it's up to you.
I noticed on the schematic from Allegro that they use a 1 nano farad cap while in our schematic you have a value 100 times that for filter to ground pins 5 and 6. I assume this was for ease of construction and that the higher capacitance doesn't affect this portion of the circuit.
It does affect the bandwidth of the Allegro chip but since you're only using it at 50 Hz and we're only using it to detect the presence or absence of current, that's fine. If anything it will make it a little bit less susceptible to detecting noise or interference.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
50 thou looks large for the plated through hole, should I be concerned with structural issues placing a grid around the through holes of the connectors?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
No, no problem with structural issues. But you could reduce the vias to 40 thou or 35 thou. It depends on the manufacturer I guess. You just need to be sure the through-plating is good and solid.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I will check that out when I get closer to selecting a fabber. Here is what I was able to do with your input, let me know if I need to rework it or if I am getting closer. Very little was done with autorouter - just the thin lines - 10 thou is a bit thin for a trace, no?

8b_zps4b064db3.png
 
Top