Pic reseting when switching mains current with relay


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Location
    Reading, UK
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Thanks

    >> If you didn't change the default config fuse while loading the Bootloader firmware the first time, you can't modify them later in your code.

    I know! :-) But I'm quite happy with that fuse configuration right now... unless it's a factor in my problem.

    >> Yes the snubber will help!
    >>
    >>also

    >> * Make sure you have connected both PIC VSS pins.
    >> * Make sure you have disable the LVP mode
    >> * Set all unused i/o to input and connect ALL of them to GND
    >> * i would add a 47-220 uF on the PIC VDD line as well (close to the PIC)
    >> * Place your PIC away of your relay to see what's happen.

    Ok, I'll try all of the above. But I'd like to understand why connecting a 47 Ohm resistor across the relay output (as part of the snubber circuit mat suggests) is a good thing -- surely it'll allow a current to flow all the time. Or have I misunderstood something?

    Thanks again...

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Mat suggested a RC snubber, so it's a resistor in Serie with a capacitor, so will flow only for a short period of time.

    You may find some explanation in the following document
    http://focus.ti.com/lit/an/slup100/slup100.pdf

    I would prefer to switch on the AC zero crossing to extend the relay contact lifetime...

    OR you may decide to use some SSR... a bunch more expensive...

    EDIT: ah crap, i'm late

    Also, probably a nice idea to place some 0.1 uF in parrallel with each realy coil + 100-470uF & 0.1uF on their VDD line.
    Last edited by mister_e; - 3rd February 2007 at 15:14.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Sep 2006
    Location
    Reading, UK
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Thanks for all the suggestions - I'm blown away by how quickly people have responded.

    Ok, I've added the snubber and it's immediately eliminated 90% of the resets. I can now turn the relay on and off with the light connected and it works. Strangely I can still produce a reset if I switch the mains on and off at the socket, even when the light is NOT connected. And I've still had one or two random resets.

    I'll try connecting up the other VSS pin and adding the 47uF cap to the PIC power supply to see if that gets rid of the remaining resets.

    >> * Set all unused i/o to input and connect ALL of them to GND

    Is this something I should do whenever dealing with PIC, or only when dealing with mains voltages/currents? What's the rationale here? I'll try the other steps first since this is going to require me to produce a new PCB!

    >> Also, probably a nice idea to place some 0.1 uF in parrallel with each realy coil + 100-470uF & 0.1uF on their VDD line.

    ok, I'll do this too.

    One other question: While reading up on this I've heard lots of talk of ground planes. Is this simply a large area of copper on the board which is tied to ground, or does is have to be an entire layer on the board (impossible in my case since the board is single sided). And how do they help (and indeed could they help in my case)?

    Thanks again.

  4. #4
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Then put also a snubber network on your mainssocket and mainswitch!

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    lsteele, I notice that your relays are powered by 5 volts. Is the source of the 5 volt supply the same as the PIC? If so I would have a separate supply for the relay source and a separate supply for the PIC. From what I have seen in the past you are working with electromechanical devices that have magnetic coupling and when you are opering the contacts the field is being coupled to the 5 volt supply the micro it is being powered from. If this supply for the relay source was separate and the ground paths are correct I see no problem with the operation of the relays switching the mains.

    Dave Purola,
    N8NTA

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    I meant to say use BOD_OFF.

    Most likely!

    -----------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  7. #7
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Question

    hello ,
    I'm having a similar problem.
    I have made a 7seg LED clock (PIC16F628 @ 4Mhz).
    The clock resets when i switch on the tube light in my room.
    The clock and the tube a not linked to one another in any way.
    I was using a wall adapter before to power it, but even after i replaced it with a 9 volt battery, the clock still resets when i switch the tube on.
    What could be the reason for this ? ? ?

Similar Threads

  1. Reducing PIC current to as low as possible...
    By FromTheCockpit in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th November 2009, 04:28
  2. Replies: 24
    Last Post: - 7th November 2008, 04:41
  3. Serial Relays
    By tazntex in forum General
    Replies: 3
    Last Post: - 17th May 2007, 17:42
  4. Detecting mains current
    By lsteele in forum Schematics
    Replies: 3
    Last Post: - 13th January 2007, 14:48
  5. High current switching output
    By Tissy in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th September 2005, 14:06

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts