Connect with us

PIC resets when powering fluorescent lights

Discussion in 'Electronic Basics' started by Richard Swinfen, Dec 2, 2004.

Scroll to continue with content
  1. Need some advice on powering a bank of fluorescent lights. My
    controller uses a PIC 16F876 to a 2803 Darlington array to power 10A
    240V relays one of which powers the 240v AC light bank. There are
    about 9 lights in the bank (my garage), ranging from 40W to 70W, each
    with their own starter, amounting to about 450W operating power.
    Other relays power other light banks lesser in number and operating
    power, with no problem.

    The problem symptom is a resetting PIC when the relay is fired. The
    same happens if the lights are powered by the original light switch.
    The problem cause I believe is inductive spikes during the lights
    power-up cycle. I have scanned the groups and can't see this specific
    problem being discussed. What is discussed has led me to try
    varistors across the load and across the relay contacts both at the
    relay. I think, by doing that, I am preventing the spikes from being
    inducted through the relay into the DC power lines, spiking the PIC.
    However, I have read that this might not prove a good solution if
    spiking is regular. In any case, it doesn't work, and in fact seems
    to cause the problem to occur more consistently now.

    I haven't yet attempted an RC snubber - not totally convinced on what
    I would be achieving with that and would prefer some specific advice
    on the problem first.

    If you can help, I would be most grateful.


  2. Obviously, the large transient voltages from the relay power side are
    getting back into the PIC. A good starting point would be a complete
    schematic of the whole system, so that we can discuss coupling
    mechanisms and fixes. Can you draw something up , get it converted to
    GIF format and post to alt.binaries.schematics.electronic? Or email
    it to me and I will post it for you.
  3. Good idea John - only my 'schematics' are more layout diagrams in my own
    'style'! Moreover the controller device does a lot more as a slave device
    for a multi-node networked home automation system, I wouldn't want to
    complicate the question. I do believe, perhaps naively, that a simplified
    device would have the same problem. I could knock up something that
    represents the area of the circuit that deals with this, but in an attempt
    to expedite an answer, I'll try to describe the rest of the relevant
    circuit. The PIC, 2803 and relays are powered by a 7805 with recommended
    caps on both sides (1uf & .33uf) itself powered by a 1.2A 12v regulated
    supply. Another possibly relevant point is that the PIC determines
    zero-crossing using a dirty-but-working 10MOhm direct live feed to RB0. I'll
    check removing this doesn't fix it.

    Does that help?


  4. The networked connections can complicate things, since they are all
    antennas that can feed spikes to the PIC. I big no-no is having any
    connections to the PIC go outside the supply rails, even briefly. The
    specs for the PIC are damage specs, not malfunction specs. You might
    try adding an additional 1 Mohm resistor between the 10 Mohm resistor
    and PIC, with a 4.7 volt zener at the junction of the resistors ot the
    0v rail. This will eliminate any positive input voltage above 4.7
    volts, and will limit the negative current ot a few tenths of a volt
    across 1 Mohm.

    What sort of circuit do you have connected to the reset pin of the
    Are any unused pins programmed to be inputs?

    What sort of relay driver circuit connects the PIC to the lamp relays?
  5. CBarn24050

    CBarn24050 Guest

    Hi, several things spring to mind. 1. decoupling capacitors. 2 RFI filter on
    the ac supply to the psu. 3. DC filter to the pic vcc pin, I use 100r +01uf cap
    (low pass) twice, that seems to kill everything. 4. Are you using the RB0 input
    in interrupt mode? don't. 5. write your software so that it recovers from
    crashes, ie use the brown out interrupt.
  6. John,

    The network connections are via a MAX485 which itself has a common ground
    with the other nodes. I could try eliminating all the comms connections as
    well, I guess. I have eliminated the live connection via the 10 Mohm with
    the same results (grounding the input). All other inputs are in use - in
    fact every pin is in use.

    I like the idea of the 1 Mohm + zener circuit you suggest - I'll add that at
    some point! I've used zeners for DC transient elimination on other
    inductive loads that I drive with the 12v line.

    I'm glad you brought up the reset pin. I should have mentioned that. MCLR
    has a weak pull up (10k) to 5v. I know internally it is filtered for short
    low pulses, but perhaps there is a weakness here? Perhaps a zener here to
    prevent inverted transients? Maybe it would still be brought low and cause
    a reset anyway?

    The relay driver circuit is very simple. Just direct PIC->2803 connections
    with direct delay driving from the 2803. Perhaps some filtering/protection

    You'll gather I have limited knowledge of filtering and protection, so your
    advice is gratefully received.


  7. 1. Can you elaborate?
    2. I could battery power the device first to determine if this would help I
    3. Can you explain exactly how you do this - a snubber across the vcc and
    gnd? What do you mean by 'twice'?
    4. Yes I do - but this is a rather handy feature of the chip - it is
    actually the only interrupt I use as the device is driven by zero-crossing
    logic to ensure timing integrity for triac control. All other interrupts
    are masked and polled instead.
    5. This seems to be a general comment - but a good one!

    I've stumbled across a discussion on EDABoard
    ( There seems to be some debate
    on the methods for snubbing the pic power lines. As I already filter the
    7805 regulator with a 1uF cap (as recommended somewhere), not sure what the
    effect of adding additional filtering with a smaller cap to the +5v supply
    is going to have? The 7805 sheet even suggests <100nF "might cause

    Also, on this thread there is a suggestion of increasing the current to MCLR
    to prevent a spike from bringing it low - seems a suspect solution and think
    I'd rather prevent the spike than just handle it.

    Don't get me wrong - I'm not adversed to trying things, just this device is
    used daily and uninstalling it is time consuming and I want to minimise the


  8. CBarn24050

    CBarn24050 Guest

    Subject: Re: PIC resets when powering fluorescent lights
    Its very important to place decoupling capacitors at the supply pins of the PIC
    0.1uF should do.
    You could but whats the point? Your flourescent tube needs 1500v to strike the
    remnant of that spike goes everywhere, line filters are just about mandatory.
    No, it's not a snubber it's a low pass filter. A resistor in series with the 5v
    line followed by a cap to 0v. The bigger the resistor the better it works but
    you get a bigger volt drop on the line so you need to minimise the PIC vcc
    current. You can put it upsteam of the regulator but it's not as effective.
    2 in series.
    It seems like a good way to do it but it isn't. Firstly you will get multiple
    interrupts at the crossing point, any stay noise pulse will cause you false
    triggering and the there is the mains "drop out" problem to contend with. A
    better way is to have the timer interrupt running at say 50uS, poll the
    crossing point input each time through the loop, and do some "debouncing" on
    the result to give you a reliable trigger. You can also generate your time
    delays and trigger pule steams at the same time.
  9. . 1. decoupling capacitors.
    Ok - will do.
    Point taken - and I should. But could this actually be causing a reset?
    Ok - sounds good - will definitely try that. Just need to determine the PIC
    current req's - shouldn't be too high.
    Ok - guess you have good reasons for doing this.
    Don't get multiple interrupts - logic debounces through required processing
    during interrupt (admittedly <50us worth). I also run a timer interrupt (so
    I lied about RB0 being the only one!), which is used for the triac timing -
    seems pretty reliable - despite heavy processing of comms and other logic,
    timing of triacs' output remains highly stable.

    What do think about issues around MCLR? Increasing current or more filtering
    on that pin. Or are you meaning to include MCLR when you refer to 'supply
    lines' above?

    Very grateful for your help.


  10. CBarn24050

    CBarn24050 Guest

    What do think about issues around MCLR? Increasing current or more filtering
    There are several circuits in the data sheets for the pin, or you can just tie
    it to the vcc.
  11. I would add a small capacitor between MCLR and the ground pin of the
    Id this what you are referring to as 2803?

    This sort of driver represents a connection between a relay driving
    supply and the logic supply. You should arrange the two supply
    connections at pin 9 to minimize the length of conductor that carries
    both logic signal returns and relay currents. When there are more
    than one of these chips, a true single point connection between the
    two supply negatives is not possible, but you can still keep this bus
    as short and heavy as possible (connecting all the pin 9s) and then
    tie both supplies to that bus.

    What is pin 10 connected to? I am assuming it is the relay supply
    positive. There should be a bypass capacitor between the relay supply
    positive and the pin 9 bus, one at each 2803 (pin 9 to pin 10) with
    the relay power line going out from that point, instead of from
    somewhere else along the positive supply line. That way, when a
    switch pens, the current through the loop out to the relay detours
    from the switch to pin 9 path to the bypass capacitor to pin 9 path.
    So the transient is contained outside the logic supply.

    Relay contacts bouncing while driving inductive loads like the lamp
    ballasts will generate lots of sparks and high voltage spikes and also
    take little bites out of the contact material. An RC snubber across
    the contacts or even an MOV will absorb lots of that energy.
  12. I'm glad you brought up the reset pin. I should have mentioned that.
    Yep - sounds like a good idea - and actually what Microchip suggest (now
    that I've read the datasheet properly!). Just got to extricate the board
    from the application and modify - argh.
    Yep - although in this application, I only have one array - suffices for the
    number of relays that need powered.
    I do try to keep the relay power lines fairly independent (in wiring terms)
    from the logic supply - however, they do both use the regulated +5v, so
    there are limits!
    Pin 10 is not directly the supply +ve to the relays, but as above, they are
    both derived from the 7805. More bypass capacitors sound like a good idea
    though. What size for this purpose? Not sure what formula is proposed
    here. 0.1uF again?
    Yes - sparking is a concern but the MOV's in place should help. Clearly more
    filtering to protect the logic line is the way to go, though. I suspect,
    though have yet to prove, the main problem is the weak pull-up on MCLR and
    will address that with a lower resister and addition of the cap.
    Thanks again,

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day