Using an op amp as a voltage comparator

If you have an Ohm meter, you can measure the coil resistance of your relay. The static coil current will be the vehicle's nominal system voltage, about 14.5 V when running, divided by this resistance. I'd expect the coil resistance to be something like 50 to 100 Ohms, so a nominal coil current on the order of 200 mA.

One thing that follows from this is that a 2N3906 PNP transistor has specified performance to 100 mA, so you probably want to select a part with higher current capacity.

Bipolar transistors are current controlled devices. The current that can flow from collector to emitter is proportional to the base current. Transistor datasheets typically give a set of curve showing the nominal relationship of these two currents. I've attached an example (this is from a ON-Semiconductor 2N3906 datasheet). The curves show the relationship of collector-emitter voltage drop VCE versus base current IB for a handful of collector currents IC. For example a base current of 6 mA with a collector current of 100 mA (the rightmost curve), gives a VCE of about 0.3 V. For a switching application one wants a small VCE so most of the voltage is dropped across the load (your relay) and less power is dissipated in the transistor.

The design process then goes something like this:

  1. Determine the load current. In this case it is nominally the system voltage divided by the coil resistance.
  2. Select a transistor spec'ed to at least this current. It's good practice to use a device spec'ed to at least twice the nominal current.
  3. Calculate the base resistor value to get small VCE at the load current. To get the 6 mA base current for the example above, the resistor should be no greater than about 12 V/6 mA = 2000 Ohms.