Page 1 of 1

PIC Resetting

Posted: Fri Mar 13, 2015 2:38 pm
by keejay
Hi all,

I apologise in advance if this is not the correct place to bring this up (as it's not quite a FC6 problem), but I thought that due to the frequency that this issue seems to rear it's head, it might be worth a discussion. I have a FC program that switches 4 relays depending on some variables. These relays in turn, switch on ac electric motors (220v apprx 500W each x 4 motors). When the program runs without the motors connected (just switching the relays on their own) all is perfect. When the motors are connected, the PIC resets every so often and even the 16x4LCD gets corrupted quiet often. This happens mostly when the motors are switched off.

I've tried to disable the MCLR option with config buts, but even so, the PIC still resets when I push the set button, so this doesn't seem to have worked?

The PIC is an PIC18F46k22.

I have got 1000uF caps on the power supply lines
100nF ceramics across the PIC power pins (directly across them)
100nF and 1000uF across the LCD power pins

Does anyone have any advice/ideas what can be done in order to stop this resetting behaviour.

Thanks guys...

Re: PIC Resetting

Posted: Fri Mar 13, 2015 2:54 pm
by medelec35
Sounds like when the motor is switched off the relay contacts are arcing, causing interference on the microcontroller supply line.
This interference/ringing will cause voltage on supply line to drop and cause MCU to reset (brown out).
Interference will be too fast for a meter or LED to pick up.
You should be able to scope it.
You could try using X type capacitor, mains contact suppressor (0.1UFcap , 100R resisotor) across relay contacts.
Maybe a suitable VDR will help?
Obviously there must be extreme caution to avoid mains shocks and wrong components fitted that could go with a bang or catch fire

Has the relay coil got a reversed biased diode connected across it?

Martin

Re: PIC Resetting

Posted: Fri Mar 13, 2015 4:40 pm
by hyperion007
Do you have flyback protection diodes across the relay coils? Have you considered using optocouplers and thus isolating the PIC side from the relay side? You should also have a capacitor connected to the MCLR pin if you are using the MCLR that is (do not have the capacitor connected to MCLR when you are programming the PIC only when you are running the application)

Re: PIC Resetting

Posted: Fri Mar 13, 2015 10:07 pm
by keejay
I am interfacing to the motors with this board:

http://www.amazon.com/SunFounder-Channe ... r+5v+relay

It has opto-coupled inputs and I have a 400V MOV across the relay contacts as well.

Confusion reigns...

Re: PIC Resetting

Posted: Sat Mar 14, 2015 9:23 pm
by medelec35
Hi,
I also had the dreaded microcontroller reset.
From personal experience I found capacitor across relay contacts was more effective than MOV when powering a diverter valve.
Not sure if will be as effective with a more powerful motor or not?

Re: PIC Resetting

Posted: Sat Mar 14, 2015 9:33 pm
by Steve001
maybe one of these across your relay contact would help

http://uk.rs-online.com/web/p/rc-networ ... s/0209241/

Steve

Re: PIC Resetting

Posted: Mon Mar 16, 2015 4:58 pm
by keejay
Thanks. Ill give that a try. I'm also going to try using the zero crossing triac switch method to avoid the EMI.