Battery powered CO₂ monitor (well done)

Last modified April 1, 2021

In this tutorial I'm going to show you how to add a battery to any microcontroller-based project, correctly, without danger.

The uses are endless and although I will use as an example the Home CO2 Monitor, you can use it in any other project, be it based on Arduino, ESP8266, ESP32, or any other microcontroller.

There are few occasions when we would like use the CO2 monitor with batteries (at least it happens to me often).

Even to calibrate it outdoors periodically, it suits me that they are autonomous.

Until now I have used a powerbank, of those normally used for mobiles, for this purpose, but I thought it was time for a slightly more definitive, integrated solution.

The project that I present here allows you to equip with a rechargeable battery the CO2 monitor, or any other similar project, easily and for very little money. to any other similar project, easily and for very little money.

Also, by the end of this project it's not just about building it, but to comment on some things along the way, very important for makers willing to power their gadgets with batteries. Because, have you noticed the "well done" part in the title?

And what's this about it being well done?

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

I have a secret: This article is not just about telling you how to "connect" the battery, but to teach you why it is important to do it a certain way, which is why it is so extensive (and trust me, it could be a lot more extensive if we went into much more detail).

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

I think that by now everyone knows that Lithium Ion (Li-Ion) and Lithium Polymer (Lithium Polymer) batteries , or"Lipo", are delicate and they can even be dangerous. Surely many of you remember about the scooters that left burning alone on the street, not too long ago.

We live with these batteries and nothing usually happens, but that is 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, a little yes) but, above all, from the use made of it.

The problem lies in that most of the "non-specialist people" do not know (and it is logical, they do not have to know) what is that of "the use that is made of it" and even less when they are confident that if they take a battery and take a charger and plug them carefully, nothing bad can happen.


There is a type of use that is especially delicate and I'm sick of seeing projects with a design that puts your battery, your device and your house in danger.

This type of use is, above all, when you want to use the device and charge the battery at the same time.

Think about it, there are not so many devices that do that. We can think of phones and, that they are really extended, few more ...

We want the battery of our meter to be always charged, we want our device to work while the battery is charging. We don't want to have to turn the meter off for a few hours while the battery charges.

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. Do not short circuits the battery (this is as important as the previous 10)
  12. Do not over-discharge the battery below a certain level
  13. Don't let it be hot Battery
  14. Don't put batteries in parallel if they are not the same and have the same charge

They are not the only ones, but they are the ones you can do let your house go on fire more easily.

The sin of most projects

Most projects that are seen on the internet commit a serious mistake and I'm going to tell you what it is in a simple way so you can understand it quickly.

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 at which you have to stop loading it and do not go from there. Continuing to charge the battery after that point is dangerous.

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

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

Battery charging process with TP4056
  1. First the charger does some security checks to make sure that the battery is not connected backwards, that it is within a certain voltage range, etc.
  2. The charger then performs a "Pre conditioning", in which it checks, 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 by giving it current, and so on.
  3. Begins the constant current charging, which takes almost the entire charging process. That means that the charger will change the voltage that supplies the battery as needed 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, it begins to reduce the current intensity supplied to the battery.
  5. When the current is less than a certain value, the charger stops charging. It's over.

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 lasts.

Have you noticed how many devices that run on battery have problems with it? Well, there you have a good reason.

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

The usual and (very) poorly made power supply system

What people do in many (many) projects is the following:

Thay start with a project, which is powered normally at 5 volts.

The next thing would be to add a battery with its charger (a small board based on the integrated circuit TP4056, which works great and is capable of charging the battery with an accuracy of 1.5%), and that could be left connected always to keep permanently charged battery:

Sure, in the previous 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 couldn't use it directly to power our circuit (which needs 3.3 or 5 volts to work).

What our clever designer does is 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 to the input (within a few limits that depend on the exact circuit we use, say between 2.5 and 30 volts) and that at the output it will always give us a wonderful 3.3 or 5 stabilized volts:

Maybe you are also interested in:  DIY CO2 Monitor with Ultra Low Power Consumption

But oh, our amateur designer notices after a short time (when the battery dies or disaster strikes, whatever happens before, but it will not take long), that there are things missing here for the circuit to work correctly and to sleep peacefully at night.

  1. A protection against over discharge, because if you leave your device connected too long and the battery discharges below a point, the battery will die (some batteries have this protection built-in).
  2. A protection against short circuits, because, let's be serious, at any time (and more in an amateur circuit, which is what we are) a cable can touch another, and ... the smoke that all electronic components carry inside ... (at best the cases).
  3. Other protections that may not cause the assembly or the house to burn, but are convenient to have.

So you go back to the design board and change the simple charger you had used for a more complete charger, which includes the necessary protections (pay attention to the connections to the charger, they are very similar, but not the same: the previous one had only two terminals output and this has four independent terminals , two for the battery and another two for output):

At this point, our hobbyist designer has what he wanted. A power system that works with battery, that can charge the battery and power the device at the same time and that has the necessary protections ...

He tried it and it works! and so happy he publishes it...

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


And why is this happening?

The key is in the first point of the TP4056 integrated circuit datasheet:

"The TP4056 automatically ends 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 charging current drops to one tenth of the programmed charging current.

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

If the programmed charge current is 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 previous problem is to get that the battery charging and power circuits of our device are independent.

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

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

And here we have it only with battery:

This, electronically, is usually done by a MOSFET transistor and a diode, working together, so that between the two they are able to direct the current down the right path, depending on whether there is external power supply or not:

Basically we have the same forbidden circuit as before, but now we have that "automatic switch" that chooses the right path for the current.

The following is the path that current takes when external power is connected. As you see the battery charge and the power supply of our device are completely independent:

When there is no external power, our device is powered only from the battery:

In addition, in this way also we give priority to external power on the battery when the device is powered by cable, so that we will prevent our circuit from causing continuous charging and discharging of the battery (which would shorten his life a lot).

The images above are from an excellent Microchip manufacturer's application note, where it talks about the design of Li-Ion battery chargers and the circuits «load sharing»(Load sharing) or«power path»(Path of the stream). If you are interested in knowing more I recommend reading it, here.

And how do we do it the right way?

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

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

You can find the datasheet of the MCP73871 here.

Being so small it is actually very difficult for an maker to solder correctly. The good news is that we can buy a board that has the MCP73871 integrated and all the components it needs to work for less than 2€. So the project is super easy!

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

Don't miss out if at any time you plan to add a 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 battery charging by solar panels (5.5 and 6V) since it has the intelligence necessary to not overload the solar panel and always extract the maximum energy possible. Below you can read more about this feature, called VPCC.


If you are going to use this board by powering it with a charger or power supply, I recommend that you connect it as I indicate below (current input to the terminals + and - instead of the PWR terminal, take a good look at the picture so as not to confuse the two pins marked "+" that are quite close together):

Also check below, and in the second video, as you should modify the board to optimize it for use with a power adaptor or charger.

The tutorial is divided into two videos:

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

At second video You will see the recommended modifications so that the charger works correctly with an external power adapter 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 may be interesting.

If you like the videos, don't forget to "Like" and subscribe to the channel. It will motivate me to keep making more videos like these.

Also related: To know how to measure battery voltage with ESP Easy with your Arduino, ESP8266 or ESP32 (or any other way), be sure to check the following tutorial:

The tutorial materials

In the tutorial I have used very cheap and easy to find materials.

I leave you the links where I have bought the components and materials that I have used to make the tutorial:

👉 Power management board, charger MCP73871 DIY More
👉 Step up booster board
👉 Battery protection board
👉 Silicone cables
👉 RMA-223 Soldering Flux

Features, benefits and functionalities of our battery power system

There are other ways to approach this problem, but the one I propose in this tutorial has a lot of advantages. These are some of them:

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

You also have multiple additional options (for some of them you will have to check the datasheet of the integrated circuit to know how to use them):

Maybe you are also interested in:  CO2 Monitor on your cell phone with ESP32 and Sensirion SCD30 sensor [BASIC VERSION]

Preset High Precision Charge Voltage Options:

  • Battery charging at 4.10V, 4.20V, 4.35V or 4.40V
  • Regulation tolerance of 0.5%.
  • Constant current / Constant voltage (CC / CV)
  • 1.8A maximum total input current control (with heatsink). Without heatsink it is recommended not to exceed 1Amp.
  • Programmable fast charge current 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 recharge
  • Automatic end-of-charge control
  • Safety timer with timer on / off control
  • 0.1C preconditioning for heavily depleted cells
  • Battery cell temperature monitoring
  • Low voltage blocking (UVLO)
  • Low Battery Status Indicator (LBO)
  • Power Status Indicator (PG)
  • Indicators of charge status and error states

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

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

Analysis and practical tests

Here you have the first practical test.

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

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

Sure, it says "any good output filter capacitor" and a "good capacitor" is not cheap, so the manufacturer seems to have decided save costs by using a mediocre but much larger capacitor..

To check if this was the case, I have performed the following two tests:

With original capacitor of 4700μF 25V. With a 5V input from a powerbank.

And the result is the following:

With a 4.7μF 25V tantalum capacitor, as indicated by the 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 good, especially taking into account that probably part of the noise observed is from the oscilloscope itself, which is also in a fairly electrically noisy environment.

These have been some rapid no-load tests. It could be that as the load increases, the 4.7μF capacitor is not enough and you have to put a larger one. I'll do more measurements when I have time and put them here.

It is also quite possible that this larger capacitor is needed when using solar panels.

MCP73871 Charging board analysis and tests

Update (3/23/2021): The mystery is now 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 below the point "Modifying the board for use with a charger / power supply (modify VPCC)" to learn more.

This power management and charging board is a bit of a mystery.

It seems like a inexpensive version of an Adafruit board "USB, DC & Solar Lipoly Charger" which, with the same chip and the same characteristics, is priced at € 17. Adafruit no longer sells this board, it 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 working for several weeks without any problem (mainly plugged into the network, with very little battery use), following a comment from a user , which said that the meter did not work if it 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 I found some things a little weird

The fact is that I have not yet had time to make checks on the meter that I assembled (you have already seen in the video that everything is glued and quite tight, so I have to disassemble a lot) but I have made a test assembly composed of : A laboratory power supply at the Power input, a 18650 battery with a capacity of 2800mAh at the BAT input and a computer-controlled electronic load at the output.

The initial test results have been very mysterious ...

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

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

Unfortunately, the board manufacturer (DIY More) has not published the diagram or documentation on its use, so it is necessary to reverse engineer the board with a microscope, multimeter and datasheet.

Updated 3/23/2021: Thanks to the user jcomas we have available the scheme of the "DIY More" board. (Thanks Josep!)

Update (3/23/2021): Mystery solved. As I mentioned above, if you are going to use the board with a power supply or USB charger, read the point "Modifying the board for use with a charger / power supply (modify VPCC)" below to learn more.

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

Some pins of the MCP73871

The MCP73871 IC has several pins that, depending on whether they are set to high or low logic level, change the operating characteristics of the chip, activate and deactivate options, etc.

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

Next, I detail some checks, measurements and tests that I have carried out on some pins in that reverse engineering effort that I was telling you.

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

This pin allows the MCP73871 to operate in two modes, 'USB' or 'Power'.

When set to low level the operating mode is USB and, in this mode, the MCP73871 will limit 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 pin set to high level, the operating mode will be "power adpter". In this case, the MCP73871 eliminates the limitations of input current consumption and will consume up to 1.8A from the power supply to which it is connected.

This board comes by default with this pin set to high level (through a 10K resistor) so its operation mode is with power adapter, being able to consume up to 1.8A.

The board has at the bottom a pad marked SEL that allows to modify this pin level easily (easily when knowing how to use it, of course. I still have to investigate the schematics).

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

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

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

Pin PROG1 (13) - Load current programming

The battery charging current can be programmed by means of the resistor connected to the PROG1 pin of the MCP73871 IC, in this way it is possible to adjust it between 100mA and 1000mA.

The board is supplied from the manufacturer with a 2K resistor, which programs the MCP73871 to charge the battery with 500mA. Substituting the 2K resistor wiat a 1K resistance we would get a load current of 1000mA , and if we change it for a 10K one, the carge current would be limited to 100mA.

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

Keep in mind that the maximum charge current indicated by the battery manufacturer must always be respected. When this data is not available, the acceptable value would be half the battery capacity (That is, if the battery is 1200mAh it is usually 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, since one of the main characteristics of this chip depends on it, which differentiates it from other similar chips.

Maybe you are also interested in:  CO₂ meter with MQ-135 sensor (Don't miss it, it's not what it seems)

The MCP73871 allows the battery to be charged using solar panels (maximizing its efficiency to take full advantage of the energy that these panels can provide), and one of the characteristics of the panels is that as you charge more a solar panel (asking for more intensity of exit) there is a critical point at which the panel "collapses"; its voltage drops sharply and the energy it can deliver as well.

This means that we have to be careful so that the panel does not collapse. In other words: you have to try to get the maximum intensity possible from it, but just before the point of "collapse" and that point is continuously varying with the solar energy that exists at that moment and with the consumption of the circuit that we have connected.

The VPCC feature that includes the MCP73871 chip serves to optimize this and works as follows (short and simple explanation, so you understand what it is about, to find out more see the datasheet where this functionality is explained in detail):

The MCP73871 monitors the voltage delivered by the panel through a voltage divider that connects to the VPCC pin. The voltage divider must be calculated so that the VPCC pin has 1.23V when the voltage of the solar panel is the optimum one that allows it to give maximum energy.

When the voltage at the VPCC pin drops below 1.23V the chip reduces the intensity demanded from the panel, lowering the charging current to give priority to the device connected to its output (and supplying the intensity that is necessary from the battery, if that of the solar panel is not enough, until complete).

This function can be deactivated, joining the VPCC pin to IN.

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

This voltage divider that you can see in the example is very similar to the one that our board has mounted from the factory. The difference is that 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 optimize operation as a charger with a solar panel, and not with a power supply or USB port.

As our board is factory optimized 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 adapter, 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 that it would demand from the charger or power adapter, complementing the energy that is missing to power the circuit from the battery.

Modifying the board for use with a USB charger or power adapter (modify VPCC)

If we are going to regularly 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 disable it by means of connecting the VPCC pin to IN.

As I have mentioned in the previous point, the board, as it comes from the factory, is optimized for charging by solar panels, with the VPCC adjusted so that the charging current decreases 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, so the charging current would be drastically reduced.

To solve this problem, you have two options:

  1. You can completely disable VPCC by binding the VPCC pin to IN.
  2. You can change the VPCC voltage divider to lower the voltage from which the load drops.

I am going to 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 is that it is normally not necessary if you are going to use the board with a USB charger or 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 the MCP73871

As I mentioned before, we can deactivate this functionality, joining the VPCC pin to Vin.

And that how do we do it?

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

This voltage divider that you can see in the example is very similar to the one that our board has mounted from the factory. The difference is that 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 that interest us on our plate (R1 and R5 is the silkscreen that is on the plate, although now you will not see it well 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 only have to remove both resistors and in the place occupied by the 270K resistor we make a bridge with a drop of tin or a piece of wire (where the 100K resistor was). That's it!

You have step-by-step instructions to make this modification in the second video, which you can find above.

The step up and optimization of consumption

After much research, it appears that the step up used, also called boost converter, is based on the integrated circuit MT3608 (or a Chinese version).

An interesting thing about this chip is that it has a ENABLE pin (enable), which allows you "Turn on and off" at will the step up from your microcontroller, and that way you can turn off and on the sensors or actuators that you have connected to it in order to save energy.

His operation it is very simple: when this pin is connected to VCC, the step up is working and at its output we will obtain the expected voltage. When the pin is connected to GND, the chip will be "off" and at its output we will get 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 that the step up is always working), so if you want to use this pin, you will have to perform a little modification, consisting of cutting the track that connects to VCC and connect the pin to a pin on your microcontroller, by means of a 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 is a tricky operation, given the small size of the components, but, as I always say, nothing that cannot be achieved with a little determination.

In the following photographs you can see the track of the printed circuit board that you have to cut to disconnect it from VCC, as well as the wire soldered to the ENABLE pin that you must connect to the pin of your microcontroller that you want the step up to turn on and off.

Here is the link to MT3608 datasheet, in case you want to know more about him.

This will continue to grow ...

With this you can start, although many things have been left in the pipeline.

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

Also, I want to show other similar boards, tests, measurements and analysis of operation 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.

Subscribe now to the newsletter and join the Telegram group and don't miss it.

13 thoughts on “Medidor de CO₂ con batería (bien hecho)”

  1. Well, we are looking forward to finishing the article, I already told you in the Telegram group that I would like to put a model airplane camera broadcasting at 5.8 Ghz and power it with a solar panel. We could use it very well to use it as a beacon and to do antenna tests.
    I admire your ability to communicate complex things in a simple way that all kinds of people can understand.
    Congratulations !

    • Hello Zulu.

      Yes, it's giving me a little more work than expected. I hope to finish it shortly, I don't have much left. Promised!

      Regards, and thank you very much. 😀

  2. Another one that is burning the F5 waiting for you to update the article 🙂 I already have a meter at school and I just ordered materials for another one for me, this one had an idea to do it with battery.
    At least you could leave us the shopping list, which then takes a long time to arrive .. hehe
    Thank you very much for your work! and what we learn.

  3. Excellent article, I am learning a lot. One question: these shields

    Would they fall into the category of boards with the TP4056 chip? Because if not, could they be used for the portable CO2 meter project? Greetings and thanks for all the information published.

    • Hello Jose.
      Among the many boards bought and tested to write this tutorial, I bought two of these (the 1 and 2 cell ones). They do not have load sharing and consume a lot with no load.

  4. First, to thank you Mario for the piece article that you have created and that little by little you are expanding.
    Second, you could name some boards that work correctly without charging the battery and could be powered via external designed for IoT devices.

    Greetings and again, thanks for the information and for your time

    • Hello Miguel.

      Thank you very much for your comment.

      The truth is that I have not found any boards with ESP8266 that are well optimized for battery use and that are affordable and easy to get.

      I recommend using an ESP12 directly with an energy management system like the one I have described here.

      In the blog article Experiments with ESP Easy (ESP8266) and low consumption - v1.0, which you can find here: You can find a lot of useful information about optimizing the hardware for battery use (even if the software in the examples is based on ESP Easy it doesn't matter).

  5. Hi, thank you for this article which has helped me enormously, however I still can't 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

    • 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.

  6. 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 ..)

    • 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 have the time.

      Best regards.

  7. 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 bear in mind that it is receiving 5v from the step up and when you connect the usb to load the program from the pc, there will be another 5v through this port.

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

    Thank you

    • Hi Elliot.

      The truth is that I don't know the Arduino Nano schematic so I can't answer you exactly.

      If I can tell you that, although most of the 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 around and normally when you power through USB the 5V comes out by the 5V pin. For this reason it is not very advisable, in general, to do what you suggest because I do not know how the step up will behave when you put these 5V through its output (and it is very likely that it does not feel good at all).

      Let's see if any user knows it in greater detail and can answer you better. For now, my recommendation is that you disconnect the power from the 5V pin when you go to program it.

      A greeting.


Leave a Comment