Author
Topic: What's the best way to switch car headlights using an Arduino? (Read 6384 times)

The electric car project I'm working on needs the headlights and other lights to be switched on and off. I want to control the lights with an Arduino Mega, using one output pin for each light or other device to be switched. That means I will have a 5 Volt, up to 40 milliamp output signal to switch the 12 Volt, up to 5 Amp power supply line to the device.

One way I have thought to switch the lights is using this solid state relay from Futurlec: http://www.futurlec.com/Relays/SSRDC100V40A.shtml I think it will work fine, but the relay is rated for 40 Amps (much bigger than I need), and costs $22 (much more than I want to spend).

So I thought of using a transistor to switch the lights and other devices. But I guess I would need an optoisolator to protect the Arduino. And I cannot find any circuits to do quite what I need. That is, use a 5 Volt, 40 milliamp on/off signal to switch a 12 Volt, 5 Amp power supply line.

Any advice on how best to approach this? Particularly, any transistors you can recommend that will do the job?

That means I will have a 5 Volt, up to 40 milliamp output signal to switch the 12 Volt, up to 5 Amp power supply line to the device. [...]Another idea was to use an automotive relay, [...] the control signal needs to be 12 Volt, and 150 milliamps, neither of which the Arduino can put out.

So I thought of using a transistor to switch the lights and other devices. But I guess I would need an optoisolator to protect the Arduino. And I cannot find any circuits to do quite what I need. That is, use a 5 Volt, 40 milliamp on/off signal to switch a 12 Volt, 5 Amp power supply line.

Any advice on how best to approach this? Particularly, any transistors you can recommend that will do the job?

Use the automotive relay, While I cannot see the page with the SSR, they're usually for AC and even if you fin a DC version, it would be hopeless overkill anyway.

You don't need an optocoupler, but if you like to add parts, go ahead just remember that the more parts you use, the greater potential for errors.The transistor will be all the protection you need. It keeps the 12V side confined to collector-emitter. As long as the (NPN) emitter is grounded, you will have that isolation and to address any concerns over a faulty transistor - the typical failure mode for diodes and transistors is shorted.Even if we imagine the unlikely (almost impossible) situation where there's +12V on the basis, there's a couple of resistors that keeps the board in the clear.

A BC337 (can possibly be substituted with 2N2222, if you check the h_FE ) with a 2k2 resistor from basis to I/O-pin plus a 1k0 pull down (I/O-pin to ground) to make sure the transistor stays shut when the controller is powered off. In case of 12V on the basis, the I/O-pin will see a maximum potential of 3.75V with an impedance of ~690 Ohm. This means a max. of 5.5mA hitting the I/O (and this doesn't even take the loading from the I/O itself into the equation - this will lower it further.

Emitter to ground, collector to relay and the other end of the relay to B+. A reverse biased 1N4148 (or 1N4448, NOT 1N914) as close to the relay coil terminals as possible (best way to mount them is directly at the terminals, but that will probably be impossible. Next best is to make sure that the diode is directly in the current path and not as a separate entity (I usually go for the diode to be placed in the direct path from B+ to the driving transistor and then make traces from the diode to the relay coil.All in all: 2 resistors, 1 diode and 1 transistor.

Don't know if it helps (or the quality of them), but a couple of days ago, I spotted some sockets for automotive relay - a wire ended socket and one for PCB mounting.As mentioned, I can't vouch for the quality, but with a series of relays to keep in order, it provides a tidy and easy solution (Oh, the times spent under the hood in heavy rain, just to persuade 4..5 spade connectors to give).

Logged

Regards,Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?Please remember...Engineering is based on numbers - not adjectives

Yes, it's correct.I would have drawn it up for you, but I had a couple of days with shaky (on/off) server connection, so I figured text would do for such a small circuit... And your schematic is proof that it did

Logged

Regards,Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?Please remember...Engineering is based on numbers - not adjectives

Don't know if it helps (or the quality of them), but a couple of days ago, I spotted some sockets for automotive relay - a wire ended socket and one for PCB mounting.

I've bought sockets for SPDT relays before, they worked very nicely. IIRC I bought the socket and relay together for a couple of bucks. You will have to keep them somewhere out of the weather though (but since this is for a car and what you are doing is replacing the headlight switch, I think it'll be fine).

Most cars use similar sockets on wire ends for single relays placed under the hood and they're very resilient, when you think of their environment, from perhaps -20°C (or lower) to around 80°C (or higher) - There's no rain, but oil mist and a wide range of temperatures is quite a challenge in itself.

The difference (when it comes to connecting/disconnecting) between "normal" relays and the automotive type is that the latter have spade terminal and it is faster and easier with a socket (which you can get a hold on) than with a series of loose spade terminals.

Where I really think they'd shine in Daaniis project is in presentation - with PCB's holding a row of relays it looks both neat and powerfull

For most one off projects, where a relay is gonna last the lifetime of the rest of the circuit, soldering the terminals is a better choice, as sockets can develop a bad connection (especially if the contacts are made of a different material - never use a gold plated terminal in a tinned socket or v.v. that's a problem waiting to happen).

Logged

Regards,Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?Please remember...Engineering is based on numbers - not adjectives

Just when I had finished an answer for your previous post, my PC went down with a bang (cutting a 1.5 hour ongoing video conversion as well ), so here's the short version:The MOSFET may do fine (try it). If it gets hot, a driver made from an NPN, a PNP and a few resistors will make for a 12V drive.I won't quite call it Logic Level, as the Miller plateau is at (or perhaps a little above) 5V, which will make it switch much slower and the R_ds_on will be higher than if properly driven.

What's dissipated in a well driven MOSFET, say the one you chose, which should be 33mOhm (worst case IIRC). At 10A that's 0.033*10^2 = 3.3W

There will be a small contact resistance in any relay (and this is usually inverse proportional with the price), so that loss should be considered as well in a comparison, but neither 0.1W or 3.3W matters much compared to 130..140W into the load.