The usual way would be to proof your suspicion or to exclude it.
Standard is using an oscilloscope, connect to PSoC GND and VCC, measuring AC and looking for spices when the relay triggers. Probably (Test that, too) there are spikes even when the relay switches no load. If switching the load is the cause a very elegant solution could be to perform switching when the voltage is (near) zero.
Two potential problem areas -
1) If load generated switching noise you have to split grounds to make
sure load current does not generate IR drop logic signals back into PSOC
by raising a GPIO pin. As well large currents imply large magnetic fields,
so single turn loops created by layout practices create transformer coupling
back into GPIO. Additionally you can have e field coupling via parasitic C be-
tween load current traces and a GPIO pin. Where you can afford to burn power
terminate GPIO inputs in low Z to reduce coupling.
2) If relay actuator coil transients, generally speaking its relay coil turn off that produce
large transients. Make sure you have a reasonably fast diode across coil to handle
back emf. Diode must be rated for max coil I. DSO can be used to confirm diode
speed is clamping.
Some useful info on layout practices -
Another thing to look for are drops in the supply voltage - maybe the relais just need too much current so the PSoC loses power. This can be resolved by using proper decoupling capacitors on the PSoC power lines.
The best bulk caps to use these days are polymer tantalums, they
have a f vs esr curve much better than regular tantalums, and much
less C degradation with applied V.
And as always a good ceramic .1 uF (some cases also a .01 uF as well) in
parallel with bulk cap. MLC cermamics pretty good for this.
Thank you very much for your help!
I did add diode with the relay.
I think it is possible due to the chip power drop. i use regulator to regulate 12VDC to 5VDC. The V5.0 is connected to PSoC chip VDDD, and also it is power supply of the relay. While in USB communication connector, there is a Schottky diode also connect to V5.0. I am not sure whether this cause the problem. Now i have removed the schottky diode.
PSoC2.jpg 92.7 K
I do not think the Schottky diode was at issue, and it is used to isolate the Vbuss
from other power sources, eg. from back feeding Vbuss and forcing Vbuss out
I would advise leave that diode in place.
Thank you for your reply :)
Sorry, just to confirm, the Vbuss you mention, is USB gnd?
I removed the diode connected to V5.0, since i thought it is used to supply power to the chip. is this understanding correct?
Vbus is USB self powered supply buss, 5V.