Using automotive relays and guidance in my project.

I have a project (first time with Arduino, I have a Arduino UNO) where I'm using my vehicles fog light button and retaining its original function and adding the ability to hold the button for a few seconds to turn on/off another set of fog lights. Long story short.. I don't like adding some janky looking aftermarket switch to my vehicle and would like to re-purpose the OEM switch.

I already have it working on a breadboard with just the Arduino and some LEDs. Now I'm trying to figure out how to transfer it to the vehicle using relays so that its not relying on power/ground from the Arduino board (pretty sure that wouldn't work anyways). Is there a ready-made solution for relays triggered by Arduino's ground/5v that can handle the 12v on the output side?

Maybe relays might not be what I'm looking for? Both sets of fog lights are already powered by a standard 30amp automotive relay but I need a safe and practical way to trigger those relays (not sure if Arduino's 5v would trigger the relays) so I figure using another set of relays triggered by Arduino but the in/out of the relay is the 12v system of the vehicle, but I'm sure that is not ideal.

I know there's a bunch of relay boards on amazon/eBay but not actually knowing this stuff I figured here would be a good place to ask.

Also is powering (fused) Arduino via the 12v system ok? or do I need an adapter to drop the 12v down to 5v (such as a 12v outlet to USB adapter or regular 12v to 5v adapter). Also what amperage fuse would be recommended.

After I have this all figured out and working I would like to step down it all down to an Arduino nano just to reduce the whole thing's overall footprint, any input on that would be great as well.

Hi,
Welcome to the forum.

dawm:
I have a project (first time with Arduino, I have a Arduino UNO) where I'm using my vehicles fog light button and retaining its original function and adding the ability to hold the button for a few seconds to turn on/off another set of fog lights. Long story short.. I don't like adding some janky looking aftermarket switch to my vehicle and would like to re-purpose the OEM switch.

Is your fog light button a momentary ON button, or a press ON- press OFF mechanical type switch.
If the latter then you will not be able to detect how long you have you finger on the button.
Tom... :slight_smile:

TomGeorge:
Hi,
Welcome to the forum.Is your fog light button a momentary ON button, or a press ON- press OFF mechanical type switch.
If the latter then you will not be able to detect how long you have you finger on the button.
Tom... :slight_smile:

It is a momentary switch. When held down it supplies ground to its output wire.

dawm:
It is a momentary switch. When held down it supplies ground to its output wire.

That suggests that the input wire is normally at 12v (but car voltages can rise to 15v) so you would need a voltage divider to bring that down to a max of 5v for the Arduino.

Then the Arduino could easily detect and time the button press.

I presume you will be controlling the extra lights with some 12v automotive relays and an Arduino cannot control them directly. You can use the Arduino to operate a transistor which controls the current in the relay's coil circuit.

...R

Pretty much any relay you see tagged with Arduino will handle automotive 12V accessories just fine. Whether it will survive the vibrations and possible temp changes is TBD.

Use a USB car adapter. That line will already be fused.

Are you sure your factory fog light button is momentary and the on/off somehow controlled by a computer? Or is it a latching button under there that you've concluded wrongly about?
Are you wanting separate controls of fog and this accessory light so that either or both can be on, or will they always be on together?
Please clarify and confirm so we're not all working with bad info.

Robin2:
That suggests that the input wire is normally at 12v (but car voltages can rise to 15v) so you would need a voltage divider to bring that down to a max of 5v for the Arduino.

As it's automotive I'd prefer an optocoupler there.

But, it's a switch, not a normal signal:
What about the controls that are currently connected to this button? Those controls are to be taken over by the Arduino as I understand it, which probably means that the button can be completely disconnected from the existing controls, and instead be connected as normal button to the Arduino. So the voltage now at that button becomes irrelevant. Important is that it's really a momentary button (a multimeter can confirm this in an instant).

The lights themselves are connected to relays, which can be controlled easily by an Arduino. The relay operates at 12V which is fine, you anyway need a transistor to switch (you probably need a high side switch, in automotive the grounds are usually all connected to the chassis and the positive lead is switched - so PNP or p-channel MOSFET). Here I'd definitely want to add an optocoupler to isolate the Arduino from the vehicle power system.

Then the power supply itself: get an off-the-shelf car phone charger. Those are designed for automotive, so have proper protection circuits, and produce 5V which can be power the Arduino.

wvmarle:
in automotive the grounds are usually all connected to the chassis and the positive lead is switched - so PNP or p-channel MOSFET).

That has not been my experience

wvmarle:
But, it's a switch, not a normal signal:

I was going on the OP's statement in Reply #2

But I guess it could be interpreted differently.

Any time I dabbled with automobile wiring it was with the schematic by my side - and before cars got newfangled electronics.

...R

Indeed, actual schematics are needed. Maybe low side switching can be done indeed, actually it doesn't matter that much.

There must be some control hardware that the switch is connected to, and that in turn switches the relays somehow. If I understand OP correctly, the existing controls are to be completely bypassed/removed, and that would mean the switch can be used in isolation.

So now it's time to wait for OP to come back and explain more.

Where safety is a concern, modern automobiles must use real switches to control head lights, tail lights. But all others are controlled by the computer system. When the lights work as the OP describes, I think the switch is just signaling a computer to turn those lights on.

Of course, the fog lights may be after-market lights and will the computer will know nothing of the operation.

Paul

Switch is momentary, tested with a multimeter. Voltage on the output wire is 5v when it's not pressed, 0v and grounded when pressed, back to 5v when released. Results are repeating. Assuming the 5v is for the button lighting as the led inside turns off when it's pressed. I'll be returning ground to the output wire from Arduino on a single click action to retain it's original function and on a hold action use another wire and relay for the additional lights.

Working on getting a wiring schematic, vehicle is a 2018 and a brand new model so free schematics aren't available yet but I've reached out to some dealer techs to see if they can snag the wiring for the switch and front lighting.

Essentially need to know what type of relay can I use that can be triggered via an Arduino output and on it's output end can handle automotive load or trigger a standard automotive relay.

Use a circuit as per Figure 2 (source):
optocoupler-relay-driver-circuit.gif
Standard automotive relay will do fine.
The 2N3904 can be replaced by just about any small signal NPN transistor; the 120R resistor you may increase a bit in value for 12V, 470R-1k will be fine.

1 Like

Thank you that's very helpful.