Power relay spikes reset PIC

Discussion in 'The Projects Forum' started by Russell, Sep 20, 2006.

  1. Russell

    Thread Starter New Member

    Sep 20, 2006
    Hi All

    This is the first PIC project I've attempted.

    It is a timer which turns on and off various devices (up to 15A) which run from a car supply. The PIC is powered from the same supply using a 78M05.

    It worked fine on the breadboard and the PCB worked fine too. Unfortunately when I connected the output relays - conventional automotive relays - I encountered a problem which is that when the relay turns off the PIC resets -presumably due to the back emf as the current in the coil decays.

    I have a couple of ideas:

    1. put a diode on each relay - I've found a reference that suggests the back emf could be as much as 200V - but presumably the diode should stop it getting anywhere near that so that with an 80 ohm relay coil an IN4001 should be adequate?

    2. Do something to the power supply to smooth out the spikes. I've been playing with capacitor values on the input of the 78M05 (up to 2.2uF)(datasheet recommends 0.33uF) but this doesn't seem to make any difference. I haven't got much space on the PCB. Could I use an electrolytic as during spikes it will be the wrong polarity?

    I'd be grateful for any suggestions or ideas.

    Thanks for reading.

  2. Papabravo


    Feb 24, 2006
    We can't tell what's going on without a schematic.
  3. hgmjr

    Retired Moderator

    Jan 28, 2005
    Greetings Russell,

    It would be helpful if you would provide a schematic.

    You should definitely add the flyback protection diodes across the relays. There a strong possiblity that the flyback voltage may damage the device you are using to drive the relays.

    Another precaution should be the careful routing of the ground conductors. A single point ground scheme is always a good practice.

    And it would not do any harm to make liberal use of capacitors to filter the power supply. In addition to several large polarized filter caps, small 0.1 uFd/25Volt caps should be used physically near each of the IC packages to provide better high frequency filtering.


    PS. Welcome to the forum.
  4. Russell

    Thread Starter New Member

    Sep 20, 2006
    Thanks for those comments.

    I've attached the schematic for the board. The PIC is driving 5 reed relays which then drive 5 power relays (off board not shown). There are some connection points for a couple of off board push buttons.

    I used the reed relays because they were easy and kept the 12V and the logic separate as I thought (clearly mistakenly) that this would avoid problems.
  5. multi

    New Member

    Sep 21, 2006
    Hi Russell

    I had seen your schematic diagram ,I would like to suggest you to add RC across relay coil which will be across freewheeling diode.You can use R values
    say 47E,1W and C should be around 0.1uf to 0.2uf non polar.

    Also better you add one more condensor say 10uf/25vdc to the output of regulator.
  6. Russell

    Thread Starter New Member

    Sep 20, 2006
    Oops just spotted an error that crept into the schematic while I was shrinking it. C4 should have one end connected to ground rather than 12V.

    Thanks for those suggestions Multi. I hadn't thought about a cap on the regulator output as I was thinking about cleaning the input.

    Why do you suggest RC across the diodes.

  7. Spoggles

    Well-Known Member

    Dec 2, 2005
    One other thing you may want to investigate. You may not have loaded the output of the 7805 regulator chip sufficiently to insure that it is regulating. These devices require a minimun load of 5ma. You may want to consider puting a 1k resistor on the output to insure at least a 5ma load at all times.
    Also, there are lots of 8 output 20 pin 'dip' drivers out there that would take up alot less space and probably be more reliable than reed swithces.

  8. Russell

    Thread Starter New Member

    Sep 20, 2006
    Thanks to all who replied. It now seems to be working OK.

    I've added the diodes to the relays, put a 50uF cap on the regulator output and added a resistor to load the regulator better (the resistor also discharges the cap if I want to turn off and on to reset).

    Thanks again.

  9. drummermalti

    New Member

    Feb 1, 2008
    I know that this might be too late but... Can you please send me some sort of schematic of how you connected them? Thanks!
  10. SgtWookie


    Jul 17, 2007
    This thread is over two years old, and the original poster has not been active here since then. It is not likely that you will receive a response from him.

    But basically, you would connect a diode across each relay's coil connection. The diode is connected so that it will not conduct when the relay is energized, only when the coil is de-energized to take care of the reverse-EMF that occurs when the current through the coil of the relay is interrupted.

    If the diodes are slow types (like 1N4004's, etc) you may want to use a small capacitor across the diode; say 330pF. This will give the diode more time to turn on.