How to power Arduino in cars?

All hardware topics
Locked
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

How to power Arduino in cars?

Post by Go4IT »

This is more like a blog, i will add posts describing each aspect one by one, and also examples. So keep your eyes open on updates!

Talking about car power supply always involves talking about "12V" battery power. But this is a wrong assumption! Even if the cars main power comes from it's battery and this is given as a nominal voltage of 12 Volts, it will be sometimes more sometimes less, like every battery. From the beginning, where it is fresh and fully loaded it may be 13V down to 9V if it is weak or 6V if it is nearly broken. But the battery needs to get loaded by a generator, which produces AC current and needs to get flattened to DC and regulated to about 14V. Because the generator is directly driven by the engine, the RPM of the engine also influences those parameters (think about a bicycle generator driving the light).

On the "consumer" side of the power, every load which get's switches on produces a small breakdown in voltage (in older cars you can see headlamps dimm if you switch on the electrical window heater) and also a peak if switched off. Also motors and other consumers causes noise on top of the power lines. If cranking it could go down to 9V or less, which is normal even if everything is in perfect shape. Think of Start-Stop systems doing this all the time.

And last but not least, think about what failures could happen here also. What if the regulator circuit of the generator gets an malfunction? What if your car needs to be jump-started from another car? What if many systems runs at the same time, like lights, heaters, blowers in winter? What if mass cable get's cut from battery? What if someone welds parts on your car? And so on...

Smart people define tests for all those enviromental situations, normal and fails and put it into ISO tests. Those tests describe what a automotive circuit must withstand to get an approval. A very informative diagram from these documents is this one, called the "load dump", where you can find all of what i told above:
load-dump.png
Conclusion: The voltage level of the car is far from being stable 12V and also far from a clean battery power. Don't mix it up with the output of an laboratory power supply or even a simple plug-supply.

But let's keep it straight and simple for us hobbyists! We do not want to certify our work, just protect it that it will run more than a few month and, more important, is no threat to our car or our life because of fire or electronical breakdowns.

Resons why the internal voltage regulator of the Arduino is not suitable to be powered by cars 12V net

So let's start with a closer look to the schematic of the power supply regulator placed on the Arduino Nano board itself (and most clones):
Arduino-nano_internal-pws.png
As you can see the board could be powered directly by 5V if put to the "+5V" pin of the board, or by a higher voltage put at "Vin". The board uses a "LM1117-5" Low-Dropout linear regulator (LDO) with a fixed output of 5V. There is no further input protection or buffering of the LDOs input (Vin). It can deliver up to 800mA, which is more than enough for the small Atmega and parts (uses about 30-50mA only).
The word "Low-Dropout" means that the input voltage must only be 1.2 Volt higher than the regulated voltage. So 6.2V is needed for it to function properly on 5V output. But as from the datasheet, the maximum input voltage is 20V. It has internal thermal shutdown, so it could not overheat or break by current overload. This is much more better than good old LM7805 which will break and then put Vin to Vout. Heat comes from current and voltage (P=U*I). So if you drive it with 12V and 100mA for example (10mA for the regulator itself and 90mA for the board), the LDO has a waste power of 0.7 Watts ( P=(12V-5V)*0.1A). If input voltage rises to 15V the power dissipation goes up to 1W. If you need to drive a relay, 100mA is not much... let's assume 500mA and you are at 5W. No doubt that it would not do this for long! The operating temperature must be between 0°C and 125°C. Well, if you only drive in summer, or live near the polar circle, this may not a problem... ;-)
The 1117 also has no protection against overvoltage, reverse polarity, undervoltage (brown out) and no sleep mode. It also produces heat because of the nature of this regulator (not for big loads, but for reference voltages). It also has no protection for reverse current coming out of the 5V circuit (e.g. a relay).

Conclusion: The internal voltage regulator should be void for automotive use. It would not withstand the rough environment for long!

Next, we will learn how to do it right, or even better ;-) We talk about three blocks named "protection", "voltage regulator" and "ripple filter". As we learned above, we should bypass the on-board voltage regulator of the Nano. To safe power we use our own regulator and may also remove any LEDs if they never get seen by anybody.

Code: Select all

Car 12V -> [protection] -> [regulator] -> [ripple filter] -> 5V
The most basic protection is a fuse. It will not really protect the circuit (chips are long gone before the fuse is blown in case of overload or short circuit) but the car and other components, so never run a circuit without a fuse, e.g by directly connecting it to the battery terminal!. But we do not need a fuse ourselfs and if, it must be accessible. It makes no sense to put a fuse inside a case and hide this under the cars trims where you never find it. If, place it inside the fuse box of the car or use an unused fuse socket from this box. Or, my favorite, use an power line with an existing fuse :-)

Links and references

The listings of this electronics FAQ is somewhat like the holy bible of automotive power supplies. Read it, if you can understand it and have some days off: http://www.dse-faq.elektronik-kompendium.de/dse-faq.txt

Also this application note from Maxim gives a good overview of the problematics and how to deal with it: https://www.maximintegrated.com/en/app- ... vp/id/4240
You do not have the required permissions to view the files attached to this post.
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: How to power Arduino in cars?

Post by Go4IT »

Input protection

From the load-dump diagram we need to protect our circtuit against:
  1. Overvoltage
  2. Reverse polarity current
  3. Wrong polarity connection (mixed + and - terminals on module or battery)
  4. Overcurrent
  5. Voltage fluctuations
1.) To protect our circuit against overvoltage, the most basic part is a Varistor. It will be put parallel to the power terminals (after the fuse, of course). In normal operation it's internal resistance is such high, that no relevant current flows. If voltage rises up the resistance lowers and current flows through the Varistor. This will short slow transients and also some low frequent noise on the powerline. Even if it is so simple it is very effective. For automotive use there are S14K14 for example, for under 1€.

Another method is to use a TVS diode. TVS stands for "Transient Voltage Suppressor" Diode, in short also called "Suppressor Diodes". They work like a Zener Diode and clips voltage to a given amount by shorting the overvoltage to ground. This is only usefull for very short pulses because it would heat up dramatically and destroy the part. There are unidirectional and bidirectional versions of them. Unidirectional only protects against positive pulses, where additional diode is needed to protect against reverse polarity currenct flow. Bidirectional protect against both, so addition Diode could be omitted. For example the unidirectional P6KE16A from the P6KE-series from Littlefuse are widespread used for this, or bidirectional P6KE16CA.
pwr-prot_tvs.png
2. + 3.) A simple 1N4001 (for 1A current flow, or 1N4004 for 4A) will be put into the positive lead. It block reverse polarity current flow through the circtuit:
pwr-prot_tvs_rev.png
Note that you have a voltage drop of about 1V from the Diode (breakthrough voltage, depend on material of Diode).

4.) Most basically a resistor clipping the maximum current. But this may get very warm (hot), so electronic circuits could do the job better. Overcurrent comes from overvoltage to it's best to protect against this.

5.) Add a coil inline as energy-buffer and also as a Low-Pass filter to remove noise from the power leads:
pwr-prot_tvs_rev_coil.png
You do not have the required permissions to view the files attached to this post.
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: How to power Arduino in cars?

Post by Go4IT »

Voltage Regulator

It's main purpose is to lower and stabilize the voltage from "Vin" after the protection circuit to the needed voltage level to drive the circuit, in our case 5V for the Arduino Nano and the other components:
pwr-reg.png
To protect the regulator itself from reverse current (can be generated by relays or motors or such), place a Diode in reverse polarity from Vout to Vin. It will simply shorten the regulator for those currents if it is not reverse polarity safe itself:
pwr-reg_rev.png
Beware that you may need addidional voltages, depending on your external parts used. If they run at 3.3V and have no voltage regulator on their board, you should add one after the above mentioned regulator. The pattern is to drop voltage to the highest level needed and then cascade down. This is because you only need to worry about all the scatter once with a reliable solution and afterwards, for the smaller voltage drops, you can use simple regulators like the LM1117. If so, keep in mind to scale the first regulator for the whole current of the application.

But sometimes you also want to place two primary regulators, one for the whole circuit with big load, which can be switched on/off by the application itself and one for the very low current needed to drive the micro in sleep mode, which is always on. This is a very common pattern found in automotive circuits. Of course, there are special regulator chips which can do both, but the working principle is the same.

Which power regulator to choose?

This is a hard question... well, i depends! LDOs tend to have big waste power and therefore are very unefficient. Switching regulators are more usefull here, but their output voltage is not as clean as from linear regulators. A widespread switching regulator is the LM2596, like on this board (it shows a regulator board with adjustable output voltage, by the blue trimmer):
lm2596_board.jpg
It only needs a few external components for operation, like you can see here in a typical schematic:
pwr-reg_lm2596-basic.png
There are also versions with fixed output voltage. I would prefer those, because temperature can change the resistance set by the trimmer and output voltage drift up or down. Temperature stability (compensation) is one of the main features of automotive regulator ICs. Also there is a special "HVS" version of the LM availabe which can take more input voltage than the basic one, which is limited to 45V.

Conclusion: Use LDOs only for small voltage drops and currents on "clean" input voltages or as secondary regulator after a step-down one. As primary regulator only use switching regulators because of their efficiency and low heat dissipation.
You do not have the required permissions to view the files attached to this post.
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: How to power Arduino in cars?

Post by Go4IT »

Ripple Filter

This is most often integrated into the regulator circuit, but could be added by an coil-capacitor (L in line and C to ground). It will remove high frequencies coming from the power line through the regulator into the circuit line.
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: How to power Arduino in cars?

Post by Go4IT »

Typical applications

In this part i will show some "ready-to-use" examples of the above.

Simple input filter to protect against transistions:
pwr-prot_coil_tvs.png
Full protection and regulation circuit:
car_power_supply.png
You do not have the required permissions to view the files attached to this post.
Locked