View previous topic :: View next topic |
Author |
Message |
freeman3020
Joined: 23 Oct 2015 Posts: 7
|
override restart_wdt |
Posted: Fri Oct 23, 2015 3:45 am |
|
|
hi all
I have embedded system that control AC line with relay. All things ok,
this system is run 24/7, the problem is some time every few days 3 to 4,
uC is latch-up and internal WDT not restart.
I got idea to make external wdt, but my code has a lot of delay_ms.
I need internal function restart_wdt > to trigger external WDT ?
Can I do? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Fri Oct 23, 2015 4:43 am |
|
|
Before starting, I'd be fixing what is causing the latch up.
It sounds as if almost certainly you have something inductive (probably the relay coil), that is not having it's flyback energy when you switch it off properly trapped. You have to remember that the energy needs to go _somewhere_, and if some of it goes through the pins of the PIC, you can be talking voltages and currents that will hang the chip, and if left unhandled, after a longer period will _destroy_ the chip. Every time it is hung like this it probably implies that the FET's have become reverse biased. This will result in their eventual destruction.....
Put a snubber on the relay. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Fri Oct 23, 2015 5:27 am |
|
|
Another possible problem is the EMI created by the relay contacts when switching on the AC load.
Contacts that are gold plated are much better that the standard silver plated ones though they cost a little more.
You can eliminate that source by using an SSR (Solid State Relay).
The other source of EMI is the actual AC load, be it a motor or FL lighting.
It might even be something 'nearby', say an arc welder,grinder,cell phone, ???. Maybe record when the PIC fails, if possible, and see what was happening in the area.
Without knowing more about your project it is hard to say where this EMI is
coming from but you do need to track down the source and get rid of it.
Jay |
|
|
guy
Joined: 21 Oct 2005 Posts: 297
|
|
Posted: Fri Oct 23, 2015 3:33 pm |
|
|
Quote: | I need internal function restart_wdt > to trigger external WDT ?
Can I do? |
If you are using your own restart_wdt() call you might be able to replace it with a function that does something else. The restart that's built into delay_ms (code created by the compiler) cannot be replaced. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Fri Oct 23, 2015 4:25 pm |
|
|
guy wrote: | Quote: | I need internal function restart_wdt > to trigger external WDT ?
Can I do? |
If you are using your own restart_wdt() call you might be able to replace it with a function that does something else. The restart that's built into delay_ms (code created by the compiler) cannot be replaced. |
Code: | void my_delay_ms(unsigned int16 delay) {
unsigned int16 i;
for (i = 0; i < delay; i++) {
// "pet" your external watchdog IC here
delay_ms(1);
}
} |
Use the same approach to implement a delay based on delay_us(). |
|
|
freeman3020
Joined: 23 Oct 2015 Posts: 7
|
|
Posted: Sat Oct 24, 2015 12:20 am |
|
|
thanks all
For latch-up I tried all method to isolate EMI effect,
I use uln2003 and all pin have 1 Nano cap.
I will try newguy suggestion. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sat Oct 24, 2015 1:16 am |
|
|
First thing, where does the pin on the ULN, that traps the flyback connect to?. How much capacitance is on this?. How does the rail connect?.
Then you talk about a 1nF capacitor. Look instead at the snubber network I've already mentioned. This wants to be across the relay coil. A simple capacitor on the output, does not give the trapping effect that an RC across the actual coil gives.
Then look at the possibility of RF effects. An undriven pin for example, is a classic easy way to cause problems.
The point is that if the chip locking, it is a sure sign that significant energy is going somewhere. There are solutions to possibly control an external WDT, but you _must_ cure the problem first. A watchdog should be a 'last resort' to catch that 'one in a million' thing that is not being handled otherwise. I'd not use a watchdog, _until_ I have a circuit that runs 99.99% of the time perfectly without it.
It's like the guy with a car that veers right, so he puts a weight on the left hand side of the steering wheel...... |
|
|
freeman3020
Joined: 23 Oct 2015 Posts: 7
|
|
Posted: Sat Oct 24, 2015 4:55 am |
|
|
Ttelmah wrote: | First thing, where does the pin on the ULN, that traps the flyback connect to?. How much capacitance is on this?. How does the rail connect?.
Then you talk about a 1nF capacitor. Look instead at the snubber network I've already mentioned. This wants to be across the relay coil. A simple capacitor on the output, does not give the trapping effect that an RC across the actual coil gives.
Then look at the possibility of RF effects. An undriven pin for example, is a classic easy way to cause problems.
The point is that if the chip locking, it is a sure sign that significant energy is going somewhere. There are solutions to possibly control an external WDT, but you _must_ cure the problem first. A watchdog should be a 'last resort' to catch that 'one in a million' thing that is not being handled otherwise. I'd not use a watchdog, _until_ I have a circuit that runs 99.99% of the time perfectly without it.
It's like the guy with a car that veers right, so he puts a weight on the left hand side of the steering wheel...... |
do you have any idea or circuit for snubber network if the relay switch big 220v 10A transformer ? |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Oct 24, 2015 6:31 am |
|
|
Quote: |
any idea or circuit
|
post your schematic and we may be able to help |
|
|
guy
Joined: 21 Oct 2005 Posts: 297
|
|
Posted: Sat Oct 24, 2015 8:32 am |
|
|
If you trigger a relay that triggers a big transformer it's almost certainly EMI since you have double the interference during switching. Eventually it could kill the PIC regardless of the watchdog. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sun Oct 25, 2015 2:39 am |
|
|
As it stands, you _will_ destroy your relay contacts quite quickly....
You need three separate pieces of suppression.
First an X rated capacitor, in series with a resistor, across the relay contacts (say 0.1uF X2), in series with a 120R (mains rated) 1W resistor.
This serves to help rapidly kill the arc across the relay contacts, when they 'break', while not introducing too much current through the contacts when they make.
This on it's own will be quite an improvement, but I'd then add a MOV across the actual transformer coil. This limits the maximum voltage that can be generated by the coil when the drive switches 'off'. Because of the suppression already introduced by the RC, you can use a higher voltage varistor, than would normally be used on it's own. Perhaps about 320v. This reduces the heating effect on the varistor. You'd need to choose a power rating based on how often the contacts are going to switch.
Then the trap diodes on the ULN driver, need to trap into a power rail that has sufficient capacitance to absorb the energy here without rising too much. You might want to consider using a separate rail from the 'supply' at this point, perhaps a simple rail fed from the local supply by a 50R resistor, with it's own capacitor to ground of a 100uF, in parallel with a 0.1uF ceramic. This provides a filter path 'back' to the local supply, reducing the coupling of the trapped energy into the rail.
As a 'comment', beware slightly of the suggestion to use an SSR. Look at this:
<http://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=13C3206_AppNote&DocType=CS&DocLang=EN>
There are special SSR's designed to handle this, but it is a 'caveat' that it is important to be aware of.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sun Oct 25, 2015 5:35 am |
|
|
QUENCHARC
Only took me 2 days to remember the name. Must be getting old !
It's a combination resistor/capacitor used like Mr. T's 2 part solution.Made by Cornell-Dublier(sp), easy enough to Google it though.
also
a zero cross optotriac SSR might help. I designed my own 25 years ago to control gas furnaces in large industrial plants. Think of LOTS of unshielded wires to 5-6 overhead 250,000 BTU furnaces. I never ,ever lost a PIC in any of the controllers.
Jay |
|
|
|