PIC resetting in car

Discussion in 'The Projects Forum' started by Dan2, Jan 17, 2009.

  1. Dan2

    Thread Starter Member

    Oct 16, 2008
    19
    0
    i have built up an alarm for a car using a L7805, pic 16F84 and 2relays. one relay immobilises the car, the other relay switches the horn on and off as an alarm. a remote reciever arms and disarms the alarm, but the pic runs continuously.

    if you hold the horn on for a while, the alarm arms and immobilises the car (which it is programmed to do at first turn-on, which is why i think the pic is being reset) i cant understand this because there is a seperate wire run from the battery to the regulator (i did this because i did have problems using one wire to the regulator and the horn), and the 12v to operate the horn is isolated from the circuit by the relay.

    does anyone have a clue as to why this is happening??
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Can you post your circuit please.
     
  3. bertus

    Administrator

    Apr 5, 2008
    15,638
    2,344
    Hello,

    Here is a PDF from microchip on power conciderations and one on reset problems.

    Greetings,
    Bertus
     
  4. Dan2

    Thread Starter Member

    Oct 16, 2008
    19
    0
    thanks for the replies, i will draw up a schematic soon.
     
  5. Dan2

    Thread Starter Member

    Oct 16, 2008
    19
    0
    so this is the circuit as it was when there were problems. i have now put in a LED on the 5v rail to ensure the regulator is loaded - i am hoping this was the problem but im not sure

    just checked now i forgot to show that the relay coils are 5v and run off the regulator. when the alarm is deactivated none of the relays are on, when the alarm is activated the immobiliser relay is on. when the alarm is triggered long pulses are sent to the relay to trigger the horn, which is connected to the horn switch in parallel for normal hooting.

    the led in the schematic is a flashing led to show that the alarm is activated

    all inputs are active low, through the diodes. these diodes are there because the door switches (when the doors are closed) float at 12v.
     
  6. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Is the horn 5W?
    Do you have a heatsink on the 7805?
     
  7. Dan2

    Thread Starter Member

    Oct 16, 2008
    19
    0
    i have no idea on the wattage of the horn, and i do have a heatsink on the regulator.

    i hooked up the circuit today to the car, only to find it does the same thing. this time i put on the lights, and when you turn the lights off, the pic resetts also. i have put a LED on the 5v side of the regulator and i saw when i put the lights on (brights only), the voltage from the input to the regulator (12v) drops to about 3v, and the led on the 5v side switches off. when i turn the lights off, the pic starts up again.

    i was gonna do some more testing to see what was going on when the pic decided to do its own thing. now, no matter if the doors are open or closed, when u arm the device, it goes to alarm mode!

    so i thing a pic is just not suitable for use in a car - or my dad's car has some kind of curse on it!!
     
  8. bertus

    Administrator

    Apr 5, 2008
    15,638
    2,344
    Hello,

    I do not see the two smal capacitors near the 7805.
    Mount a 0.1 μF capacitor at the input to ground and one at the output to ground.
    This will prevent the 7805 from oscillating (and possibly reset the pic).
    Also mount a 0.1 μF near the power connections of the PIC.

    Greetings,
    Bertus
     
  9. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    Bertus is right about the capacitors because you use long wires in the car which have significant inductance and may cause oscillations.
    If the 12V drop to 3 volts then the problem is with the car wiring and not with the PIC.
     
  10. Dan2

    Thread Starter Member

    Oct 16, 2008
    19
    0
    ok thanks, i think i will have to start this project over from scratch.

    so if i hook up those caps to the 7805 and PIC, then i can safely say the 5v power supply is stable. do i need a minumin current to be drawn from the regulator???

    i will probably wire the alarm circuit directly to the battery.

    now for the problem of the pic, i have just checked it on the development baord, and it seems that the internal pull-up resistors aren't working on some of the pins. i tried to reload the program onto the chip but that made no difference. is it safe to say i have stuffed up that chip? could it hav been from the regulator oscillating??
     
  11. bertus

    Administrator

    Apr 5, 2008
    15,638
    2,344
    Hello,

    Normaly the regulator works with all loads upto 1.5 A (depending on type.
    I have attached a datasheet for the 78XX series.
    In this datasheet they use 0.33 μF at the input and 0.1 μF at the output.
    (see figure 10).

    Greetings,
    Bertus
     
  12. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    I think the problem is the current the horn draws. It overheat the regulator of it draws more than 1.5Amps and the regulator goes into current limit or shuts down due to overheating.
     
  13. Dan2

    Thread Starter Member

    Oct 16, 2008
    19
    0
    horn runs straight off the battery, all the regulator drives is the PIC, the 2 relays, a flashing LED and a normal LED. i tested the current draw at maximum to be +-200mA.

    I will get the caps soon and see if that solves the problem. thanks everyone for your input - hopefully i will reply with good results ;-)
     
  14. mitch2

    New Member

    Jan 23, 2009
    2
    0
    You might want to consider using a LDO regulator such as an LM2936 instead of the LM7805. Car voltages will dip significantly under spike loads and this might be your problem (have you scoped out the voltage when the horn or lights switch on?).

    Mitch
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    A 7805 regulator requires a minimum 5mA load on the output to maintain guaranteed regulation.
     
Loading...