Maker Pro
Maker Pro

Designing a Time Delayed Relay

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Either way is OK.

The optocoupler circuit with the four diodes, in post #19, inserts a voltage DROP of about 2V in each direction. So the motor sees nearly all of the 220VAC. 220VAC corresponds to about 311V peak positive and negative excursions. The motor will see about 309V of each of those excursions. Around the zero crossing point of the sinewave there will be a short period where there is no voltage across the motor. The waveform across the motor is like this (exaggerated):

brokensinewave.gif

It's up to you which way you go. Yes I think the Hall IC is probably the best option. I will draw up the changes some time in the next few days. You're welcome :)
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Thanks Kris! I will keep reading my books on theory, but I still don't understand the path the 220v travels. My confusion begins with the path the voltage follows. For instance on W5 does the wave go to all connected points? i.e. from w5 through r4 and back out to w6 at a reduced voltage, through d7 and d9 back out to w6 or through the tie to d5? Why is there a tie between the four diodes? Thanks again.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Voltage doesn't follow a path. Current follows a path. Voltage is measured between two points, always. Sometimes voltages are quoted at a single point; in this case it is measured relative to the "0V" ("zero volt") rail of the circuit, which is the default reference point for voltage measurement. But voltage is always measured between two points; it's like a distance.

Current in all points in a series circuit is the same, so the same current flows from the 220VAC Phase wire, through the first yellow wire (W5), through the group of four diodes, out the other yellow wire (W6), through the switch for the 220VAC motor, through the 220VAC motor, and back to the 220V Neutral wire. But the voltages across different parts of the series circuit are not all the same.

The voltage between Phase and Neutral is a sinewave at 220V RMS, which alternates smoothly between peak voltages of about +311V and -311V. The current flowing through the diodes produces a voltage drop of around 0.9V across each diode, i.e. 1.8V across the pair. You can determine what this voltage will be from this graph in the data sheet for the diode, which relates the typical voltage across the diode to the current flowing through it:
1n118x i-v curve.gif
Two pairs are connected in inverse parallel so the same voltage appears across them in each direction, as the direction of current flow alternates. So the voltage across the four-diode network alternates in polarity and peaks at around 1.8V in each polarity. This voltage feeds through R4 into the LED in the optocoupler, which starts to illuminate at around 1V. R4 drops about 0.8V on the positive peaks, which corresponds to a current of about 8 mA through the LED in the optocoupler, according to Ohm's Law: I = V / R where V = 0.8V, R = 100 ohms, so I = 0.008A or 8 mA.

So almost all of the motor current flows through the diode network; only a tiny bit flows through the optocoupler. R4 and C4 help prevent the circuit from responding to short, small currents that could flow due to interference or insulation breakdown when the motor is not actually running.

Each time the voltage across the diode network reaches +1.8V, 8 mA flows in the LED in the optocoupler, and this resets the CD4040 counter as described in the circuit description.

The waveform in post #21 represents the remaining voltage across the motor. It is the 220VAC waveform with a small constant voltage drop inserted in series with it. It is only an approximation. The voltage drop introduced by the diode array works out to an equivalent AC voltage loss of about 1.2VAC, or 1% of the total voltage. This is less than the mains voltage tolerance and day-to-day variation so I don't think it will be a problem.

The reason for the tie across the diodes is to simplify construction. That diode comes in two versions; one with the cathode connected to the mounting stud, and a "reverse" version (the R suffix version) which has the anode connected to the mounting stud. With the way I have shown the circuit, all four diodes can be mounted onto a common metal heatsink without insulating washers because all of their mounting studs are connected together. The tie is not necessary for the circuit's operation.

That circuit will work fine, but I think you're right - the Hall effect IC is more compact, more efficient (no significant voltage drop), and simpler. And probably cheaper.
 
Last edited:

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Voltage doesn't follow a path. Current follows a path. Voltage is measured between two points, always. Sometimes voltages are quoted at a single point; in this case it is measured relative to the "0V" ("zero volt") rail of the circuit, which is the default reference point for voltage measurement. But voltage is always measured between two points; it's like a distance.
Current in all points in a series circuit is the same, so the same current flows from the 220VAC Phase wire, through the first yellow wire (W5), through the group of four diodes, out the other yellow wire (W6), through the switch for the 220VAC motor, through the 220VAC motor, and back to the 220V Neutral wire. But the voltages across different parts of the series circuit are not all the same.
I find this confusing because I was taught that residential 220 service is actually two 110 lines, just coming from different taps from the transformer. Each black wire from the mains is 110v to neutral, however a solely 220v circuit never contains a neutral, just two hot and a ground. I always thought that 220v was the constructive interference of the the two 110v waves.
Also I don't follow how the incoming current from wire W5 can pass through all four diodes, I recognize it to pass through D7 and D9 because that is the direction they can flow through, but the others are reverse - or is that voltage that is allowed through....
The voltage between Phase and Neutral is a sinewave at 220V RMS, which alternates smoothly between peak voltages of about +311V and -311V. The current flowing through the diodes produces a voltage drop of around 0.9V across each diode, i.e. 1.8V across the pair. You can determine what this voltage will be from this graph in the data sheet for the diode, which relates the typical voltage across the diode to the current flowing through it:
View attachment 12762
I follow this and understand root mean square to a certain degree.
Two pairs are connected in inverse parallel so the same voltage appears across them in each direction, as the direction of current flow alternates. So the voltage across the four-diode network alternates in polarity and peaks at around 1.8V in each polarity. This voltage feeds through R4 into the LED in the optocoupler, which starts to illuminate at around 1V. R4 drops about 0.8V on the positive peaks, which corresponds to a current of about 8 mA through the LED in the optocoupler, according to Ohm's Law: I = V / R where V = 0.8V, R = 100 ohms, so I = 0.008A or 8 mA.
Did you meant R5?
So almost all of the motor current flows through the diode network; only a tiny bit flows through the optocoupler. R4 and C4 help prevent the circuit from responding to short, small currents that could flow due to interference or insulation breakdown when the motor is not actually running.
Each time the voltage across the diode network reaches +1.8V, 8 mA flows in the LED in the optocoupler, and this resets the CD4040 counter as described in the circuit description.
The waveform in post #21 represents the remaining voltage across the motor. It is the 220VAC waveform with a small constant voltage drop inserted in series with it. It is only an approximation. The voltage drop introduced by the diode array works out to an equivalent AC voltage loss of about 1.2VAC, or 1% of the total voltage. This is less than the mains voltage tolerance and day-to-day variation so I don't think it will be a problem.
The reason for the tie across the diodes is to simplify construction. That diode comes in two versions; one with the cathode connected to the mounting stud, and a "reverse" version (the R suffix version) which has the anode connected to the mounting stud. With the way I have shown the circuit, all four diodes can be mounted onto a common metal heatsink without insulating washers because all of their mounting studs are connected together. The tie is not necessary for the circuit's operation.
That circuit will work fine, but I think you're right - the Hall effect IC is more compact, more efficient (no significant voltage drop), and simpler. And probably cheaper.
(Moderator's note: I've fixed up the quoting in this post -- KrisBlueNZ)
 

Attachments

  • index.jpg
    index.jpg
    11.1 KB · Views: 170
Last edited by a moderator:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I find this confusing because I was taught that residential 220 service is actually two 110 lines, just coming from different taps from the transformer. Each black wire from the mains is 110v to neutral, however a solely 220v circuit never contains a neutral, just two hot and a ground. I always thought that 220v was the constructive interference of the the two 110v waves.
I don't know about how 220VAC is obtained in countries with 110VAC systems, but it doesn't matter; all that matters is that there's 220VAC between two wires. These wires can be connected through to the 220VAC motor to make it run. You break one of the wires in that path and insert that monitoring circuit into it. The current that flows from the 220VAC supply to the 220VAC motor has to pass through that monitoring circuit and causes voltage to be dropped across the diodes. This voltage is passed to the LED in the optocoupler.
Also I don't follow how the incoming current from wire W5 can pass through all four diodes, I recognize it to pass through D7 and D9 because that is the direction they can flow through, but the others are reverse - or is that voltage that is allowed through...
It doesn't pass through all four diodes at the same time. It's alternating current; it alternates in direction. When it flows in one direction, it passes through two of the diodes, and when it flows in the other direction, it pases through the other two diodes. When it's flowing into W5 and out W6, the voltage across the diodes is of the right polarity to illuminate the LED in the optocoupler. In the other case, it isn't. But since cycles alternate continuously, the optocoupler gets activated 50 or 60 times per second, which is fine.
Did you meant R5?
Yes, sorry. R5 is in series with the optocoupler; it drops a bit of voltage and limits the current to the optocoupler to prevent damage to it.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Kris, do you think this project would be best served by having a pcb printed for it? After breadboarding to make sure everything works as intended of course. Would the digital ic's require special consideration in layout because of the high voltage circuit that is incoming?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
First, you don't NEED to do a PCB for this circuit for any technical or safety reason. You definitely need to keep the high-current, high-voltage paths away from the ICs but you can do that with stripboard by grinding off areas of copper.

I think the decision depends on practical factors. The choice between the diode-based current sensing method and the ACS712-20A current sensor is significant because the diodes are USD 9.30 each, so you would be looking at over USD 40 including a heatsink, and extra hand-assembly. The ACS712-20A is around USD 5 and doesn't need a heatsink, but SOIC-8 packages are SMT (surface-mount technology) with a 0.05 inch pin pitch, and are not easy to mount on stripboard.

Most of the components are available in SMT packages, which would save space, but would require a PCB with a solder mask. Those components, including the relay, would fit on a board around 10 cm by 5~7 cm. You would get at least six boards to an A4 panel, so the cost per board could be fairly reasonable. I would go for double-sided, plated-through-hole, with solder masks both sides and a component overlay on one side, on 1.6 mm fibreglass with thick copper option.

You have been assuming that you would make one board and move it around to different machines. If you want something external, you will need some good-quality high-current plugs and sockets, and if you want to run machines when the board is being used elsewhere, you'll need shorting plugs to bypass the current sensing path that the board would provide. Good-quality safe connectors for high currents and high voltages in a workshop environment aren't cheap - around USD 15~40 for each gender. I actually think you would probably be better to make a separate board for each machine. The more machines you have, the stronger this argument would be.

I think in your situation, I would do a PCB using a mixture of SMT and THT (through-hole) parts, get a batch made, and either hand-assemble them or get them assembled by a contractor, depending on quantity.

With the board mounted and enclosed, you could use cheaper connectors, with many pins for each signal to improve reliability. Here are a couple of possibilities that caught my eye, just so you know the kind of thing I'm talking about:
http://www.digikey.com/product-detail/en/0015247160/WM17742-ND/1633805
http://www.digikey.com/product-detail/en/0015247180/WM17744-ND/302200

Have you done any PCB layout work before?
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I think the decision depends on practical factors. The choice between the diode-based current sensing method and the ACS712-20A current sensor is significant because the diodes are USD 9.30 each, so you would be looking at over USD 40 including a heatsink, and extra hand-assembly. The ACS712-20A is around USD 5 and doesn't need a heatsink, but SOIC-8 packages are SMT (surface-mount technology) with a 0.05 inch pin pitch, and are not easy to mount on stripboard.

I think the sensor method is best, despite the difficulties of the SMT mounting/soldering.

Most of the components are available in SMT packages, which would save space, but would require a PCB with a solder mask. Those components, including the relay, would fit on a board around 10 cm by 5~7 cm. You would get at least six boards to an A4 panel, so the cost per board could be fairly reasonable. I would go for double-sided, plated-through-hole, with solder masks both sides and a component overlay on one side, on 1.6 mm fibreglass with thick copper option.

I take it that you have in mind to mount components on both sides to make the board as small as possible? Ideally this would fit into a 10.16cm square steel electrical box that will also have the outlets mounted in it. They make deeper boxes, I am not sure of what space I will have to work with yet.

You have been assuming that you would make one board and move it around to different machines. If you want something external, you will need some good-quality high-current plugs and sockets, and if you want to run machines when the board is being used elsewhere, you'll need shorting plugs to bypass the current sensing path that the board would provide. Good-quality safe connectors for high currents and high voltages in a workshop environment aren't cheap - around USD 15~40 for each gender. I actually think you would probably be better to make a separate board for each machine. The more machines you have, the stronger this argument would be.

That has been my assumption, because I can not open and insert this device into the machines. I was going to make one for the 220v machines and one for the 110v machines in the future.

I think in your situation, I would do a PCB using a mixture of SMT and THT (through-hole) parts, get a batch made, and either hand-assemble them or get them assembled by a contractor, depending on quantity.

With the board mounted and enclosed, you could use cheaper connectors, with many pins for each signal to improve reliability. Here are a couple of possibilities that caught my eye, just so you know the kind of thing I'm talking about:
http://www.digikey.com/product-detail/en/0015247160/WM17742-ND/1633805
http://www.digikey.com/product-detail/en/0015247180/WM17744-ND/302200

Have you done any PCB layout work before?

I don't intend to make many of these, so I would be more than pleased to do this in my shop. I like the molex connectors, I had never thought of using them! That may exceed the box fill capacity, with all the extra wiring, but I like the signal integrity protection. I have done 2 circuits in the past, but I don't think they ever exceeded 10 components!

Thanks for the information Kris, I know that I am swimming in the deep end because of all the options you come up with that I never even dreamed of! Thanks again :)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I think the sensor method is best, despite the difficulties of the SMT mounting/soldering.
I agree. I just discovered that the ACS712 requires 10 mA power supply current (13 mA maximum) which will increase the capacitance needed for C1, but that's not a big problem. The ACS712 has many advantages.
I take it that you have in mind to mount components on both sides to make the board as small as possible? Ideally this would fit into a 10.16cm square steel electrical box that will also have the outlets mounted in it. They make deeper boxes, I am not sure of what space I will have to work with yet.
That's definitely possible, especially if you hand-assemble the boards. I was assuming components on one side only, but if you're pressed for space, that's possible.

Another option I'd like to suggest is replacing U2 and U3, and some of the associated small components, with a small microcontroller, such as the PIC12F1571: http://www.digikey.com/product-detail/en/PIC12F1571-I/SN/PIC12F1571-I/SN-ND/4739308. This would save cost, PCB complexity, and space, and allow more control of the behaviour, such as avoiding the problem I mentioned earlier where the output will turn ON at startup for a random length of time because the CD4040 powers up with a random count.

Microcontrollers require programming, obviously. I would be happy to write the code, but you would need to get the devices programmed somehow. You could ship the boards to me and I could program them, or you could try to find a local makerspace or similar that would help you out.

(re building an external box) That has been my assumption, because I can not open and insert this device into the machines. I was going to make one for the 220v machines and one for the 110v machines in the future.
I don't intend to make many of these, so I would be more than pleased to do this in my shop. I like the molex connectors, I had never thought of using them! That may exceed the box fill capacity, with all the extra wiring, but I like the signal integrity protection. I have done 2 circuits in the past, but I don't think they ever exceeded 10 components!
So to be clear, are you in favour of making multiple boards and putting them inside the machines' enclosures?

The idea for the large rectangular connectors with multiple connections for each high-current signal comes from the ATX power connector used with computer motherboards. Those connectors look similar, but we need to be sure that they're polarised so you can't insert them round the wrong way!
Thanks for the information Kris, I know that I am swimming in the deep end because of all the options you come up with that I never even dreamed of! Thanks again :)
No problem :) I enjoy it.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I agree. I just discovered that the ACS712 requires 10 mA power supply current (13 mA maximum) which will increase the capacitance needed for C1, but that's not a big problem. The ACS712 has many advantages.

That's definitely possible, especially if you hand-assemble the boards. I was assuming components on one side only, but if you're pressed for space, that's possible.

Another option I'd like to suggest is replacing U2 and U3, and some of the associated small components, with a small microcontroller, such as the PIC12F1571: http://www.digikey.com/product-detail/en/PIC12F1571-I/SN/PIC12F1571-I/SN-ND/4739308. This would save cost, PCB complexity, and space, and allow more control of the behaviour, such as avoiding the problem I mentioned earlier where the output will turn ON at startup for a random length of time because the CD4040 powers up with a random count.

Microcontrollers require programming, obviously. I would be happy to write the code, but you would need to get the devices programmed somehow. You could ship the boards to me and I could program them, or you could try to find a local makerspace or similar that would help you out.

That is really cool! I have been interested in learning more about arduino's and I believe that they can be used to program pic's or at least be used as a go between pc and pic. Resolving the unintended turn on is awesome as well!!


So to be clear, are you in favour of making multiple boards and putting them inside the machines' enclosures?

No, I am ok with making multiple board, but can not put them in the machine enclosures. I would probably only need two control units for 220c and two units for 110v, but these would be separate enclosures such that they could be made portable if I don't build enough to suit my needs.

The idea for the large rectangular connectors with multiple connections for each high-current signal comes from the ATX power connector used with computer motherboards. Those connectors look similar, but we need to be sure that they're polarised so you can't insert them round the wrong way!

No problem :) I enjoy it.

I thought most plugs were keyed, at least all the molex type plugs that I can recall from pc builds I have done have a square plug pin or half hex pin shapes in key places to prevent incorrectly plugging. Again thanks for the help, I enjoy the design process as much as the build, sometimes more! :)

I am going to check out that link you mentioned on the Spice sim, it would really aid my learning, thanks!!
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
That is really cool! I have been interested in learning more about arduino's and I believe that they can be used to program pic's or at least be used as a go between pc and pic. Resolving the unintended turn on is awesome as well!!
That's great! I'm glad you're interested in microcontrollers because they're a lot of fun.

I've modified the circuit to use a microcontroller. You can see how many components it saves. Other changes I made in this version:
  • Current detection in the 220VAC path is done with an ACS712ELC-20A-T device instead of four big diodes and an optocoupler.
  • The main rail is 24V instead of 48V, and I've specified relays with 24V coils. This is because (a) it means I can use a standard 78L05 regulator to provide the 5V rail for the ICs, and (b) relays with 24V coils are more readily available. Since the ACS712 draws up to 13 mA power supply current, and the 78L05 draws up to 6.5 mA, there's no point trying to keep a very tight current budget, so I've had to increase the input capacitor, C1, to 1.5 µF. So there's more current available for the relay coil, which is just as well, because a 24V relay coil draws twice as much current as a 48V coil does.
  • As mentioned, the circuitry is powered from a 78L05 regulator instead of a discrete regulator using a zener and a transistor.
  • The two wires at the right hand end connect just to the relay contacts. This keeps the switched circuit independent of the AC supply voltage used by the circuit, and means that the heavy currents are contained in small areas of the circuit, i.e. around the ACS712 input, and around the K1 contact.
I haven't put a connector in yet; still using W1, W2 etc.

268425.003.GIF

No, I am ok with making multiple board, but can not put them in the machine enclosures. I would probably only need two control units for 220c and two units for 110v, but these would be separate enclosures such that they could be made portable if I don't build enough to suit my needs.
OK, cool.
I thought most plugs were keyed, at least all the molex type plugs that I can recall from pc builds I have done have a square plug pin or half hex pin shapes in key places to prevent incorrectly plugging.
Yes they probably are.
Again thanks for the help, I enjoy the design process as much as the build, sometimes more! :)
Likewise :) Sometimes getting to the final stage is actually a disappointment!
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Likewise :) Sometimes getting to the final stage is actually a disappointment!

Nah, there are always more projects begging for time and interest!!!

Ok, so, more questions:

Will using the pic allow an "on" delay as well as an "off" delay? I assume that its just a matter of programming since the wiring to the relay is in place.

Can the ACS712ELCTR-30A-T be substituted for the 20A model? The only difference I noted in the spec sheets was the sensitivity of the 30a version is 66mV/A vs. 100mV/A on the 20A unit.

I wondered why pins 1 and 2 are tied together internally as well as 3 and 4 (ACS712)? More lines for signal resolution - prevention of noise?

Since this ic senses current, I should be able to use the same build on my 110v machines, correct?

I also saw a table in the data sheet titled "Output Voltage versus Sensed Current" - it shows a linear rise from 0.5v to 4.5v when current rises from -30A to 30A.
Two questions, 1. Was your thinking to program the pic to "start" its function when voltage exceeds a certain threshold?
2. What is negative current? Is this current moving in the opposite direction than what was intended? I don't understand the concept of negative power...

Judging by the consolidation of parts and their sizes, I think the largest space consumer will be the connectors!
Do you advocate programming the chip offboard saving the need to have the connector, or is its purpose there for tweaking after the build?

I am really excited Kris! Thanks for taking me along the design process, I am learning loads :)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Nah, there are always more projects begging for time and interest!!!
LOL :)
Will using the pic allow an "on" delay as well as an "off" delay? I assume that its just a matter of programming since the wiring to the relay is in place.
Right. You just let me know what you want it to do.
Can the ACS712ELCTR-30A-T be substituted for the 20A model? The only difference I noted in the spec sheets was the sensitivity of the 30a version is 66mV/A vs. 100mV/A on the 20A unit.
Yes, that's fine if we use the PIC12F1571. Since we don't need to detect the actual value of the current, just detect that something is happening, it doesn't really matter which scale we choose for the ACS712 - we could even use the 5A version. They can all handle up to 100A peaks. We just need to choose one. If you would rather use the -30A that's fine.
I wondered why pins 1 and 2 are tied together internally as well as 3 and 4 (ACS712)? More lines for signal resolution - prevention of noise?
Increased current handling. Those little "gull-wing" pins aren't really designed to carry heavy currents!
Since this ic senses current, I should be able to use the same build on my 110v machines, correct?
Yes. Is that the only difference - the operating voltage of the motor that the circuit needs to detect? In that case, the same circuit will work for both.
I also saw a table in the data sheet titled "Output Voltage versus Sensed Current" - it shows a linear rise from 0.5v to 4.5v when current rises from -30A to 30A.Two questions, 1. Was your thinking to program the pic to "start" its function when voltage exceeds a certain threshold? 2. What is negative current? Is this current moving in the opposite direction than what was intended? I don't understand the concept of negative power...
Yes. The ACS712's output sits at about half VCC (i.e. 2.5V) when it's not sensing any current. Positive current causes it to increase proportionally; at full scale positive input current the output has increased from 2.5V to 4.5V. Negative current causes it to decrease proportionally; at full scale negative input current the output has decreased from 2.5V to 0.5V.

Yes, negative current is current flowing in the other direction. With AC, the voltage and current are constantly varying, following the sinewave shape. With a simple resistive load such as an incandescent light bulb, current and voltage are "in phase", i.e. they follow the same shape at the same time; at every instant in time, current and voltage are proportional to each other, and have the same polarity.
So as the voltage is rising, falling, reversing polarity, rising, falling, reversing polarity, etc, the current is doing the same thing. At every moment in time, "positive" power is flowing from the source to the load, because when the current is negative, the voltage is negative too. Since power is voltage multiplied by current, two negatives cancel each other out, and power is always positive.

It's not exactly the same for motor loads, because the voltage and current are somewhat out of phase with each other, but it's close enough for the analogy to be useful.
Judging by the consolidation of parts and their sizes, I think the largest space consumer will be the connectors
Yes, definitely. And the input capacitor (C1) and the relay.
Do you advocate programming the chip offboard saving the need to have the connector, or is its purpose there for tweaking after the build?
I would program it on-board. You need a special socket to program SMT devices. A programming connector on the board doesn't waste much space and could be useful down the road.
I am really excited Kris! Thanks for taking me along the design process, I am learning loads :)
Cool! That's great.

I can't spend a lot of time on this at the moment, but we can make a start with the PCB layout. Are you going to do that? I think the preferred option is the free version of Eagle at http://www.cadsoftusa.com/download-eagle/. Another option is KiCAD at http://www.kicad-pcb.org/ which is intended to be free at all levels. I don't think it's widely used yet and when I tried it, I couldn't get very far with it, but YMMV and they're probably both worth a try.

We need to settle on components, so you know which outlines to use on the PCB. Do you have any supplier preference? If you want someone local, try http://www.yellowpages.com. I looked at http://www.westfloridacomponents.com/ but they don't have a suitable PIC. I tried Pridmore but their web site was down. There are the old standbys http://www.digikey.com and http://www.mouser.com who both carry the PIC12F1571 as well as everything else. Let me know who you want to buy from.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Yes, that's fine if we use the PIC12F1571. Since we don't need to detect the actual value of the current, just detect that something is happening, it doesn't really matter which scale we choose for the ACS712 - we could even use the 5A version. They can all handle up to 100A peaks. We just need to choose one. If you would rather use the -30A that's fine.

I was thinking that the 30A rating would be safer to use - current carrying capacity. But what you are saying is that we could use the 5A version because? My guess is that we only need to see the "turn on" spike in current and that would be at least 5A? We don't necessarily care if it goes above 5A, just need to "see it start" to trigger the other switch.

Yes. Is that the only difference - the operating voltage of the motor that the circuit needs to detect? In that case, the same circuit will work for both.

No, the 110v machines would probably be rated at lower ampacity, but that shouldn't matter if the above is true, correct?

I would program it on-board. You need a special socket to program SMT devices. A programming connector on the board doesn't waste much space and could be useful down the road.

I saw the pic offered in a dip package - would it be better to use this package type with a socket?

I can't spend a lot of time on this at the moment, but we can make a start with the PCB layout. Are you going to do that? I think the preferred option is the free version of Eagle at http://www.cadsoftusa.com/download-eagle/. Another option is KiCAD at http://www.kicad-pcb.org/ which is intended to be free at all levels. I don't think it's widely used yet and when I tried it, I couldn't get very far with it, but YMMV and they're probably both worth a try.

We need to settle on components, so you know which outlines to use on the PCB. Do you have any supplier preference? If you want someone local, try http://www.yellowpages.com. I looked at http://www.westfloridacomponents.com/ but they don't have a suitable PIC. I tried Pridmore but their web site was down. There are the old standbys http://www.digikey.com and http://www.mouser.com who both carry the PIC12F1571 as well as everything else. Let me know who you want to buy from.

I thank you for all the time you have already spent! It has been greatly appreciated, I will commit to the PCB layout, I may have questions, but I am very interested in working that out. As for suppliers, Digikey, Mouser or Newark - I have done business with all three in the past, once the schematic is done I can detail the BOM and worry about sourcing the items.

Thanks again :)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I was thinking that the 30A rating would be safer to use - current carrying capacity. But what you are saying is that we could use the 5A version because? My guess is that we only need to see the "turn on" spike in current and that would be at least 5A? We don't necessarily care if it goes above 5A, just need to "see it start" to trigger the other switch.
No. While the motor is running, current will be flowing through the ACS712's sensing path. It will have the usual sinewave shape. So the MCU will expect to see a varying voltage on the ACS712's output. When that varying signal stops varying, and settles around half VCC, the MCU knows that the motor has been turned OFF.

The magnitude, and the shape, of the signal that the MCU sees from the ACS712 is not really important; it just needs to be able to distinguish "no current flowing" from "motor current flowing". If we used the 5A version of the ACS712, we would see a clipped sinewave, because (I assume) the peaks at the top and bottom of the current sinewave in the circuit path to the motor will be more than +5A and -5A, and the ACS712-5A can't reproduce these at its output. So we would see a clipped sinewave; more like a squarewave really. But that wouldn't matter because the MCU is only interested in seeing changes in that output signal.

Then when the motor is turned OFF, the current in the monitoring path drops to zero (or very close to zero), and the ACS712's output will settle back to half VCC again. The MCU will see this, and know that the motor has been turned OFF.

So the only practical difference between a 5A and a 30A version of the ACS712 is that the 5A version will produce a clipped output signal with maximum amplitude, whereas the 30A version will produce a sinewave output signal with less than maximum amplitude. The MCU can reliably detect either. And since the motor is expected to draw peaks of more than 5A, you can argue that we should use one rated for 20A or 30A, even though a 5A rated one would still work.
No, the 110v machines would probably be rated at lower ampacity, but that shouldn't matter if the above is true, correct?
Correct. By "ampacity", do you mean the rated current for the motor? What is the lowest ampacity motor that you would want to use?
I saw the pic offered in a dip package - would it be better to use this package type with a socket?
Yes, that's probably a good idea. It leaves our options open for programming it, and it means that if something fails and the MCU gets damaged, it's easy to replace it. I still think it would be a good idea to have a programming connector on the board though. The normal programming device, called PICkit 2 or PICkit 3, connects to a 5-pin or 6-pin connector.
I thank you for all the time you have already spent! It has been greatly appreciated, I will commit to the PCB layout, I may have questions, but I am very interested in working that out. As for suppliers, Digikey, Mouser or Newark - I have done business with all three in the past, once the schematic is done I can detail the BOM and worry about sourcing the items.
You're welcome :) It's nice to see someone so interested in this stuff.

I will choose the connectors and upload a new schematic. Are there any other schematic changes I need to make?
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
No. While the motor is running, current will be flowing through the ACS712's sensing path. It will have the usual sinewave shape. So the MCU will expect to see a varying voltage on the ACS712's output. When that varying signal stops varying, and settles around half VCC, the MCU knows that the motor has been turned OFF.

The magnitude, and the shape, of the signal that the MCU sees from the ACS712 is not really important; it just needs to be able to distinguish "no current flowing" from "motor current flowing". If we used the 5A version of the ACS712, we would see a clipped sinewave, because (I assume) the peaks at the top and bottom of the current sinewave in the circuit path to the motor will be more than +5A and -5A, and the ACS712-5A can't reproduce these at its output. So we would see a clipped sinewave; more like a squarewave really. But that wouldn't matter because the MCU is only interested in seeing changes in that output signal.

Then when the motor is turned OFF, the current in the monitoring path drops to zero (or very close to zero), and the ACS712's output will settle back to half VCC again. The MCU will see this, and know that the motor has been turned OFF.

So the only practical difference between a 5A and a 30A version of the ACS712 is that the 5A version will produce a clipped output signal with maximum amplitude, whereas the 30A version will produce a sinewave output signal with less than maximum amplitude. The MCU can reliably detect either. And since the motor is expected to draw peaks of more than 5A, you can argue that we should use one rated for 20A or 30A, even though a 5A rated one would still work.

Awesome, thank you for the explanation, it makes much more sense in how it works and why the 5A version would still produce the desired effect. I was afraid that since the rated amp's weren't close to what the motor may draw the chip might get damaged. But checking the datasheet, the chip can survive 100A for 1 pulse at 100ms. Since it doesn't matter, I will go with whatever is available and cheapest at the time of sourcing.

Correct. By "ampacity", do you mean the rated current for the motor? What is the lowest ampacity motor that you would want to use?

The lowest 110v machine would be 5A.

Yes, that's probably a good idea. It leaves our options open for programming it, and it means that if something fails and the MCU gets damaged, it's easy to replace it. I still think it would be a good idea to have a programming connector on the board though. The normal programming device, called PICkit 2 or PICkit 3, connects to a 5-pin or 6-pin connector.

You're welcome :) It's nice to see someone so interested in this stuff.

I will choose the connectors and upload a new schematic. Are there any other schematic changes I need to make?

I found a PIC1 on digikey, says it works with PIC12F, do you think that the description is accurate, would it work for this project? There was also a PICkit 3 low pin count demo board. They are within ten dollars of each other.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Since it doesn't matter, I will go with whatever is available and cheapest at the time of sourcing.
OK. I'll specify the 30A one on the schematic.
The lowest 110v machine would be 5A.
OK, cool.
I found a PIC1 on digikey, says it works with PIC12F, do you think that the description is accurate, would it work for this project? There was also a PICkit 3 low pin count demo board. They are within ten dollars of each other.
I wouldn't go for a PICkit 1 - I think they're pretty old. Here are three other options:
PICkit 2 starter kit: http://www.digikey.com/product-detail/en/DV164120/DV164120-ND/806160 USD 66
PICkit 3 programmer only: http://www.digikey.com/product-detail/en/PG164130/PG164130-ND/2171224 USD 54
PICkit 3 starter kit: http://www.digikey.com/product-detail/en/DV164131/DV164131-ND/2002492 USD 84

The PICkit 2 has some features that the PICkit 3 doesn't have, but I assume the PICkit 3 will be more future-proof. The programmer by itself is enough if you put a programming connector on the board. But you might benefit from the other bits in the starter kits. Your call :)
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
A friend of a friend has a programmer, but in case that falls through I did find it for about 1/2 price :)
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Ok, got a workable PCB layout for the majority of the components :) I have the 5 pin connector shown for programming the PIC - but I realized I probably need to add another header of some sort for power in and power out of the relay. I will work on that tomorrow, current size of the board is about 7.3cm square. I would also like to add a led to let me know when the power is on. Is this something best powered by the 24v rail using R/C circuit, off the pic or by tapping off C1?
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Right. The 110VAC input can be a small connector, but the other two should be rated for at least 30A. Also, ideally, they should be different from each other, to avoid confusion. Whether you use connectors with two very large contacts, or connectors with multiple smaller contacts, is up to you.

Edit: I would like to change the PIC from a PIC12F1571 to a PIC12F675. The connections are identical, so there are no other changes. This is because the PIC12F675 is one of the few PICs I can get locally, and I'm using it for two other projects as well. So this makes it easier for me. Is that OK?
 
Last edited:
Top