Comments on your schematic and circuit:
- A 7805 is not designed to handle the full range of car power, including short high voltage bursts. This has been mentioned to you before. See previous answers for details.
- You have D1 the right way around, but I would make it a Schottky. Those react faster and will be fine for these relatively low voltages.
- Fix the schematic to be less of a ratsnest. Traces worming their way all over the place makes it hard to read. See https://electronics.stackexchange.com/a/28255/4512 for details.
- Fix the schematic to add part values! You seem to have mentioned some of them in the text, but I'm not going to remember everything you said when looking over the schematic. Do it right, especially since you are asking others to look at it.
Without part values, it is difficult to critique anything but the overall topology. That seems OK, within the detail provided by the schematic.
Added after schematic cleaned up:
That's a lot better. It looks basically OK.
I didn't look up the maximum input voltage of the LM2576. Check that it can handle car power glitches.
The 12 V sense lines driving the PIC inputs look fine.
Check that the BC547 can support the relay coil current with a 10 kΩ base resistor driven to 5V. That should provide about 430 µA base current. If the minimum guaranteed gain of the transistor is 50, for example, then this can support up to 21 mA collector current. That's cutting it close if the relay needs 20 mA, and of course is insufficient if it needs more.
Probably the 120V is sagging when the relay load turns on. You might be able to fix this with 120V wiring improvements. It sounds like a bad condition to begin with.
Another option is to use a diode and cap to hold up the 12V rail during interruptions. To solve this problem analytically, you would want to know:
- How long is the interruption on the 12V output
- What voltage drop from 12V is allowable before the system will not function reliably
- How much current is consumed by the load
A diode (Schottky) which might work is the SR202. I found this on digikey doing a quick search. Other options will work also. Make sure the diode can handle the normal load current.
The way to choose the cap is as follows:
- dt = time of interruption
- i = current consumed by load during interruption
- dV = maximum voltage drop board will tolerate.
- Vf = drop across diode due to load current
C = i * dt / dV
A note about dV: the diode Vf affects dV. When you calculate the maximum voltage drop, you need to consider that the starting point is 12V - Vf. So if Vf is 0.3V, you will be starting from 11.7. If the board works down to 9V, then dV = 11.7 - 9 = 2.7V
Round up or tack on a little extra capacitance for margin. When you calculate the required capacitance, you will see whether it is practical to solve the problem this way.
If you don't know any of the required information, and you can't easily obtain it, you could just try bigger and bigger capacitors until the problem goes away or you give up. In that case, I would start with 220uF aluminum electrolytic. Make sure the voltage rating is high enough. I would probably just use a 20V or 25V capacitor. If you find a value that works, you might want to go up a little bit from there to give yourself margin. If the capacitance value becomes ridiculous, you should probably consider another solution. Large capacitors can cause large inrush current when the power supply is first connected, and this can lead to other problems.
Best Answer
You need to connect the diode the correct way (reverse biased, as shown), otherwise it will indeed conduct when the SSR turns on and likely destroy the SSR and quite possibly the diode.
When connected as shown, it is reverse biased until the SSR turns off, upon which the inductive load will cause the diode to become briefly forward biased until the energy in the magnetic field is absorbed by the coil resistance and diode forward drop. Otherwise the voltage across the load would increase to potentially damaging (to the SSR) levels.
Consider the below schematic- the switches represent the SSR and the stuff in the boxes represents your pump motor.
simulate this circuit – Schematic created using CircuitLab
The switches open at t=0 and current is 1A through each circuit at that time. As you can see in the below simulation, the voltage across the switches increases to a bit over 12V and then drops back to 12V when the diode stops conducting about 2.5ms later.
If I remove D2, the difference is dramatic:
The voltage across SW1 spikes to about 900V, before dropping back.