Hi, it seems this construction is sensitive to transients comming
from a few 380vAC 3-phase motors when they switch on/off.
The pic resets approx 5-10 times in 20 minutes.
What can I do more to protect it against the transients ?

In this application it doesnt matter so much that it resets,
but in the next it will, so I must find a solution to this.

I hope I doesnt offend anyone by attaching this small file,
doing it in ascii art would just not be possible...

Have you looked at the line noise going into the circuit? How much
are you getting, and at what frequency? I've found that some transformers
couple more line noise in than others. To help protect against the line
noise (since you know its going to be there), add an inductor before the
7805. e.g. you'd have an LC circuit with the 330nF cap. A line filter before
the transformer will get rid of a lot of the line noise, too. Adding a large
(10uF) capacitor at the output of the 7805 will also help bypass your supply
line, although it might not help with external noise. It doesn't look like
your supply voltage is critical, so adding an additional LC at the output of
the regulator should also help. It will reduce the supply voltage by a
little bit. Be generous with your decoupling caps. It looks like you only
have one decoupling cap. Use another one for the second vdd/gnd connection
in the PIC. Make the power & ground traces as large as possible,
significantly larger than the signal traces.

Does the +5V line feeding the LEDs go anywhere it can pick up noise? If
so I might put a filter where it taps off of the uP +5V, or run the LEDs
off of their own LM7805. If you light many of those LEDs at the same
time you may be putting too much current through port B. I like to use
driver transistors to keep the heat out of the uP and stop noise from
entering.
Can you put a cap on MCLR?

I would be more concerned with poor ground layout and inductive noise
immunity, than a voltage spike. However check your 24AC input with a scope
first. (use a battery operated scope or transformer isolated scope) Then
check your rectified DC at the input to the 78XX regulators. I can't see a
transient getting through unless it is severe.

>
> Hi, it seems this construction is sensitive to transients comming
> from a few 380vAC 3-phase motors when they switch on/off.
> The pic resets approx 5-10 times in 20 minutes.
> What can I do more to protect it against the transients ?
>
> In this application it doesnt matter so much that it resets,
> but in the next it will, so I must find a solution to this.
>
> I hope I doesnt offend anyone by attaching this small file,
> doing it in ascii art would just not be possible...
>
>

The 100K pull-up resistors seem a bit high in value for a noisy environment,
especially on MCLR. I'd try a much lower value resistor pack, like 4.7K.

For a quick test to see if MCLR is the problem, just short MCLR to VDD and
see if the problem goes away.

Paul

> Hi, it seems this construction is sensitive to transients comming
> from a few 380vAC 3-phase motors when they switch on/off.
> The pic resets approx 5-10 times in 20 minutes.
> What can I do more to protect it against the transients ?
>
> In this application it doesnt matter so much that it resets,
> but in the next it will, so I must find a solution to this.

I would put a filter also BEFORE the transformer. Very fast pulses get
coupled to the secondary by the small capacitance of the transformer
windings. It is really nasty and almost impossible to filter at the
secondary.
I had a project using a "wall mart" power supply that flipped some bits
on the real time clock once in a while when connected together with a
refrigerated drinking fountain. I tried all kinds of filtering on the
secondary of the transformer and could not get the problem to go away. The
pulses were so fast the I could not capture with a 40mhz digital scope. I
borrowed a better scope and finally saw the pulses. A "snubber" kind of
circuit solved the problem. Just a 100 ohms resistor and a 220 nf capacitor
on the primary of the transformer and the pulses finally got away.

> Have you looked at the line noise going into the circuit?
Cant see any. Its stable 5volts. Tho I can see a 0.2v
peek to peek sawtooth signal. 4MHz so its from the LEDs/MCU.

> To help protect against the line, add an inductor before the
> 7805. e.g. you'd have an LC circuit with the 330nF cap.

How about adding a inductor before C3/1000uF cap,
would that help reduce the transients ? Would be a LC
filter with that big cap.

> It looks like you only have one decoupling cap.
Ok, will add another one. Very easy, I just solder a
surfacemounted (0805) between the pins of the pic.

> Can you put a cap on MCLR?
Yes, 1-10uF ?

> check your rectified DC at the input to the 78XX regulators.
> I can't see a transient getting through unless it is severe

I checked AFTER the 7805 and I saw transients on the scope.
They peek up and down resulting in v dropping to 3-4v and
rising to 5-7v. This is fast pulses on the scope so I cant be sure
on the values, but it looks like a few volts up/down.
These pulses might not be the ones that make the pic reset,
but they look really bad...

>The 100K pull-up resistors seem a bit high in value for a noisy
environment,
>especially on MCLR. I'd try a much lower value resistor pack, like 4.7K.
>For a quick test to see if MCLR is the problem, just short MCLR to VDD and
>see if the problem goes away
okay, this will be my first 'fix' !

Patrick J wrote:
>
> Hi, it seems this construction is sensitive to transients comming
> from a few 380vAC 3-phase motors when they switch on/off.
> The pic resets approx 5-10 times in 20 minutes.
> What can I do more to protect it against the transients ?
>
> In this application it doesnt matter so much that it resets,
> but in the next it will, so I must find a solution to this.
>
> I hope I doesnt offend anyone by attaching this small file,
> doing it in ascii art would just not be possible...

Thanks for adding the circuit Patrick. I think you
need to add at least 10uF after the 7805, but the main
thing is the 100k resistors! This is out of spec for
MCLR, and since you haven't shown ICSP on the circuit
I would just tie MCLR to the +5v rail.

Is your 0.1uF decoupling cap right across the PIC
power pins? On the bottom of the board is good.

Are your input switches more than a couple of inches
from the PIC?? They could be acting as antennas. Try
reducing the pullups to 1k, even 470 ohm if they are
further away. If it is not all in a metal box then
it should be if near industrial equipment, and if your
switches are external to the box you need to look at
series resistors and small caps on the PIC inputs.
:o)
-Roman

I had a resetting problem,
it was long leads on the input switches like roman suggested
I tried the resisters and the caps but didn't help me.
I finally solved the problem by using photodarlingtons close to the pic for
inputs.
hope this helps.
regards victor
{Original Message removed}

Well, there were on this topic a lot of usefull comments.
But I think you have a supply problem. Your solution to use the same
rectified and filtered stage for both 7805 and 7824 is almost curious !
Why do you have used optocouplers if all grounds are common and +5 ( for
microcontroller) and +24 ( for industrial process ) comes from the same
place ? +24V must be a floated supply to avoid noises from the process...
Also when all your led's will be all on, your 7805 will be warm ( maybe
hot).
Vasile

> Hi, it seems this construction is sensitive to transients comming
> from a few 380vAC 3-phase motors when they switch on/off.
> The pic resets approx 5-10 times in 20 minutes.
> What can I do more to protect it against the transients ?
>
> In this application it doesnt matter so much that it resets,
> but in the next it will, so I must find a solution to this.
>
> I hope I doesnt offend anyone by attaching this small file,
> doing it in ascii art would just not be possible...
>
>

> But I think you have a supply problem. Your solution to use the same
> rectified and filtered stage for both 7805 and 7824 is almost curious !

I only have 2 sensors that are relevant to this control problem so I use
the same powersupply to keep out all other transients that could enter
else. They are located just next to this pcb. <500mm

> Why do you have used optocouplers if all grounds are common and +5 ( for
> microcontroller) and +24 ( for industrial process ) comes from the same
> place ? +24V must be a floated supply to avoid noises from the process...

Oops.. theres an error in the schematic ! The +24V that is connected to the
optocouplers is _NOT_ supposed to come from the 24v onboard.. hrm
Tho, all it does is to go to the coils of 2 relays. Atlest it keeps some of the
transients from the coils off the pic's pins this way. (also theres protection
on the coils for the back emk)

> Also when all your led's will be all on, your 7805 will be warm
How about a heatsink, doesnt look like I need one tho.