June 2, 2017

6. Power for the Robot

The fіrst prototype


While working with the introductory Arduino experiments, it is unlikely you face any concerns on how to power your circuits. Usually, your board receives all it need through the USB connection from the computer. For the sophisticated experiments you can even buy a breadboard with the power supply module (like this one).
Breadboard kit with the power source

Talking about the autonomous robot - it starts to be a bit more complicated. You can't rely on external power, and you need to find the way to have everything on board.

Together with the chassis, we received a holder for two batteries 18650 3.7 V. Actually - this is a very good option. But we did not have such cells handy, so we put it away for a while.

Instead, we had lots of NiMH AA batteries and strong desire to run the robot as soon as possible no matter what. So the first power source prototype included two batteries:
  • Arduino is powered by Xiaomi Power Bank through a regular USB. It looks quite bulky - but unquestionably reliable.
  • To power motors, we used a simple battery block of 3 AA batteries. As a holder we took a piece, salvaged from the old cheap toy (that is the first time we had to use our soldering skills to connect the wires and socket 😏).

Simple battery holder - front

Simple battery holder - back


That appeared to be enough to launch the motors at slow speed and control them using transistors (we covered this in more details in the previous post). It is fine for a minimum viable prototype, but definitely not enough for a final version.

The battery requirements


Before purchasing a battery for your robot, calculate what kind of load should you expect. For our case we used the following assumptions:

Capacity - at least 2000 mAh, more if possible. This is based on rough calculations of the board's currents, plus the characteristics of the motors we use. With such capacity - the robot can work on a single charge for several hours, which exceed the usual timeframe available for us to play with our toys.
Voltage - 7-8 V (this is considered as ideal for Arduino, also it is enough for our motors).  The battery should not loose the voltage level too quickly as it discharges. When the voltage goes below 7 V, Arduino boards start working unreliable, can hang or reboot.
Work Current - we don't know this yet. From what we see right now, we should assume currents between 1 A and 2 A. Under exceptional load our motors can take up to 4500 mA (according to the datasheet). It would be nice if our batteries will not explode under such load.

At a first glance - everything looks easy. Just go, google and buy whatever fits the requirements. But it does not work that way.
  • Batteries are built from standard elements (cells). These cells can be of different type and size. Moreover, even identically looking cells can behave completely differently in your project. Even if the only difference is one letter in the name of the battery.
  • Real capacity can differ from the nominal (the one, declared by the manufacturer). It can be even 10 times smaller. If you use such battery - your robot will not last for a long.

So before buying any batteries - read this post. Maybe you will get something better as a result. If you are interested in more details and explanations - don't hesitate to dive deeper into this topic. There are lots of resources on the Internet, starting from the bare Wikipedia and ending with the specialized resources like Battery University.

NiMH AA


Nickel metal hydride type batteries are now the most widely spread rechargeables. You can find them everywhere and most probably you already have a good AA charger. We use the magnificent MAHA PowerEx MH-C9000. It charges cells wisely, monitoring all the parameters, have special "training" modes for the exhausted cells and lots of other bonuses.

Dealing with such batteries you should know:
  • ...the real capacity of the battery - don't trust what is written by the manufacturer
  • ...if battery is optimized toward bigger currents (like those for the RC-toys) or smaller currents (like in TV remote controls)

We built out first battery using 3 cells BTY3000 AA NiMH. It was obvious that 3 batteries are not enough for our robot. And we could not power Arduino board itself having such a small voltage (1.2 V *3 = 3.6 V).

So we bought a bigger holder for 6 AA cells:
6 AA cells battery holder

1.2 V *6 = 7.2 V - this is exactly what we need for Arduino and for our motors! But our excitement quickly faded out. Even starting with the charged battery, our robot was getting tired too quickly and in half of hour was fading out completely.

Well, that was not a big surprise. Even though BTY elements provide the best capacity per dollar, their usage appeared to be impractical. The real capacity of the "3000" cells very rarely exceeded 800 mAh and usually was closer to 600 mAh (as measured by the MAHA PowerEx MH-C9000 "break-in" mode).

Funny thing - you can increase the capacity to the real 2000+ mAh by adding more cells to the battery. Using BTY 3000, you should take 18 cells. And even in this case, such battery will be cheaper, than any other NiMH option! But imagine the weight of such battery and how long it will take to charge all 18 elements. This is a good example that "capacity per dollar" is not always the best measure of the battery coolness. At least, not the ONLY measure to consider.

We fixed our problem by switching to Duracell AA cells. Here everything works as expected. The real battery capacity is equal to the one declared by the manufacturer. Energizer, Varta, Panasonic can be also a good choice.

Battery made of Duracell elements

With such battery, our robot is now much more robust. The battery lasts longer and provides more stable voltage. We noticed that under heavy load (i.e. when both motors are blocked by some obstacle) the voltage may drop and Arduino restarts. This happens once in a month or even less, so we decided to treat this as "an overload protection feature", rather than a bug.

Another significant disadvantage of the battery built on NiMH AA cells - high price. It goes well beyond $20, and out of the other reasonable options is the most expensive.

Li-Ion

 

General Characteristics


Li-Ion batteries are now the most widely used type in the modern electronics. Comparing to regular NiMH AA cells, they have both advantages and disadvantages.

Advantages:
  1. Higher working voltage (~3.6 V vs 1.2 V). So you need a smaller number of the Li-Ion cells to reach the desired output voltage and capacity. This also means that even being priced higher per cell, the combined Li-Ion battery will cost less.
  2. Higher capacity with the comparable size and weight.
  3. More tolerable to the high load currents (it can be 1C or even more; some batteries are designed to survive currents of 100C and higher).
  4. More tolerable to the high charging currents. Normal charging current can be 1C and often even higher. This means Li-Ion battery will charge much faster than NiMH.
Disadvantages:
  1. Very vulnerable to overcharge and over-discharge. If you overcharge Li-Ion battery it can even explode. You should always be careful with such battery and always use special battery controllers with built-in protection circuits.
  2. Do not like temperatures below the freezing point (0 °C or 32 °F). These batteries lose charge even without load, and do this faster when it is cold. If left for a long time, they can discharge too deeply and be unable to charge again. Also, Li-Ion batteries should not be charged when the temperature is below the freezing point - they can get damaged and never recover back.

Descriptions of rechargeable batteries often mention "C"-value. For the rechargeable battery, it is the current which completely discharges the battery within one hour. So if the capacity of the battery is 3000 mAh, the C is equal to 3000 mA.

What should you do if the real capacity is 5 times smaller than one, declared by the manufacturer? What charging current to use if it is specified as a factor of C? You can't know for sure. If you'd like to be on the safe side, expand the battery lifespan and avoid unexpected explosions, we recommend using actual capacity instead of the nominal (declared).


A typical 18650 cell example
Li-Ion batteries can be wrapped into many different forms and sizes. The most popular are cylindrical elements 18x65 mm. They are referred as 18650 cells (I don't know what the last zero means). According to Wikipedia, these elements are used even by Tesla. Still, Elon Musk said the batteries they use are not quite the same as those, you can buy on eBay.

Often you can see batteries which are marked as Li-Po. This is a flavor of a regular Li-Ion type with different electrolyte technology. This technology allows more creativity with the shape of the battery and usually produce smaller and lighter packs. Such batteries are popular in the cell phones, tablets, radio-controlled toys, and models - in all cases when reduced weight and volume are crucial.

Li-Po cell shaped as AA battery

There are Li-Po elements shaped in a form of AA batteries (i.e. like those: SORBO 1.5V 1200mAh USB). They do not look practical, yet the price is quite high, and the capacity is moderate.

Flat Li-Po Battery

Flat Li-Po - can be a great option for your robot. If you find the one which matches your requirements, and also have a good understanding how to charge it properly and protect from over-discharging - go ahead and buy it. Ultimately - it may be easier to deal with such flat battery, comparing to regular 18650 cells.


Xiaomi Power Bank 2 10000mAh
For the convenience of use with the consumer electronics, Li-Ion batteries are often made in a form of a Power Bank. Usually, it is a nice plastic box which protects the battery internals. It goes with built in charging controllers and protection circuits and use standard USB ports to charge and discharge. For the quite adequate money you can find a great battery with the capacity of 10 000 mAh or even more like this one: Xiaomi Power Bank 2 10000mAh.

You can build your own Power Bank if you like. For example - you can combine standard 18650 elements with a ready to go power bank board. Besides the charging controllers and protection circuits, it has USB sockets and voltage stabilizers.

Power Bank controller board


The only struggle with the Power Bank is that you need to convert somehow standard USB 5 Volts to 7-12 Volts, requires for the motors. We could not find a good and easy solution here, so the final decision is to use 18650 if we ever decide to switch our robot to the Li-Ion chemistry.

Thus in the next sections, we'll concentrate on the 18650 form-factor. Still, everything mentioned there applies to all Li-Ion battery sizes and shapes.

Choosing the right 18650


Li-Ion 18650 is the most popular type of the Li-Ion batteries. That's why it is relatively easy to find corresponding chargers of different price and features levels. The same is true for the charging controllers, protection circuits, battery holders and other related machinery.

As for the 18650 cells themselves, we can separate two major groups:
  • Well-known brands like Samsung, LG, Panasonic, and Sanyo. They provide high-quality cells which parameters are close to those, declared in the datasheets. A pair of such cells cost between $10 and $15. BTW: Recently Panasonic acquired Sanyo, so their model lines can be mixed.
  • Less known brands. Here you can find cells which names are very like the well-known brands (for example it can be something like "ICR 18650 3.7V 5000mAh"). But in reality, their capacity can be 2-3, and sometimes even 5 times lower than declared. Even having such a big deviation between the spec and the reality, you still can build a battery from such cells and it will cost you from $5 to $10. If you are lucky enough such battery can even work nicely and reliably. If you prefer gambling in more entertaining areas - maybe it is better to stick to something more reliable and predictable.

For all good batteries, you can find a documentation (datasheet) which in some way describes all working parameters.

Let's have a look at the most important data, using the Sanyo/Panasonic UR18650ZY discharge chart as an example.
Discharge Characteristics chart example

Completely charged battery stays at the point A. We can drag a battery state to this point when we charge it connecting to the external power source with the voltage 4.2 V.

As the battery discharge, it moves along the horizontal axis to the right. This axis counts the amount of the electricity taken from the battery. While discharging, the voltage of the battery gradually goes down. When the battery is getting close to depletion (point B) the voltage suddenly drops down well beyond the working level. When this happens - discharging must be stopped immediately, otherwise, the battery will be damaged.

A special protection circuit (either built-in or external) should always be in place with the Li-Ion battery. It should prevent overcharging (exceeding 4.2 V) and over-discharging (dropping voltage below ~3.2 V). Otherwise, the battery will be killed. Sometimes even with the explosion, smoke and fire.

This graph is very typical for all Li-Ion cells:
  • To use the whole capacity of the cell, the charging voltage should not be less than 4.2 V (for this particular cell). If for example, your charger can reach only 3.8 V - you will loose at least 1000 mAh (the cell will start its travel not from the point A, but more rightward. And will run much shorter distance on the horizontal axis).
  • The discharge current also impacts the amount of the electricity which can be squeezed from the cell. Three colored lines show the behavior of the battery when discharged at the rate of 0.2C (625 mA), 0.5С (1250 mA) and 1С (2500 mA). Under heavier load, the battery voltage goes down quicker, and the consumer will receive less energy.
  • A lot also depends on the minimum voltage level, which is sufficient for your electronics. For example, Arduino boards start working unstable when the voltage goes slightly below 7 V (3.5 V per element in two-cells configuration). So, according to the chart, Arduino will be able to consume up to 2100 mAh, and the remaining capacity will be wasted since you will have to recharge the battery and bring the voltage back to the acceptable range.

You should analyze these parameters to see if the battery under consideration is a good fit for your project (if your charger can charge it at full capacity and if your electronics can consume all the capacity).

Let's have a look at another example - Samsung INR18650-30Q, which characteristics are shown in the tabular form.

Specification item What does it mean
Nominal discharge capacity: 3000 mAh This is the capacity measured when battery is charged and then discharged in "normal" or "nominal" mode
Charge: 1.50 A, 4.20 V, CCCV 150 mA cut-off "Normal" charge mode: 1.5 А, 4.2 V. (don't worry about the CCCV stuff for now). This is the charging mode which was used to measure the Nominal discharge capacity.
Discharge: 0.2C, 2.5 V discharge cut-off "Normal" discharge mode is 0.2С (which means 600 mA). When the voltage goes below 2.5 V the battery must be disconnected to avoid damage. This is the discharging mode which was used to measure the Nominal discharge capacity.
Nominal voltage 3.6 V This is the voltage you should expect at the battery output most of the time.
Discharge cut-off voltage, 2.5 V When the voltage goes below 2.5 V the battery must be disconnected to avoid damage.
Standard charge CCCV, 1.50 A, 4.20 ± 0.05 V, 150 mA cut-off Standard charge mode: 1.50 А, 4.2 V.  This is the mode which assures the longest battery life.
Rapid charge CCCV, 4A, 4.20 ± 0.05 V, 100mA cut-off Rapid charging mode: 4 А, 4.2 V - this is the maximum allowed charging mode. It will not destroy the battery but may reduce the lifespan if used too often.
Max. continuous discharge (Continuous) 15 A (at 25°C), 60% at 250 cycle 15 А - is the maximum current which can be served by the battery safely and continuously.
15 A is quite a lot. Batteries which max discharge current significantly exceeds C are referred to as high-drain batteries.

Search for the datasheet of the element you are interested in and make sure it fits your project requirements. If you struggle to find a datasheet on Internet - this is a definitive sign that you better avoid such purchase.

Test results


Test results can also be a good source of information when choosing the right battery.

Beware - there are lots of unprofessional tests which can be misleading. Pay attention to the testing method. If an "expert" places the battery into his RC toy, measure running time and grade the batteries - that is not the test you should take seriously.

Look for the tests which check batteries under different load, specifying the charging voltage, charging and discharging currents. Have a look at this 18650 test summary as a good example.

Protection, charge and discharge control


Another important area you need to take care about is battery protection from overcharge and over-discharge. If you cross the limits of the element - it can get damaged or even explode.

There are two ways you can do this:
  1. Use cells with the built-in protection
  2. Use an external controller which will cut the charging current if the voltage exceeds some upper limit (usually 4.2 V) and cut the load current if the voltage goes below some lower limit (usually 2.5 V).
Protected Li-Ion cells are sometimes easier to use, but yet more expensive (sometimes twofold). Charge them with the external voltage 4.2 V and they will automatically disconnect reaching the maximum capacity. The built-in circuit will also protect the cell from over-discharge. The schematics of your project can be much simpler in this case. Read more about the cells with the built-in protection here.

Pay attention - your cell must have a real protection circuit based on a microchip. Don't confuse it with the cheap "thermal" or "short-circuit" protection - these types will save your battery from an explosion, but will not prevent battery destruction by incorrect charge or discharge modes.
18650 cell protection board

Protected elements have a coin-like board soldered to the minus pole and wrapped with the battery body into a uniform encasement.  There are brands which do not produce protected cells at all. There are also vendors which take cells from the reliable manufacturers, add protection circuit and wrap everything into the encasement with own brand and labels. It is impossible to visually identify if the element is protected or not - the only way is to trust the description provided by the seller.

Wikipedia says that correct marking for the protected 18650 cells is 19670 because they are bigger. But in real life, almost no one follows this guideline. Look here for more information on the visual difference between protected and unprotected cells.

Unprotected Li-Ion cells can be charged by any modern battery charger. All reasonable models have built-in protection circuits which know when is the right moment to stop. You can use a simple universal charger or complicated professional charger like iMAX B6. For our project, it is not quite important which charger to choose. Just make sure your charger can reach 4.2 V, so the full cell capacity will be utilized.

To be able to work with the unprotected cells, your device needs to have a special controller which will disconnect the battery once it will be drained down to some minimally acceptable level (usually 2.5 V).

There are lots of simple battery controllers. The simplest can even take the charging current from the USB cable so you won't need a separate power adapter. Here are some options:


Battery Controller - option 1
Option 1

Battery Controller - option 2
Option 2

Battery Controller - option 3
Option 3

You can read more about these controllers here: http://lygte-info.dk/review/Review%20Charger%20TP4056%20UK.html

There is a fundamental problem with such controllers. They are designed to work with a single cell with the charge voltage up to 4.2 V. Our battery should contain two elements with the max charging voltage 8.4 V. How can we charge this battery? You can't simply apply 8.4 V for such battery. If one cell has a smaller capacity than the other when completely charged it will start consuming excessive energy and can explode.

The simplest solution is to take your batteries out of the device and charge them in the external charger one by one.  You will keep the simplest battery controllers to protect the battery from over-discharge, connecting them in series.
Simple controllers protecting battery from the over-discharge

If you need to charge the batteries right inside the robot, the only way is to build a balanced charger. It will ensure each cell receives just enough energy, but not more than this.

You still can build a balancing scheme using simple single-cell charging controllers as described here: Multi-Cell LiPo Charging.  The idea is to break the series battery connection and charge them either in parallel or separately (through separate controllers).

Parallel charging is not quite optimal - charging takes twice longer and the full power of all cells can't be revealed since weak cells will prevent stronger ones to be charged fully.

Separated charging can be a good choice. You just need to connect very carefully all the wiring and lots of switches.

Simple controllers in parallel and separated charging modes

Of course, if you have such possibility, it is always better to use a specialized battery controllers, designed to operate multiple-cell batteries.

Good external chargers have a built-in balancer, so you can rely on it if needed (i.e. iMAX B6). Still,  this can be quite inconvenient.

The easiest to use and straightforward approach is to use a ready-to-go balancing battery controller like this one: 2S Li-ion Lithium Battery 18650 Charger Protection Module Board 3A 7.4V 8.4V.

Balancing controller for the 2-cells battery

To the leftmost contacts (B+ and B-) connect plus and minus poles of the battery. To the rightmost contact (BM) connect the point where two cells are joined (middle-point of the battery).

To the contacts P+ and P- connect the wires from the charger, and at the same time - the wires which supply electricity to your device. It could be safer to disconnect your electronics from the battery while it is being charged (use a simple power switch here).

"2S" in the controller board name actually means that it should be used for the 2-cells battery. For the bigger batteries, you can find also 3S and 4S boards. If your prefer playing with big and powerful toys - you'll need a high-power charging controller (i.e. 15A 8.4VDC BMS 2 Series 18650 Li-ion Lithium Battery Charging Protection Board With Balance Function).

As you see - nothing super-complicated here. Get a bunch of components, connect them - and they will work. The only complexity - how to choose the right combination from the huge diversity of the available choices.

What we've chosen for ourselves


As of today - we use a battery of six AA Duracell 2500 mAh cells. It is easy to use and pretty enough for our robot but is expensive and heavy. Unfortunately - we were ignorant at the point of taking such decision and had no idea about more optimal options.

When a time will come to replace this battery due to the age or lack of capacity - we for sure will switch to Li-Ion chemistry, using 18650 cells. We will use cells from a good brand without built-in protection. As a battery controller, we will use  2S Li-ion 18650 Charger Board. As a charger, we'll use any power source, capable of supplying 8.4 V with the currents suitable for the battery cells. Maybe we even buy the universal charging module like iMAX B6.

Connecting battery to the robot


The biggest consumers of the electric power are electric motors. In any case, motors must receive power directly from the battery and not through Arduino or other sensitive electronics.

All Motor Driver Boards are designed keeping in mind this need. The Motor Shield we use has a separate socket to receive direct power from the battery for the motors (EXT_PWR) - circled on the picture below.

Motor Shield with the EXT POWER socket highlighted


As for the Arduino - it can receive power from four inputs:
  1. USB port - the voltage here must be exactly 5 V, according to the standard.
  2. Two-contacts Jack socket. Here you can feed voltage between 6 V and 20 V, still, it is preferred to stick here to the range of 7-12 V to reduce the stress on the circuits. Maximum current - 1 A (with 7 V).
  3. Vin socket. It is a socket placed at the top of Arduino boards together with the other regular sockets. Acceptable voltages - 6-12 V. No significant limitations for the current, still if it will be too high - something can get fried.
  4. Any of the Arduino's 5 V sockets. It is inadvisable to use this way since the power supply will be reaching all the fragile circuits of the board without any protection. Precisely 5 V should be fed here, and even minimal voltage deviation will kill the board. If you are not 200% sure what you do - don't use this one.

Capacity and strength of our battery are enough to power both motors and the Arduino board. So we use the combined powering scheme. The plus pole of the battery is connected to the EXT_PWR socket of the Motor Shield. Part of the received current is diverted to the motors. Another part is diverted through the yellow jumper (see the picture) to the line which goes into the Vin socket at the Arduino board when the shield is installed on top. Arduino receives the voltage from the Motor Shield's  EXT_PWR socket and converts it to 5 V and 3.3 V as needed.

If the yellow jumper is removed, the powering circuits of Arduino and motors become independent. Thus you should power Arduino separately. What is interesting - Motor Shield will use Arduino 5 V power for all own circuits, so everything it receives at the EXT_PWR goes to the motors.

Beware! Plugged-in yellow jumper works in both directions! If you disconnect EXT_PWR from the battery but connect Arduino for example to USB, the yellow jumper will take 5 V from Arduino and divert it back to motors. If the motors will consume high current, you can destroy your Arduino board and even your USB hub or a port on PC.

To avoid surprises (and also to prevent your robot running out from your table when you try to upload a new firmware) we recommend connecting the yellow jumper only when you do not plan to connect Arduino to the USB. Or you can add switches which disconnect motors from the Motor Shield.

While mangling robots firmware, we disconnect the yellow jumper, and power Arduino through the USB port from the PowerBank.

NB: you can safely feed power to  Jack/Vin/EXT_PWR and USB simultaneously  - special elements on the Arduino board will deactivate USB power consumption if other power sources are plugged in. USB data exchange will not be interrupted. This protection works only in "USB vs everyone else" mode. Do not feed power from the different sources to Jack, Vin, and EXT_PWR  at the same time - uncomfortable conflicts can happen.

All the nuances of Arduino-specific power questions are explained here:  Feeding power to Arduino: the ultimate guide. This is a great reading to conclude this post.

No comments:

Post a Comment