Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Will WDT reset MCU ?

Status
Not open for further replies.

milan.rajik

Banned
Advanced Member level 5
Joined
Apr 1, 2013
Messages
2,524
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Visit site
Activity points
0
I have a PIC16F628A system which operates a 12V DC Coil 230V 30A Contact rating relay. I am not using opto coupler to avoid a dual 12V secondary transformer. The current cunsomption is < 500 mA. So, I am using a single 12V 1A power supply. I feel MCU will hang due to EMI and noise in power line due to Relay switching. The relay has back emf diode and a 100 nF 200V MLCC across its coil. I want to know whether PICs WDT will reset the device if MCU hangs due to EMI.
 

Why don't you add a ferrite bead and some filtering/bypass caps to the power that feeds the MCU?

I'm not a PIC expert, but from the MCU's I've seen, enabling the WDT will result in the MCU getting restarted when the WDT expires.

Regards
 
I have all the bypass and filtering capacitors. I am only worried about relay switching hanging MCU. MCU is running on internal RC OSC. I want to make sure whether WDT will reset MCU if MCU hangs due to EMI or noise. If yes, then my problem is solved because I have implemented WDT related code. The system once started runs for 40 to 60 years non stop. So I want it to function without problems.
 

Then unit test your WDT code...add some lockup condition and see if it resets...etc...
 
Lockup condition in software is resetting MCU and so WDT is working. What I want to know is if MCU hangs due to EMI then will WDT work or even WDT circuit will be frozen ? If WDT circuit also freezes then it is of no use.

The relay is switching a 1.5 HP pump (inductive load). Relay is panel mount and it is not on PCB. It is connected to PCB through terminal block.
 

It really keeps going back to the board, like I originally stated, is there enough power supply filtering for the 12V that goes to the MCU. That can easily be tested by switching the load off and on and looking at the MCU supply voltage with a good scope with infinite persistence mode enabled. Just have the relay constantly switching for a overnight/week long run and see if anything shows up.

If you come back and see a screen full of traces well you didn't filter the power supply enough for the MCU.
 
The 12V from adapter is filtered with a 2200 uF 16V and a 100 nF 16V and goes to 7805 and also to relay. The output of 7805 has another 100 nF 16V. MCU has 100 nF 16V and a 10 uF 6.3V across its VDD and VSS pins. There is a 1N4007 and 100 nF in parallel with relay coil.
 

If it helps, I've been using a 16F628A to drive five relays, four switching 1.5HP pumps and one SSR driving a 100W lamp. It does have the WDT enabled and it uses the internal clock source, it has never reset in about five years of operation.

I drive the relays through a ULN2803 (could have used a ULN2003) connected to a 12V supply and use a 78L05 to drop it to 5V for the PIC. Layout is important of course but as long as you keep the relay current away from the PIC you should have no problems.

A trick I use is to wire two sets of relay contacts in series and connect a SSR with ZCD across the second one. The start up sequence is close the first relay to apply power, then turn the SSR on for about half a second, then close the second relay. Do the reverse to shut the pump down. It ensures there is no leakage when the power is off and no spark as it is turned on. The SSR handles the motor start current then gets shorted out by the second relay to eliminate voltage drop across it.

Brian.
 
Hi,

As said switching such a heavy load with mechanical contacts will always present problems.

No mention what if any protection you have give any input leads / switch to the micro or what kind of pcb / ground plane etc you have used.

No mention if the Resets occur at relay switch on or switch off, or if you have any relay contact suppressors fitted ?
https://www3.panasonic.biz/ac/e/control/relay/cautions_use/index.jsp

The other way, use a SSR relay instead.

https://uk.farnell.com/crydom/ckrd2430/ssr-30a-240vac/dp/1200303?CMP=KNC-GUK-FUK-GEN-KWL-EMCO-CRYDOM&gclid=CPGVv-jl2b8CFSjjwgod2YIAWQ
 
Mine is a simple fluid level monitoring system. It should be simple and cheap. A BC337 is driving tyco T92P7D52-12 relay. Coil draws some 140 mA current. BC337 can handle 800 mA. Should I put a 1N4007 in between MCU out pin and BC337's Base ? There is a resistor to drop the 5V from MCU pin to 0.8V for Base of BC337.


I can't use SSR. SSR's are heavily priced and they produce heat and need proper cooling with a heasink. Crydom SSR are too costly here.

Reset is not occurring. The issue is I want MCU to reset if MCU hangs due to EMI. Will MCU reset if MCU hangs due to EMI ? I have implemented WDT in software.
 
Last edited:

In my system the SSR is only operated for about half a second so it doesn't overheat but the price overhead is obviously causing you problems. It may be possible to make your own SSR with an optocoupler and two SCRs if that works out cheaper, they are very simple to build.

Answering your original question, yes the WDT will cause a reset if the program hangs but only if you code defensively. Make sure a reset is safe at any time and never reset the WDT timer inside a timed interrupt routine as it may continue to run when the rest of the program has crashed.

I'm not sure what you mean by implementing WDT in software, it is and must be a hardware feature. You enable it (on that PIC) in the configuration word and only reset it in your software.

Brian.
 
I meant clearing WDT in software. Thank you. If MCU resets sometimes due to relay switching that is not a problem. It will continue its work as it again checks the float sensors. The only issue was about WDT and now it is solved. I will stick to relay instead of buying a 30 A SCR. The total cost of the system should not exceed $ 15 thats why I am using relay.
 

I meant clearing WDT in software. Thank you. If MCU resets sometimes due to relay switching that is not a problem. It will continue its work as it again checks the float sensors. The only issue was about WDT and now it is solved. I will stick to relay instead of buying a 30 A SCR. The total cost of the system should not exceed $ 15 thats why I am using relay.


Hi,

Cannot see how you can guarantee 100% that the WDT function will still work if the Pic is affected by electrical interference; after all its still working to a fixed program(?) or wired function, so why cannot it also be affected ?

To be sure you can recover from such EMI effects would think some form of external Reset pulse would be better; made from discreet components.

The simplest way would be based on a simple repetitive capacitor charging , constantly resetting the Pic regularly or something like if the Pic sent out regular pulses, which if stopped cause a reset circuit to send out a reset pulse.
 

The WDT is internally wired to the reset line and runs from it's own independant oscillator so it should be safe to use.

As I warned, the only unsafe use is if it gets reset inside a timed interrupt routine. It is entirely possible (I seen it happen) that the main program is completely crashed but the timer interrupts are still running and preventing the WDT doing it's thing.

Brian.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top