Controlling Car Headlights with Arduino

First things first: this is my first time posting in the Arduino forums (but I lurk around a lot here) - so hello all! This forum is absolutely amazing and the discussions here helped me out so often I can't even count it anymore. A big THANK YOU to all of you!!! :slight_smile:

I have a question regarding a new project which involves car headlights that I bought on Aliexpress a few weeks ago (12V/3A or 24V/1.5A power input): Headlights

I am planning to control them with an Arduino (e.g.: if sensor A reaches value X, switch off white light and switch on yellow light, if sensor A reaches value Y, blink yellow light = turn on/off light every 2 seconds) and have several questions regarding this project. This is my first time working with something that can not be directly powered with an Arduino, so I am pretty new to this field of higher voltage/amps devices.

  • From what I have read, I will most probably need a Relay switch for switching them on/off. Is that correct?
  • I need to use a mobile power supply that can provide 12V/3A for at least 6-7 hours. I thought about using a lead acid car battery for this application or some li-ion / LiPoFe4 equivalent with integrated battery management system ("all in one" battery packs). If I buy something like this, can I theoretically just hook up the + and - poles to my headlights and it will work fine or do I need to take care of something else? I will most probably also integrate a fuse in the circuit but that's it, if not otherwise stated by your input.
  • You can see in this picture that there are several "input modes" for the headlights:

    If I want to control them, can I do this with multiple relays and some "creative wiring", or do you recommend something else?

That should be it for now. Tons of thanks in advance - I really appreciate your help!

Freefallr:
I am planning to control them with an Arduino

My first thought is to wonder what the use of an Arduino's going to buy you over a few simple mechanical switches.

Explain what you mean by 'control', because just saying 'control' doesn't mean a damn thing.
If you want to put them in a cage so they don't fly out the window, say so.
If it's just turning them on and off manually, then there is no sense in using an Arduino.
If you want to turn them on and off with some kind of remote or phone, then you need to say so.
If you want them to turn on in response to movement, say so.

INTP:
Explain what you mean by 'control', because just saying 'control' doesn't mean a damn thing.
If you want to put them in a cage so they don't fly out the window, say so.
If it's just turning them on and off manually, then there is no sense in using an Arduino.
If you want to turn them on and off with some kind of remote or phone, then you need to say so.
If you want them to turn on in response to movement, say so.

kenwood120s:
My first thought is to wonder what the use of an Arduino's going to buy you over a few simple mechanical switches.

Thanks for your replies and sorry for the confusion. To clarify:

The headlights will be mounted in a 3d-printed case which is currently in production.

I am also planning to make the headlights "smart" - or more precisely: I want to make the lights sensor-controlled. For example, if temperature on a temperature sensor connected to Arduino reaches value x, turn on the white lights. If temperature reaches value y, turn off white lights and turn on the yellow lights, if it reaches value z, blink the yellow light (turn on/off every 2 seconds).

I hope it is more clear now, otherwise I will explain the project in more detail.

Relays will work. A relay is an electrically-controlled (and electrically isolated) switch. So, you can control a large current/voltage with a small current/voltage.

...However, most relays require more than the 5V / low current that the Arduino can directly supply. So, get a relay board that has a driver circuit and a relay built-in. (You can find relay boards with multiple relays.)
An alternative to a relay is a [u]MOSFET driver[/u][/b]. Just make sure that the MOSFET can be controlled by 5v (a "logic level" MOSFET) and that it can handle the current. And, the MOSFET may require a heatsink.

With MOSFETs you also get dimming via PWM, something that a relay can't do. And rapid flashing would be hard on a relay, but not a MOSFET.

Hello guys, thank you all for your replies! I will now either get a dedicated relay board with driver circuit + relay built-in or read more about MOSFETs. Thanks for the tips!

Hi,
You need to check before anything else, if you are switching high or low side of the lights.

A motor vehicle can be either or both depending on how the design engineers got out of bed the morning they did the lights design bit.

Tom.... :slight_smile:

For example, if temperature on a temperature sensor connected to Arduino reaches value x, turn on the white lights.

I'm a bit confused. Normally people want to turn the lights on when it gets dark, not because it's cold out.

Make sure and test it thoroughly, especially while attached to a running car. The headlights will be fine, but the arduino might need some filtering. It's a noisy world in a car compared to a breadboard on a desktop

So you're using really bright high current draw headlights as indicator lights? Or are you actually not using real headlight bulbs because that sounds really stupid?

Hi,
I think we need to know the application of all his temperature dependent light switching.

What is the aim of operating lights dependent on temperature?

There may be an easier solution and it will make sure we are all on the same page.

Tom.. :slight_smile:

DVDdoug:
An alternative to a relay is a [MOSFET driver[/b]. Just make sure that the MOSFET can be controlled by 5v (a "logic level" MOSFET) and that it can handle the current. And, the MOSFET may require a heatsink.
[/quote]

The IRL540 switches fine at 5V and will be able to handle the current without heatsink (it's just 3A for the 12V models which is not that much for a MOSFET).](Gammon Forum : Electronics : Microprocessors : Driving motors, lights, etc. from an Arduino output pin)

groundFungus:
With MOSFETs you also get dimming via PWM, something that a relay can't do. And rapid flashing would be hard on a relay, but not a MOSFET.

Those look like LED lights, which are likely to have a clever constant-current supply. Applying a PWM input will either be ignored by the light or it will damage the light.