PIC resetting in car

Thread Starter

Dan2

Joined Oct 16, 2008
19
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??
 

Thread Starter

Dan2

Joined Oct 16, 2008
19
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.
 

Attachments

Thread Starter

Dan2

Joined Oct 16, 2008
19
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!!
 

bertus

Joined Apr 5, 2008
22,270
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
 

mik3

Joined Feb 4, 2008
4,843
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.
 

Thread Starter

Dan2

Joined Oct 16, 2008
19
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??
 

bertus

Joined Apr 5, 2008
22,270
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
 

Attachments

mik3

Joined Feb 4, 2008
4,843
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.
 

Thread Starter

Dan2

Joined Oct 16, 2008
19
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 ;-)
 

mitch2

Joined Jan 23, 2009
2
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
 
Top