# Problem with voltage comparator with relay

I'm making a circuit to alternate its input, depending on the voltage that's feeding the system. I used a voltage comparator with a transistor and a relay to do this:

The simulation works pretty well, but when doing it in real life, I have already burned 2 op-amps. I noticed the resistance between pins 3 and 4 got pretty low (from like, 1k to 20 ohms after the op-amps were burned).

I was trying to understand what the problem was, and by making some changes in the simulation (image below), I noticed that pin 7 is somehow with the same voltage of the BAT1. Like in the image below, the simulation starts with the relay contact already changed. I don't know if it is the problem, but it might have something to do with it. I can't understand what's happening.

When I tried to change the pin 7 connection to BAT1, it seems like it works. But my idea was to preserve the voltage from V1 (it would be a photovoltaic panel to feed the load, if there is no power, then the load wouldn't be fed).

• A small comment on the schematic. In general it is well laid out. The exception is Q1 which is drawn upside-down. The emitter should be on the ground side so that voltage decreases from the top of the schematic to the bottom. It would also avoid two wire-crossings. Putting Q1 right directly under the relay would make it even better. – Transistor Aug 30 '19 at 6:06
• Thanks, I'll take care of it next time. – João Victor Aug 30 '19 at 13:12