PIC Resetting

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
keejay
Flowcode v5 User
Posts: 115
Joined: Tue Jul 23, 2013 10:02 am
Been thanked: 15 times
Contact:

PIC Resetting

Post 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...

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC Resetting

Post 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
Martin

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: PIC Resetting

Post 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)

keejay
Flowcode v5 User
Posts: 115
Joined: Tue Jul 23, 2013 10:02 am
Been thanked: 15 times
Contact:

Re: PIC Resetting

Post 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...

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC Resetting

Post 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?
Martin

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: PIC Resetting

Post by Steve001 »

maybe one of these across your relay contact would help

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

Steve
Success always occurs in private and failure in full view.

keejay
Flowcode v5 User
Posts: 115
Joined: Tue Jul 23, 2013 10:02 am
Been thanked: 15 times
Contact:

Re: PIC Resetting

Post 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.

Post Reply