Adding battery charger to ESP8266 and ESP32 (well done)

Last modified 4 months

In this tutorial I will show you how to add battery and charger to any microcontroller based project, is based on Arduino, ESP8266, ESP32, or any other, correctly, safely, easily and for very little money.

In addition, the aim of this project it's not just about mounting itbut to discuss a few things along the way, which are very important for the hobbyist who wants to equip his drum kit with drums. And the fact is that, did you notice the "well done"in the title?

The uses are endless and, although I will be using as an example my project of Home CO2 Meteryou can use it in any other project.

There are more than a few occasions when we would like to use our battery-powered CO2 meter (at least it often happens to me). Even to calibrate it outdoors periodically, it is good for me that they are autonomous. Until now I have been using for this purpose a powerbank (rechargeable power supply with battery), commonly used for powering mobile phones, but I thought it was time for a slightly more integrated solution.

And what's this about it being well done?

Putting a battery in a thing that runs on 5V (or, for that matter, 3.3V) seems like one of the simplest things in the world, right?

I have a secretThis article is not just about telling you as to "ride" the battery, but to teach you why it is important to do it in a certain wayThat is why it is so extensive (and, believe me, it could be much more extensive if we went into much more detail).

I ask you a favour: Even if you think this is very simple and that there is too much talk in this article for something so easy, please read the whole article (don't just go "to the assembly"), you might already know it all, but you might be surprised.

I think that by now everyone knows that Lithium-Ion (Li-Ion) and Lithium Polymer (Lithium Polymer) batteries o "Lipo") are delicate and may even be dangerous. I'm sure many of you remember the scooters that went out on fire on their own in the street, not too long ago.

We live with these batteries and nothing usually happens, but that's because the vast majority of commercial devices that use them know their risks and manage them appropriately.

The danger does not come from the battery itself (well, it does a little) but, above all, from the way it is used.

The problem often lies in the fact that the majority of the "non-specialistsdoesn't know (and it's logical, he doesn't have to know) what it is about "...".the use made of it"And even less so when they trust that if they take a battery and take a charger and plug them in carefully, nothing bad can happen.

WRONG!

There is one type of use which is particularly sensitive and I am sick and tired of seeing projects with a design that puts your battery, your device and your home at risk.

This type of use is mainly when You want to use the device and charge the battery at the same time..

Think about it, there are not that many devices that do that. We can think of the phones and, that they are really widespread, few others...

We want the battery of our meter to be charged at all times, we want our device to work while the battery is charging. We do not want to have to turn the meter off for a few hours while the battery is charging.

The commandments of Li-ion and Li-po batteries

These are the ten most important commandments + 1 when working with Li-ion and Li-po batteries (and then others follow):

  1. Don't overcharge the battery
  2. Don't overcharge the battery
  3. Don't overcharge the battery
  4. Don't overcharge the battery
  5. Don't overcharge the battery
  6. Don't overcharge the battery
  7. Don't overcharge the battery
  8. Don't overcharge the battery
  9. Don't overcharge the battery
  10. Don't overcharge the battery
  11. No short circuits the battery (this is as important as the previous 10)
  12. No overloads the battery below one point
  13. Don't let them hot the battery
  14. Do not put batteries in parallel if they are not equal and have the same load

They are not the only ones, but they are the ones you can do may your house go up in flames more easily.

The sin of most projects

Most of the projects you see on the internet commit the following mistakes a serious mistake and I am going to tell you what it is in a simple way so that you can quickly understand it.

If you remember, the first ten commandments said: "Don't overcharge the battery".. This means that, in the process of charging the battery, there is a certain point in the charging process at which you have to stop carrying it and go no further than that.. Continuing to charge the battery past this point is dangerous.

As you can imagine from the above paragraph, it follows that the charging process of a battery is very delicate and chargers for Li-ion and Li-po batteries (as opposed to lead-acid, nickel-cadmium or nickel-metal batteries, which can take more abuse) are very precise devices.

I am not going to explain in detail how the charging process of a Li-ion and Li-po battery works (maybe in another article) but I am going to give you the basics. main lines of what a charger does:

Battery charging process with TP4056
  1. First the charger makes security checks to ensure that the battery is not connected the wrong way round, that it is within a certain voltage range, etc.
  2. The charger then performs a "pre-conditioning".The battery is tested, in a very controlled way and by supplying low currents, that the battery "absorbs" the current it is expected to absorb, that its voltage rises when it is supplied with current, and so on.
  3. The constant current loadThe charging process lasts almost the entire charging process. This means that the charger will keep changing the voltage supplying the battery as required, so that the battery always absorbs the same intensity.
  4. When the charger detects that the battery is close to 4.2 volts, which marks its maximum voltage, starts to reduce the current intensity supplying the battery.
  5. When the current is below a certain value, the charger stops charging.. It has ended.

Well, the problem is that in most projects, the last point is never reached and the battery charges, and charges, and charges.... until... until the battery holds out.

Have you ever noticed how many battery-operated devices have problems with the battery? Well, that's a good reason.

And why doesn't it stop charging? Well, I will also explain it to you below.

The usual and (very) poorly made feeding system

What they do in many (very many) projects is the following:

We start from a project, which is powered normally at 5 volts.

The next step would be to add a battery with its charger (a small board based on the TP4056 integrated circuit, which works very well and is able to charge the battery with an accuracy of 1.5%), and which could be left connected at all times to keep the battery permanently charged:

Of course, in the above example we would have a charged battery but that battery would give us a voltage of between about 3 and 4.2 volts, depending on how charged it is, and we would not be able to use it directly to power our circuit. (which needs 3.3 or 5 volts to operate).

What our clever designer does is to connect, in parallel with the battery, a circuit called "step up down" (among other curious combinations of words such as booster or SEPIC), to which we can apply any voltage at the input (within limits that depend on the exact circuit we use, say between 2.5 and 30 volts) and that at the output will always give a nice 3.3 or 5 volts stabilised.:

But, alas, our amateur designer soon realises that he is not alone (when the battery dies or disaster strikesThe first thing that happens, but it won't take long), that things are missing here to make your circuit work properly, and can sleep peacefully at night.

  1. A protection against overloadIf you leave your device plugged in for too long and the battery discharges below a certain point, the battery will die (some batteries have this protection built in).
  2. A protection against short circuitsbecause, let's be serious, at any moment (and more so in an amateur circuit, which is what we are) a cable can touch another one, and... the smoke that all the electronic components have inside escapes... (in the best of cases).
  3. Other protections which may not cause the assembly or the house to burn down, but which are convenient to have.

So he goes back to the design board and changes the simple loader he had been using for a more complete chargerThe device must be equipped with the necessary protections (pay attention to the connections to the charger), are very similar, but not the same: the previous one had only two terminals and it has four terminals two for the battery and two for the output):

At this point, our amateur designer has got what he wanted. A battery-operated power supply system that can charge the battery and power the device at the same time and has the necessary protections...

He tests it and it works! and he is so happy he publishes it...

But that design (so extremely widespread, Google it if you want and you'll see hundreds of them) hides a dark secret, a deadly sin that can put us in danger:

THE CHARGER NEVER FINISHES CHARGING THE BATTERY, THUS BREAKING THE FIRST 10 COMMANDMENTS!

Why is this happening?

The key to this can be found in the first point of the TP4056 integrated circuit datasheet:

"The TP4056 automatically terminates the charge cycle when the charge current drops to 1/10 of the programmed value after reaching the final float voltage."

This means that the TP4056 will stop charging the battery. only when the final voltage has reached 4.2V and the charge current drops to one tenth of the programmed charge current.

By default, on most boards with the TP4056 (and others like it) the programmed charging current is 1 Ampere (this can be changed by changing a resistor), which means that until there is a consumption less than 100mA the charging process will not be interrupted and, as we have an additional circuit connected, the "hanging from the charger"the charger will look like "confused"for this additional consumption and will never stop charging the battery.

If the programmed charging current was 500mA. the charger would only finish charging the battery when the voltage had reached 4.2V and the consumption was less than 50mA.

The basic solution

The solution to the above problem is to achieve that the battery charging and power supply circuits of our device are independent of each other..

Look at the diagram below, imagine if we had that switch in our circuit and it switched automatically. depending on whether the external power supply is connected or not.

Here it is with the external power connected. As you can see the battery continues to charge, but has no connection to our circuit:

And here it is only with the battery:

This, electronically, is usually done by a MOSFET transistor and a diodeThe two are working together, so that between them they are capable of directing the current in the right directiondepending on whether external power is available or not:

Basically we have the same forbidden circuit as beforebut now we have this "automatic switch"who chooses the right path for the current.

This is the path the current takes when the external power supply is connected. As you can see the charging of the battery and the power supply of our device are completely independent:

When there is no external power supply, our device is powered by of the battery only:

In addition, this also allows you to we give priority to external power supply on the battery when the device is powered by cable, so that we will avoid our circuit causing continuous charging and discharging of the battery (which would greatly shorten its life).

The above images are of an excellent manufacturer's application note Microchipwhere he talks about the design of Li-Ion battery chargers and circuits".load sharing"(load sharing) or "power path"(path of the current). If you are interested in finding out more I recommend you to read it, here.

And how do we get it right?

A few years ago we would have needed a lot of components: Several for battery protections, several for the charger, several for load sharing. Now we have on the market integrated circuits that do all of these functions in a quarter of a square centimetre.

The solution I bring you this time is based on one of these integrated circuits. The integrated circuit MCP73871.

Here is the datasheet of the MCP73871.

Because it is so small it is really very difficult for an amateur to solder. The good news is that we can buy a board that has the integrated MCP73871 and all the components it needs to function by less than €2. so the project is super easy!

I have prepared a complete video tutorial where I explain everything, everything and everything, step by step.

Don't miss it if you ever plan to add battery and charger to any of your projects.

By the way, before I forget, and as I tell in the video, this circuit is completely compatible with the battery charging by solar panels (5.5 and 6V), as it has the intelligence to avoid overcharging the solar panel and to extract as much energy as possible from it at any given moment. Read more about this functionality, called VPCC, below.

IMPORTANT (UPDATE FROM THE FIRST VIDEO):

If you are going to use this board powered by a charger or power supply, I recommend that you connect it as shown below. (current input to terminals + y - instead of the PWR terminal (look closely at the picture so as not to confuse the two pins marked "+" which are close together):

Also check below, and in the second videoas you must modify the plate to optimise it for use with a power supply or charger.

The tutorial is divided into two videos:

In the first video you will see the explanation and general assembly.

In the second video you will see the recommended modifications to make the charger work properly with an external power supply or charger (instead of a solar panel).

The videos are a bit long because they are explained in great detail and are full of tips and information that I think you might find interesting.

Making these videos takes a lot of work. If you like the video don't forget to Like and subscribe to the channel. That will motivate me to keep making more videos like these.

To find out how to measure battery voltage with ESP Easy, be sure to watch the following tutorial:

The tutorial materials

In the tutorial I have used very cheap and easily available materials.

Here are the links to where I bought the components and materials I used to make the tutorial:

👉 Power management board, charger MCP73871 DIY More
👉 Step up lifting plate (booster)
👉 Battery protection plate
👉 Silicone cables
👉 Soldering Flux RMA-223
👉 Micro-USB connector with PCB board for cabling

Features benefits and functionalities of our battery powered system

There are other ways of tackling this problem, but the one I propose in this tutorial has many advantages. These are some of them:

  • Integrated system load sharing and battery charge management (load sharing/power path).
  • Simultaneous system power supply and charging of the lithium-ion battery
  • The voltage proportional current control (VPCC) ensures that system charging takes priority over the charging current of the lithium-ion battery.
  • Management of the low loss feed route with "ideal diode" operation
  • Controller of linear load management complete
  • Pass transistors integrated
  • Protection of reverse discharge integrated
  • Selectable input power supplies: USB port or wall adapter AC-DC

You also have at your disposal a wide range of additional options (for some of them you will have to check the datasheet of the integrated circuit to know how to use them):

Pre-set high precision charging voltage options:

  • Battery charging at 4.10V, 4.20V, 4.35V or 4.40V
  • Regulating tolerance of 0.5%.
  • Constant Current / Constant Voltage (CC/CV)
  • 1.8A max. total input current control (with heatsink). Without heatsink it is recommended not to exceed 1Amp..
  • Fast charge current programmable by resistance. Control: 50 mA to 1A
  • Resistor programmable load termination set point
  • Selectable USB input current control. Absolute maximum: 100 mA (L) / 500 mA (H)
  • Automatic reloading
  • Automatic end-of-load control
  • Safety timer with timer activation/deactivation control
  • 0.1C preconditioning for heavily depleted cells
  • Battery cell temperature control
  • Under Voltage Lockout (UVLO)
  • Low battery status indicator (LBO)
  • Power status indicator (PG)
  • Indicators for charge status and error states

In addition, with the improvements introduced in the second video, we will get:

  • Optimised for use with external power supply or charger
  • Short-circuit protection
  • Overload protection
  • Over-discharge protection
  • Overcurrent protection
  • Battery voltage measurement from ESP8266

Analysis and practical tests

I leave you with the first practical test.

I was very struck by the fact that this board has a such an extremely large capacitor (4700uF 25V), especially when the chip manufacturer recommends in its datasheet the use of a 4.7uF capacitor.

It seems to me that the answer is in the datasheet itself and I mark it below.

Of course, it says "any good output filter capacitor" and a "good capacitor" is not cheapThe manufacturer therefore seems to have decided to saving costs by using a mediocre but much larger capacitor.

To check whether this was the case, I carried out the following two tests:

With the condenser original from 4700μF 25V. With a 5V input from a powerbank.

And the result is as follows:

With a 4.7μF 25V tantalum capacitor, as specified by manufacturer of the chip.

The result is as follows:

As you can see, the result is practically the same (slightly better with the 4.7μF 25V tantalum, as it is a better quality capacitor).

In both cases the result is very goodThe more so since some of the observed noise is probably from the oscilloscope itself, which is also in a rather electrically noisy environment.

These have been some of the rapid no-load tests. It could be that as the load increases the 4.7μF capacitor is not enough and a larger one has to be fitted. I will make more measurements when I have time and post them here.

It is also quite possible that this larger capacitor may only be necessary when using solar panels.

Analysis of the load plate with MCP73871

Update (23/3/2021): The mystery is solved. The problems I discuss below were caused by a misconfigured VPCC. If you are going to use the board with a power supply or USB charger, read "Modifying the board for use with a charger/charger (modifying VPCC)" below to learn more.

This charging plate is a bit of a mystery.

It looks like a low-cost version of an Adafruit board "USB, DC & Solar Lipoly Charger" which, with the same chip and the same features, is priced at 17€. Adafruit no longer sells this board, but has replaced it with a similar one with the BQ24074 chip.

The reality is that after having the meter with which I have written this article and recorded the video running for several weeks without any problems (mainly plugged into the mains, with very little battery use), following a comment from a user, who said that the meter did not work if he did not have a battery installed (which theoretically would not be a problem, according to the datasheet of the MCP73871) I started to investigate and found some things a little strangers

The thing is that I haven't had time yet to test the meter I assembled (you have already seen in the video that it is all glued and quite tight, so you have to disassemble a lot) but I have made a test assembly composed of: A lab power supply at the Power input, an 18650 battery of about 2800mAh capacity at the BAT input and a computer controlled electronic load at the output.

The results of the initial tests have been very mysterious...

With the source set to 5.0V and limited to 1A, the battery charged (4.15V) and a load increasing from 0.1A to 1.2A in 0.1A increments every 2 seconds, the result was this:

As you can see, as the load increases (red line) the voltage supplied by the board (blue line) goes down, so that when the load is 0.5A the voltage supplied is 3.79V and when the load is 1.2A the voltage goes down to 3.16A.

Unfortunately the manufacturer of the board (DIY More) has not published the schematic or documentation on its use, so we have to reverse engineer it with microscope, multimeter and MCP73871 datasheet.

Updated 23/3/2021: Thanks to the user jcomas we have available the DIY More(Thank you Josep!)

Update (23/3/2021): This is now fixed. As mentioned above, if you are going to use the board with a power supply or USB charger, read "Modifying the board for use with a power supply/charger (modifying VPCC)" below to find out more.

Update (1/4/2021): Published second video with VPCC modification, improvements, optimisations, protection.

Some pins of the MCP73871

The MCP73871 integrated chip has several pins which, depending on whether they are set to logic high or logic low, change the chip's operating characteristics, activate and deactivate options, etc.

In the datasheet you can find a detailed description of what each of them does.

Here are some of the checks, measurements and tests I have carried out on some of the pins in that reverse engineering effort I was telling you about.

SEL pin (3) - Operation from USB port or mains power supply

This pin allows the MCP73871 to operate in two modes, "USB" or "power".

When it gets to low level the operating mode is USB and, in this mode, the MCP73871 will limit the current consumption so as not to damage the USB port to which it is connected (according to the USB standard these ports have relatively low power limitations).

With the pin to high level the operating mode shall be "feeder".. In this case, the MCP73871 eliminates input current consumption limitations and will draw up to 1.8A from the power supply to which it is connected.

The plaque for default comes with the pin at high level (through a 10K resistor), so its mode of operation is as a feeder, and it can consume up to 1.8A from the power supply.

The bottom of the plate has a pad marked SEL which allows us to modify the level of this pin easily (easily when I know how to use it, of course, I have to investigate it to see how is the scheme of this area because I have not found any explanation).

Pin PROG2 (4) - Maximum USB port current when SEL=LOW

This pin allows, when the MCP73871 is operating in USB mode (SEL pin low), to choose whether we want the chip to draw up to a maximum of 100mA or 500mA (low level = 100mA, high level = 500 mA).

This pin is accessible from the underside of the board, on a pad marked PROG2.

Pin PROG1 (13) - Programming of the charging current

The battery charging current can be programmed by means of the resistor connected to the PROG1 pin of the MCP73871 integrated circuit, so that it can be varied. between 100mA and 1000mA.

The plate is supplied factory set with a resistance of 2Kwhich programs the MCP73871 to charge the battery with 500mA. Substituting the 2K resistor for a 1K resistor would give a charge current of 1000mA. and if we replace it with a 10K the charge would be at 100mA.

In the following graph you can see what the load current would be for different values of the resistor connected to PROG1 so that you can choose the one that suits you best.

Note that the maximum charging current specified by the battery manufacturer must always be observed. Where this information is not available, the acceptable value would be half of the battery capacity (i.e. if the battery is 1200mAh it is acceptable to charge it at 600mA).

VPCC pin (2) - Voltage Proportional Charge Control (important for solar panels)

This pin is important for the operation of the MCP73871, as it is one of the main characteristics of this chip, which differentiates it from other similar chips.

The MCP73871 allows battery charging using solar panels (maximising their efficiency to make the most of the energy these panels can provide), and one of the characteristics of the panels is that as you charge a solar panel further (asking for more output current) there is a critical point at which the panel "collapses"; its voltage drops suddenly and so does the energy it can deliver.

This means that we have to be careful that the panel does not collapse. In other words, we must try to get the maximum possible intensity out of it, but we must also be careful that the panel does not collapse. just before the "collapse" point and that point varies continuously with the solar energy available at that moment and with the consumption of the circuit that we have connected...

The VPCC feature included in the MCP73871 chip serves to optimise this and works in the following way (short and simple explanation, to understand what it is all about, for more information see the datasheet where it is explained in detail):

The MCP73871 monitors the voltage delivered by the panel through a voltage divider that is connected to the VPCC pin. The voltage divider must be calculated so that 1.23V is present at the VPCC pin when the voltage of the solar panel is the optimum voltage that allows it to deliver maximum power.

When the voltage on the VPCC pin falls below 1.23V the chip reduces the current demanded from the panel, lowering the charging current of the battery to give priority to the output (the device connected to its output) and supplying the necessary current from the battery, if that of the solar panel is not sufficient, until it is completed.

This function can be disabled by connecting the VPCC pin to IN.

For example, if we have a system designed for panels providing 5.5V with ±0.5V tolerance (which is quite common), we will have to select the worst case scenario, which in this case would be 5.0V, to calculate the voltage to apply to the VPCC pin through the divider.


This voltage divider that you can see in the example is very similar to the one that comes with our board. The difference is that in our board instead of a 330K resistor we have a 270K resistor and instead of a 110K resistor we have a 100K resistor.

The board we have chosen is factory-configured to optimise operation as a charger with a solar panel, and not with a power supply or USB port.

Like our plate comes from the factory optimised for use with solar panels. with a voltage of 5.0V, it is possible that, if we connect it to a USB charger or power supply, the voltage drops below 5.0V (due to the voltage drop in the cables and the tolerances of the components), which would mean that the MCP73871 would limit the current it would demand from the power supply, supplementing the energy that is lacking to supply the circuit from the battery.

Important: If you are going to use this circuit with solar panels and you are going to power 5V equipmentInstead of a step up, it is recommended that you use a step down, as solar panels can give up to 5.5 or 6V at full output. The step up only raises the voltage (so the input voltage must be lower than the output voltage), while the step up down is capable of raising or lowering the voltage, depending on whether the input voltage is lower or higher than the desired voltage.

Modifying the board for use with charger/feeder (modifying VPCC)

If we are going to habitually use our charging board powered by a charger or power supply, (and although in many cases everything works correctly because the voltage remains above 5V) it is advisable to reduce the VPCC, modifying the voltage divider or disabling it by connecting the VPCC pin to IN.

As I mentioned in the previous point, the board, as it comes from the factory, is optimised for solar panel charging, with the VPCC set to decrease the charging current when the power supply drops below 5V.

This, when using the board with a power supply or USB charger, is a lottery because, depending on several factors that I have already mentioned, it is easy for the power supply to drop below 5V, which would drastically reduce the charging current.

To solve this problem, you have two options:

  1. You can disable VPCC completely by binding the VPCC pin to IN.
  2. You can change the voltage divider of the VPCC to reduce the voltage at which the load is reduced.

I will explain here how you can easily disable VPCC completely (option 1).

I am not going to explain option 2 step by step for two reasons: The first one is that it is not normally necessary if you are going to use the board with a charger or USB power supply. The second is that, being an advanced use, it is assumed that you know what you are doing and in the previous point I have already explained how to calculate the voltage divider yourself.

Disabling the VPCC of MCP73871

As I mentioned before, we can disable this functionalityby connecting the VPCC pin to Vin.

How about this how we do it?

Well, it's simple: As I explained before, the VPCC pin is connected to the power input via a voltage divider as follows:

This voltage divider that you can see in the example is very similar to the one that comes with our board. The difference is that in our board instead of a 330K resistor we have a 270K resistor and instead of a 110K resistor we have a 100K resistor.

This is the position of the two resistors we are interested in on our board (R1 and R5 is the silkscreen on the board, although you can't see it well now because the resistors are on top of the silkscreen, hiding it):

As what we have to do is to connect the VPCC pin directly to Vin, we just have to remove both resistors and in the place where the 270K resistor used to be, we make a bridge with a drop of tin or a small piece of wire (where the 100K was, we left the hole) and that's it!

Step-by-step instructions on how to make this modification can be found in the second video, which you can find above.

Step up and consumption optimisation

After considerable research, it appears that the step up used is based on the integrated circuit MT3608 (or a Chinese version).

One interesting thing about this chip is that it features a pin ENABLE (enable), which allows you to switch the step up "on and off" at will from your microcontrollerThe sensors or actuators connected to it can be switched on and off in order to save energy.

It is very simple: when this pin is connected to VCC, the step up is working and we will obtain the expected voltage at its output. When the pin is connected to GND, the chip will be "off" and at its output we will obtain 0 volts (which in practice means turning off whatever we have connected to it).

This is essential for energy savings.

The step up board does not have this pin accessible and it comes from the factory permanently connected to VCC (so the step up is always working), so if you want to use this pin, you will have to make a small modificationwhich consists of cut the track that connects it to VCC and connect the pin to a pin on your microcontroller.by means of a small cable.

When the pin of your microcontroller is at level 1 (on) we will start the step up and when it is at level 0 we will stop it.

It's a bit of a tricky operation, given the small size of the components, but, as I always say, nothing that can't be achieved with a bit of determination.

In the following pictures you can see the PCB track that you have to cut to disconnect it from VCC, as well as the little wire soldered to the ENABLE pin that you will have to connect to the pin of your microcontroller that you want to turn the step up on and off.

Here you have the MT3608 datasheetif you want to know more about him:

This will continue to grow...

With this you can start, although many things have been left out.

There are more things that I will be adding to this page as I prepare them, as the video was getting too long and there is "a lot of material to cut".

I want to show other similar boards, tests, measurements and performance analysis carried out with oscilloscope, electronic load and other measuring instruments.

And, you know, if you want me to expand on any particular aspect of this topic, leave it in the comments.

Sign up now for the newsletter and join the Telegram group and don't miss it.

28 thoughts on “Añadir cargador de batería a ESP8266 y ESP32 (bien hecho)”

  1. Well, we are looking forward to you finishing the article, I already told you in the Telegram group that I would like to put a model aircraft camera transmitting at 5.8 Ghz and feed it with a solar panel. It would be very useful to use it as a beacon and to test antennas.
    I admire your ability to communicate complex things in a simple way that can be understood by all kinds of people.
    Congratulations!
    Greetings.

    Reply
    • Hello Zulu.

      Yes, it's giving me a bit more work than expected. I hope to finish it soon, I don't have much left, promise!

      Best regards and thank you very much. 😀

      Reply
  2. Another one burning up the F5 waiting for you to update the article 🙂 I already have a meter at school and have just ordered materials for another one for myself, this one I was thinking of doing with a battery.
    You could at least leave us the shopping list, which takes a long time to arrive... hehehe.
    Thank you very much for the work you do! and what we learn.

    Reply
    • Hello José.
      Among the many boards I bought and tested to make this article, I bought two of these (1 and 2 cells). They have no load sharing and consume a lot of power at no load.

      Reply
  3. First of all, I would like to thank you Mario for the great article that you have created and that little by little you are expanding.
    Secondly, could you name some boards that would work properly without charging the battery and could be powered externally for IoT devices.

    Best regards and again, thanks for the information and your time.

    Reply
    • Hello Miguel.

      Thank you very much for your comment.

      The truth is that I haven't found a board with ESP8266 that is well optimised for battery use and that is affordable and easy to get.

      I recommend you to use directly an ESP12 with a power management system like the one I have described here.

      In the blog article Experiments with ESPEasy (ESP8266) and low power - v1.0which you can find here: https://emariete.com/experimentos-con-esp-easy-esp8266-y-bajo-consumo-v1-0/ you can find a lot of useful information about optimising the hardware for battery-powered use (even if the software in the examples is based on ESPEasy, it doesn't matter).

      Reply
  4. Hi, thank you for this article which has helped me enormously, however I still cant get my project to work fully. I am using the MCP73781 to feed a raspberry pi with a camera attached and a 10,000maH lipo battery. It will be connected to a solar panel so I have adjusted the input voltage to 5.5 volts to simulate a solar panel being connected for testing purposes. The problem is that it appears that the raspberry pi can demand up 700mA but the MCP73781 cant provide that amount (or so it seems). I ordered the MCP73781 as a solar charger so I haven't changed anything on the MCP73781. Does the MCP73781 limit the current when only using the battery (ie night time).? Kind regards

    Reply
    • Hi Donald.

      In this post the IC used is the MCP73871 not the MCP73781 so you will have to check the MCP73781's datasheet or the datasheet for the specific board you are using.

      Anyway, I have not experimented with this chip and high currents. The chip's datasheet says it has a Maximum 1.8A Total Input Current Control but for this current you will have to take an eye on the thermal design considerations (also on the datasheet). I'm not sure if this is the right chip for a Raspberry Pi kind of UPS, probably not.

      Reply
  5. Great explanations...bravo.
    You did mention : "The plate has at the bottom with a pad marked SEL that allows us to modify the level of this pin easily (easily when you know how to use it, of course, I have yet to investigate to see what the scheme of this area is like because I have not found any explanation)".
    there is also a pad for PROG2...
    Did you have time to investigate more on: how to use these pads...(to toggle HIGH or LOW logic for SEL & PROG2.
    I noticed SEL is connected to Vcc thru a 10K resistor (so set HIGH) .
    If I want to set it LOW, do i need to connect the pad to GND? (cannot believe it is so simple..)

    Reply
    • Hi David.

      Sorry for the bad translation. It was (mostly) an automatic translation. Now I took the time to do a (mostly) manual correction/translation to have a better translation to English, so I hope you and other English-speaking people can understand better the post.

      I had no time to test that but yes, it looks like it's as easy as connecting the pad to GND. Nothing more needed...

      I have pending to do some more tests and extend the article but didn't had the time.

      Best regards.

      Reply
  6. Hello Mr. Mariete: everything in the tutorial is quite clear, my project will use an arduino NANO, and my goal is that when the arduino is powered by the battery (that is, the step up output connected to the 5v pin of the arduino), I can load a program to the arduino by the usb of this "WITHOUT DISCONNECTING THE CHARGER".

    we must take into account that it is receiving 5v from the step up and when we connect the usb to load the program from the pc, through this port there will be another 5v.

    Is this way wise or do I need other circuitry to do this?

    Thank you

    Reply
    • Hi Elliot.

      The truth is that I don't know the schematic of the Arduino Nano so I can't give you an exact answer.

      I can tell you that, although most boards are protected by a diode so that when you feed it through the 5V pin these do not come out through the USB port, it is not usually the other way round and normally when you feed it through USB the 5V comes out through the 5V pin. For this reason it is not very advisable, in general, to do what you suggest because I don't know how the step up will behave when you put these 5V through its output (and it is very likely that it won't feel good at all).

      Let's see if a user knows it in more detail and can give you a better answer. For the moment, my recommendation is that you disconnect the power supply at the 5V pin when you are going to program it.

      Best regards.

      Reply
  7. Hello!
    First of all, congratulations for the article, very complete and instructive. I have a doubt about the use of the step-up to generate 5V after the plate, because if the solar panel delivers about 6V, the output voltage (Load) is about 5.7V, so the input voltage of the step-up is higher than the intended value at the output. With an MT3608 type board, that input voltage produces 5.5V at the output, which may be excessive in some cases...

    Thank you!

    Reply
    • Hello Ernesto.

      You are right. The input voltage with a solar panel might be too high for the step up mentioned in the post, although in my tests, and those of some users, there is no problem and the step up has coped well with the slight increase in voltage, above specs, with no problem. It should be noted that the moment a load is connected the panel voltage drops rapidly.

      Anyway, since you mention it and to avoid possible problems, I am going to include in the post a recommendation for users who use solar panels to use a "step up down" that allows them to apply higher input voltages more safely.

      Greetings and thank you very much for your contribution.

      Reply
  8. You answered many questions that have long sought answers.
    Thank you very much

    Note: I wanted to rate you with 5 stars and I don't know why it jumped with the first one, please excuse me.

    Reply
  9. Good explanations. I see the MCP73871 has five pins in one side which purpose I can't find. .They are marked +.-,D,+,C and the connectors reads "CN1". Do you know what are they used for?

    Reply
  10. I will answer myself.
    First +,- are connected ,respectively, to same PWR,GND pins in input power connector.
    D = discharging
    Next + goes to input power supply pin19 in chip
    C= charging

    So this pins can be read with a pill-up resistor to know the device state.

    Reply
  11. Very good project. One question, in the case of wanting to program the ESP32, would it be necessary to disconnect the battery power, or would it be possible just by connecting the usb cable? Thanks

    Reply
  12. Good afternoon, first of all, thank you very much for both the videos and this post, they are very good.
    I have a question, could two batteries be used in parallel to increase the usage time?

    Best regards and thank you!

    Reply
  13. Could the board be powered from a solar panel and an external supply at the same time? Would it be safe to operate?

    Thanks for your effort on explaining these topics.

    Reply
  14. Could the board be powered from a solar panel and an external supply at the same time? Would it be safe to operate?

    Thanks for your effort on explaining these topics.

    Reply
  15. If I wanted to use the micro usb port on the esp32 for the power input could I connect the boards 3v3 and ground to the input on the TP4056?

    Reply
  16. Hi, thank you for a comprehensive guide and all the effort you put into this!

    Could you help me understand more about the Low/High variable pins on the chip?
    You state that SEL for example is by default set to High (AC-DC) through a 10k resistor. In the datasheets we see that the leakage of all four of these pins is at max 1μΑ.
    That means the Voltage Drop of the resistor is 0.01V, thus they are all set to high. Do you think it is safe to remove the corresponding capacitors (thus breaking the connection to VDD) and then connecting the tabs to GND in order to set them to Low?

    Reply
  17. Actually this is contradictory of the video of the renounced youtuber bigclivedotcom called TP4056 myth busting

    Please check and if necessary adjust your article to refclect the safe usage of this popular and easy to implement module.

    Also what is missing there, please include a proper way to hold the battery level at 80% or 4V - is it with 2 parallel diodes or some other way.

    Reply
    • Both are right.

      The problem is not that the battery will charge above 4.2V, the problem is that the battery will be continually floating around 4.2V with continuous charging and discharging. This is one of the biggest enemies of these batteries. The battery will quickly degrade and that is where the main danger comes in. A battery of this type that is not in good condition is dangerous.

      Li-ion and li-op batteries can't stand this treatment.

      Reply

Leave a comment