I am new in electronics and I am trying to connect the arduino to the car? i'm not sure if I should use the car battery or the alternator as the main power. I also want to use the 7.4v lithium battery as a backup to the main power. The alternator should also be able to charge the lithium battery when the car is running. How can I achieve this?
In a auto the alternator output and the battery are the same DC power bus. Just the voltage value changes when the motor is running and the alternator puts out a slightly higher voltage then just the battery alone when not running.
Do you want to connect your arduino to the OBD slot? The 16th of OBD slot is the Permant positive voltage which runs at 12V.
You wouldn't connect direct to the alternator, nor even the output of its regulator,
as the alternator outputs AC, and the regulator output is one of the electrically
noisiest places to connect to.
You'd normally connect into the ignition-switch controlled rail, so its powered off
when the vehicle is unattended.
You also have to defend against the poor quality of a vehicles DC bus, which drives
lots of motors and relays.
One way is to use a cigar-charger plug-in USB supply, of reasonable quality, so it
deals with the noise and spikes and saves you the bother of building a supply filter/
A 7.4 volt battery can connect to the barrel jack (or Vin/gnd), but IIRC that power
source takes priority.