# 12V automotive project

I'm planning to make a controller for my car's daytime running lights which will automatically sense the battery voltage to turn on and off the daytime running lights, and it will also have to monitor the sidelights to turn off the DRLs when the other lights are turned on.

I know what the arduino supply voltage range is, but can someone tell me what voltage range can be applied to the digital and analogue input pins?

I'm curious to know if I can simply apply the 12V from the sidelights to an digital pin. (I'm guessing it can't be done, but am curious about the arduino limits).

Cheers, Brian

[quote author=Brian in NZ link=topic=146414.msg1100048#msg1100048 date=1359762394]I'm curious to know if I can simply apply the 12V from the sidelights to an digital pin.[/quote]

Only if you want to turn the digital pin into slag.

(I'm guessing it can't be done, but am curious about the arduino limits).

Good guess.

Yep, as I thought :)

You can try with resistor in series, as long as current below 1mA should be safe. 12 V - 5 V / 1 mA = 7 kOhm, >10k to be sure.

A 7805 would do the trick: >5v in, 5v out. Wastes power though because the current is the same on both sides, so (Vin -5)i is lost. Might need a heat sink....

My current thought is to use the guts of a 12V cigarette lighter to USB power adaptor to provide 5V dc for the Arduino, and either a transistor or relay to isolate the sidelights 12V from the digital input, but my issue is with how to safely monitor the battery voltage to control when to turn the running lights on and off.

When the engine is not running, the battery voltage will be lower than when the engine is running and the alternator is charging the battery. If I can monitor this voltage, I can set a mid-point voltage which the Arduino will switch on the lights when the engine starts, and off when the engine stops.

The voltage range will be from 12.5V (engine off) to 14V (engine on), so a mid point would be about 13.2V

When the engine is not running, the battery voltage will be lower than when the engine is running and the alternator is charging the battery. If I can monitor this voltage, I can set a mid-point voltage which the Arduino will switch on the lights when the engine starts, and off when the engine stops.

Isn't that the same as simply detecting the engine running?

As for the side lights, an opto coupler could be used.

• Scotty

Isn’t that the same as simply detecting the engine running?

I was thinking that too, but wasn’t sure if I was following the story properly…

Yes I agree about detecting the engine running. That is exactly what I want to do, but this method would not require additional wires to other parts of the car electrics, as I would be using the battery voltage as the indicator.

I made a brake light for a motorcycle. In order to detect when the brakes were being pressed I used a voltage divider. But I think If I were to do it again I would use a transistor and attach the 12v to the base with a large valued resistor and have the transistor pull the arduino pin to ground. That way if there is variation in the vehicle voltage, the pin still either sees 5v or 0v. My voltage divider would go from 3-5v depending on the motorcycles voltage. Works great but I think the transistor is a better idea. I guess the voltage divider would be good if you wanted to actually see about what the cars voltage was.

You're overthinking this... Use the ignition to supply power to the Arduino via a power regulator (since you need to make one anyways). That way, the Arduino turns off when you turn the key off.

There is also a way to use a photocell to signal the Arduino to turn the lights on and off. Not much harder than a voltage switch, and WAY less possibility of hurting the Arduino. You will still need to use a relay of some sort to trigger the lights, however.

One of the power lines for accessories will already be hooked up to the car in a way that puts it off when the power is off- check the wires for the audio system

The voltage range will be from 12.5V (engine off) to 14V (engine on), so a mid point would be about 13.2V

Not so sure this is correct. I think the voltage range for battery readings is 12.5 (when the the alternator is not recharging the battery) to 14.5, when the alternator is recharging the battery; not necessarily the readings you may get when the engine is running or not. The engine may be running but the alternator may not be called upon to recharge the battery, thus a reading of 12.5 with the engine running. You may want to check that out. - Scotty