# How to use 12V-14V motorbike supply at Arduino's DigIN?

Hello everybody,

I am looking for a way to read the handle bar switches of a motorbike at an Arduino Mega's digital inputs. The switches simple passthrough the voltage coming from the battery (something between 12V and 14 V).

Could a simple voltage divider be sufficient?
Arduino is supplied by a 7808 voltage regulator (8V output).

Cheers,
Stephan

Arduino can be supplied by 8V, it is OK but it works with 5V. Voltage divider seems to me little bit risky since the voltage is not stable (12-14V). Even though you can use divider let say 3:1, which could be safe up to 15V and TTL is still ok (2,7-5.1V). More better would be to use switching by transistor which can tolerate higher voltage than ATmega.

Thank you very much!
I think I'll give it a try with the v-divider. 3:1 seems ok, as it would still work with ~11V (for example at engine fire up) and also up to 15 V.

Another idea is to simply separate the whole unit from the harness und connect the switch "supply line" to the 5V output of the Arduino.

A voltage divider is not risky because the supply is not stable, but because the load is not stable. Voltage dividers CANNOT provide adjusted voltage for anything but the tiniest loads (usually caused by high-impedance inputs).
For bigger loads, that is, small effective resistance of the load, you will get significantly different effective voltage division, since the resistor to ground is in parallel with the load resistance. Imagine you set up a voltage divider from 12V to 5V with a 350 Ohm resistor and a 250 Ohm resistor. First, this will constantly drain your battery with 20mA. What happens now, if you add an Arduino drawing 20mA at 5V? It will have an effective resistance of 250 Ohm. Now, your resistance against ground 1/(1/250 + 1/250)=125 Ohm. So your Arduinos HIGH will be at 3.16 Volts, which is not enough for a 16MHz Arduino. with a lower resistance voltage devider, this could be somewhat countered, but at the expense of higher constant power drain. Remember, you are already at 50% efficiency in my nonfunctional example.

Since LDOs like the 7805 just burn excess voltage in heat (according to I*diffV), they are also not a great choice for large voltage reduction.

Use a switching regulator. The MP1584 is good and cheap.

Maybe I didn't explain it right... I don't want to supply the Arduino itself with 5V. The Arduino is powered by regulated 8V, coming from a 7808 voltage regulator. So I'll be fine on this side.

I just want to change the voltage range at the digital inputs from 0...~12V to 0...~5V.
The handlebar switches/buttons (normally closed contact) switch the voltage coming from the battery. But this would be too high for the digINs of the Arduino.

Oh, ok. No, you were specific, I just didn't read properly.
Sure, a voltage divider can work with that in principle. Calculate it such that the highest possible voltage (14.5-15V) gives you 5V. The Arduino will detect HIGH starting from 0.6*VCC, so 3V. At 12V you will still get 4V signal.