MCU reset when relay is on, dip in supply

Discussion in 'Embedded Systems and Microcontrollers' started by Vindhyachal Takniki, May 17, 2016.

  1. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    348
    6
    I have to drive ac load through relay by micro controller. Problem is MCU reset as power dips when relay is on or off.
    Relay contact is 220Vac/50Hz. My circuit is follow:

    1. TO power the MCU I have +5V supply from SMPS of 2A(current is more than enough).
    2. There is separate isolated 12V in circuit.
    3. MCU pin drive opto, which Then turn on relay by 12V which turn on/off the laid.
    4. problem is there is huge dip in supply which caused MCU reset. Although I have isolated 12V & 5V supply.
    I have placed a diode in series of +5V also, no effect.
    Huge parallel capacitors 1000uf/470uF/10uF/0.1uF very close to MCU supply but no effect.
    There is free-wheeling diode on relay & relay card is separated from MCU board, jumper wires connect two boards.

    5. One thing I have noticed that there is dip only when load is connected across relay, if load is disconnected then there is no dip in supply, relay turn on/off correctly.
    If I connect load across it even a zero watt bulb even then dip happens

    6. I dont understand that when +5V & +12V are isolated then why there is dip in +5V supply? There is huge spike across +5V supply.
    7. I haven't tried snubber across the relay load contacts, since it is ready made relay board.

    What could be the problem.
     
  2. Robin Mitchell

    Well-Known Member

    Oct 25, 2009
    732
    199
    Could need some form of filtering or choke. Could you post a schematic to help give a better idea of whats going on? A sketch should be OK
     
  3. ericgibbs

    Senior Member

    Jan 29, 2010
    2,499
    380
    hi,
    Incorrect routing and assignment of 0V , ground paths is a common problem.
    How are the 0V lines connected from the power supplies to the various modules.?
    Do you have a photo of the project you could post.?

    E
     
  4. nerdegutta

    Moderator

    Dec 15, 2009
    2,514
    784
    Perhaps you need a transistor to drive the relay. A schematic would be nice. :)
     
  5. Dodgydave

    Distinguished Member

    Jun 22, 2012
    4,965
    743
    Circuit diagram, photos, of your work would be better...
     
  6. crutschow

    Expert

    Mar 14, 2008
    12,974
    3,220
    I also suspect some sort of grounding problem.
    It would seem the two circuits aren't as isolated as you think.
    Is the 12V ground totally separate from the 5V ground?
    What type of power supply generates the 12V?
     
  7. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    348
    6
    One is from smps: +5V
    other is transfomer & diode bridge: +12V.

    I will post the schematic later
     
  8. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    348
    6
    It is a spike. Max voltage goes upto 25V or so & dips to -10V or so when checked on CRO. THough I have long ground probe of CRO around 30cm. Attached is the screenshot.
    I will paste the schemtic also. But isolated smps +5V powered MCU drives +12V opto which then drive a relay. SMPS is 3.5A.
    If I disconnect the load no spikes however even if small bulb is connected there is reset problem.
    Relay are of OMRON with free-wheeling diode on it.



    Problem is there is lcd(20x4) connected which start showing something giberish. Although MCU keeps on operating i.e driving outputs/input led/switch.
    I have assumed that MCU reset since I see gibbberish on LCD.
     
  9. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    We are nine posts into this thread and still no schematic diagram. I feel that I need to impress upon you the need to lead with a schematic when you have a problem, otherwise help may be a long time in coming if at all.
     
  10. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    348
    6
    actually i out of lab. i will post it as soon as i can. it is pc over there
     
  11. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    I guess I'll wait in the corner while you take your sweet time getting your act together.
     
  12. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    348
    6
    1. Attached is the ckt.
    2. I had found that in actual board while making ground of +5V & +12V are shorted together.
    Relay is on other board then MCU itself.
    I have noticed that its not the MCU which gets reset but first a line get printed in gibberish which printed ok if load is not connected. Then everything printed on lcd is gibberish.

    Load is a bulb of around 15W.
    I have two ckts one uses PIC16 other uses AT89C51, both misbehaving in same way.
    And problem occurs only when load is connected if load is removed & relay is turned on/off then there is no problem.
    In my above post I have shown the spike in MCU supply(though CRO ground lead is large.)
     
  13. nerdegutta

    Moderator

    Dec 15, 2009
    2,514
    784
    No crystal?
    No capacitors?

    It is important to post you complete circuit, or at least a focused picture!
     
  14. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,671
    899
    Agree, there seem to be some missing components. Now, when I review the original question:
    and that circuit that has now been provided. There is optical isolation. So, I wonder whether the AC load (a motor?) is so much that it causes lights in the building to dim when it comes on. That with a poorly regulated 5-V supply could cause the MCU to reset.

    How big is the AC load? What is it? Do the building lights dim when it comes on?

    EDIT: As an experiment, try running your MCU from a separate battery pack.

    John
     
    Last edited: May 18, 2016
  15. ScottWang

    Moderator

    Aug 23, 2012
    4,850
    767
    Already 14 posts, but still can't get into the point, should we lock the thread temporary until the TS reread all the posts and mentioned points, and prepared the completed schematic and click the report button to continuing the discussion?
     
    Brevor likes this.
  16. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    348
    6
    1. Attached are the images of project.
    CRO probe photo has very small ground wire on it for measurement.
    All CRO photos are taken through it.
    One of PIC has lcd problem which is shown.

    Wire from +5V smps runs around 75cm before going to board.

    2. Earlier I had left lcd(20x4), pins D0-D3 left floating. I am using lcd in 4 bit mode. But then I short them & grounded them, I saw problem even rises more & lcd hangs more.

    3. Due to these spikes many times AT89C55 hangs but PIC didn't hang it keeps on operating, I have disabled PIC's BOR. But in both cases lcd shows gibberish or all black lines as in attached pics.


    4. Attached is the ckt. Its not exact pin to pin. But connections are like this only.

    5. Tomorrow I will try by placing a series diode after +5V then a ferrite bead & then decoupling cap of 10uF. Bith in +5V & for +12V.
    Also will placed EMI filter capacitor in parallel i.e a 0.15uF cap & 1M in parallel at 220Vac input of SMPS.

    Then will note the results.
     
  17. nerdegutta

    Moderator

    Dec 15, 2009
    2,514
    784
    Why have you connected VCC (U17s PIN 40) to ground? With an electrolytic capacitor?

    Is this a little bit high for a decoupling cap? Other circuits I've seen use 0.1uF ceramic capacitors.

    I'm not able to do anything useful with the pictures. Too dark and out of focus.

    I think the TS will make a proper schematic, and clear enlightened pictures.

    Time will show. :)
     
  18. ScottWang

    Moderator

    Aug 23, 2012
    4,850
    767
    Yes, everyone joined this thread all waiting these.
     
  19. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    348
    6
    Attached is the schmetaic. I had tried another board with ST MCU, but same result.
     
  20. ScottWang

    Moderator

    Aug 23, 2012
    4,850
    767
    LED1 -- It is a indicator for the status of relay.
    Q1 -- Choose a Ic current big than 3 times of relay.
    R3 -- Adjust the values according to the current of relay.
    R2 -- It is a pull low resistor to turn off the Q1 quickly.

    PC817 to drive 12Vrelay_ScottWang.gif
     
Loading...