When you're putting together a so-called "Car PC", by which we usually mean a contemporary ATX-derivative computer installed into an automobile, you have a few hurdles to cross. The enclosure, interface, storage devices, and even the power management all become special problems. The power problems can largely be solved through the use of a Wide Input picoPSU, but what about systems outside of a 120W envelope, or systems where you need to switch more than the PC power? The answer is just one typical automotive relay.
The reason power is a problem for the average Car PC is that the average PC doesn't like to have power taken away from it before it's ready, but you don't want to leave circuits connected to the battery if it's not necessary because a drain in the system can drain the battery and cause the vehicle not to start. Ideally, the system would be clever enough not to power up if the battery were below about 12.2 volts or so, which indicates a significantly drained condition, but that's a subject for another time. What we want to accomplish at the moment is just keeping the PC on and connected to the battery just until it's ready to shut down, and letting it cut itself off from power completely afterwards. As well, we'll be able to connect other peripherals into the power system, so we could power the screen only when the PC is on1 or power a wireless access point on the same basis, a great way to handle networking. We can keep the PC going with one ultra-cheap and easily replaceable relay.
The relay was once the basis of nearly all electrical control circuits in which a small amount of power controlled a larger amount. They consist of a magnet mounted to the armature (the moving part) of a switch, and an electromagnet which can push or pull on that magnet, and change the switch connection, as well as a spring which keeps the switch either "normally closed", meaning that electricity can normally flow through the switch, or "normally open", meaning that the switch will not allow power to flow. A relay can be normally open and normally closed at the same time: it can have one set of contacts which is normally open, and one set which is normally closed. Most common generic automotive relays are designed in this way.
An automotive relay is designed to be triggered by a fairly wide voltage range: it's expected that a car battery in marginal condition might sometimes dip as low as 8 volts, and a charging system operating normally can produce in excess of 14 volts. Our PC power supplies conveniently produce a broad range of operating voltages including 12 volts, which can reasonably be used to trigger one of these relays. Most automotive relays seem to have a triggering current (the amount of power needed to turn them on) of around 50mA, which is by no means a strenuous load to add to our PC power supply.
A typical "Ice Cube" automotive relay, also known as a "Bosch" relay after the originators of the most common design and most commonly copied connector layout, has five male spade terminals on its underside. You can connect to these with common and inexpensive crimp-on female spade connectors, poke wires through the holes and solder them on directly, or use a socket with pre-wired connections. I was able to acquire a (dubiously) 40A-capacity 12V relay and a socket with properly color-coded wires from a US seller on eBay for under $5, shipped.
What does "properly color-coded wires" mean, anyway? First, you need to know that the five pins on the relay are numbered 30, 85, 86, 87, and 87a, and what they do: pin 30 goes to the "center" of the switch, while pin 87 is the normally-open switch contact, and pin 87a is the normally-closed one. Pins 85 and 86 are connected to the electromagnet which engages the switch; pin 30 normally connects to pin 87a, but when you ground 86 and connect 85 to 12 volts, pin 30 gets disconnected from pin 87a and connected to 87. On our socket, pin 30 is a blue wire, 87 and 87a are yellow and red respectively, 85 is white and 86 is black. The relevance becomes clear if you compare these colors to a common car stereo chart: black is ground, red is accessory power, and yellow is battery power. After that things break down a bit, because blue is usually the output power to turn on a remote amplifier, and white is a speaker wire color, but the power wires having the "proper" colors is still a significant convenience. The black wire does get grounded, while the white wire is connected to 12 volt power coming out of your power supply. In my case, I used the +12V line which goes to the floppy power connector. I should only need the +5V line to run my SATA to CF adapter.
Regardless of your color codes, what you want to do is run pin 30 from your relay out to your PC power supply. In my case, that's a power converter, which then feeds my PC power supply. a PicoPSU 120, which does not have a wide input range. It is quite picky, in fact, about getting input power very close to 12V, and will shut down for over or undervoltage. This is not a problem in my context, since my WAP also requires 12V power, but you would want to use the wide input power supply in most cases. If your PC requires more than 120W, then you could use the same relay trick to switch power to an inverter, which in turn would drive your PC's power supply. The PC "talks back to the relay" on pin 85, while you ground pin 86. Now connect pin 87 to battery power, and pin 87a to accessory power.
Those last two instructions, regarding pins 87 and 87a, could themselves fill a blog post, and if you google around for people looking to connect their red and yellow stereo wires, they probably will. Where to connect these wires is a matter of concern because you have to account for how much power they will carry, and if you graft onto your vehicle's existing electrical system, you can easily start blowing fuses. The good news is that the only wire which will carry a lot of current is 87, the constant battery wire. Again, that's the yellow wire here. The best practice is to make a new "home run" to the battery with a proper length and thickness of wire — the proper thickness varies with the length and the current carrying capacity. The wire connected to 87a will only have to provide standby power. Once the machine is powered up, the power supply will put 12 volt power out in a number of places; convenient examples include the ATX12V connector when present (which you may not be using for a low-power PC) or the yellow drive power wire. Since you will connect that to pin 85, that will activate the relay when the PC turns on. That in turn will switch your PC's power input from pin 87a to pin 87, which will provide direct battery power. You want to include a fuse on this wire someplace between the battery and the place where the wire passes through the body to enter the vehicle and approach the PC.
Connection of the accessory power wire provides a great opportunity for creativity. If you are installing a pop-up screen, you could rig the screen release (or any activation signal) to a switch which brought battery power to this pin. You could easily wire in a switch or button to activate the system only when you want it. You might reasonably wire it to your stereo's amplifier activation signal, although these often have very low power delivery ratings and you might need connect that wire to pin 85 on another relay, connected much the same way this relay is connected. You could also just connect this to the same wire which powers the stereo in your car; just don't connect your constant battery wire here, as you will certainly blow the radio fuse.
For testing, you can use an ATX power supply to provide a steady 12 volts. Most AT power supplies didn't supply very much 12V power, so unless you need a lot of 5V you've probably thrown those away already. To get an ATX power supply to turn on without being connected to a computer, look for the green wire in the middle of the ATX power connector. If you use a jumper wire (say, a twist-tie with the ends removed) to connect that green wire together with a black wire (there is one right next to it) the power supply should fire right up. Get ground from any black wire, and 12 volts from a yellow wire — there are many to choose from. Places you can count on for maximum current delivery at 12 volts are the ATX12V connector and the drive power connectors. Some power supplies have multiple, separate 12 volt rails, and some have only one.
- 1. A separate relay can power the screen for reverse, if it's also your reverse camera, or you can use diodes to let multiple devices trigger the same relay — but let's not get overly complicated.