Adding cheap and simple solar power to our small outdoor projects removes the
need to save energy or recharge batteries. Today we will enhance a simple 50 cents
Li-Ion charger board to do exactly that. Grüezi YouTubers. Here is the guy with the
Swiss accent. With a new episode and fresh ideas around sensors and microcontrollers.
Remember: If you subscribe, you will always sit in the first row.
To extend battery life, we usually deep-sleep our devices and use quality components that consume
minimal energy. Because this is not simple and still needs recharging the batteries from time
to time, I changed to using solar energy for all my outdoor projects. Much simpler!
What do we need to do so? - An appropriate solar panel
- A small battery to survive periods without sun - A simple battery charging device including
overvoltage and deep discharge protection - A simple voltage regulator
- And, because we are not beginners on this channel, I show you how you can add a power path
Let s start with the most important part: Our device we want to power.
For this video, I assume it is an ESP32. But you can use any other board as long as its voltage is
3.3 volts. If you want to use a 5-volt device, you need to add a step-up converter.
The first question we have to answer is:
How much energy does the device use per year. To get this number,
you have to measure its current consumption over time and do some calculations. Luckily,
solar power is very cheap these days, and we do not need exact numbers. We can use rules of thumb.
My light sensor, for example, wakes up every 10 minutes and transmits its values to Wi-Fi.
A simple rule of thumb says that an ESP needs below 10 seconds to connect and transfer values
via Wi-Fi. Then it sleeps. During the busy time, it consumes around 100mA. The energy consumption
for one cycle is 100mAx10sec = 1000mAs. For an hour, it is six times more. Converted in normal
battery speech, this is 1.7mAh. The Deep-sleep current is so small that we can forget it.
For a year it consumes 365x24x1.66mAh = 14 600 mAh at 3.3 volts. More or less five full 18650
batteries without solar charging. This is the minimal energy our solar panel has to deliver.
Of course, we use a bigger panel to be safe and to account for losses everywhere in the process.
In video #142, I showed how you could calculate the typical power output of a solar panel
at your geographical location. Today we make it simpler: We use one of those small and cheap 5 or
6 volt panels. It is too big for Switzerland and therefore should work for most locations
with similar loads. Maybe you even find a smaller one if you live in a country with more sun.
Because we have enough solar power, we only need a small battery to cover nights and bad weather.
Because the battery has to provide peak current for the ESP32, I suggest using one of those
small batteries. Most Li-Ion batteries will work. You even could use LiFePo4 batteries.
Then you would need a different charger board but could omit the 3.3-volt regulator. If you
want to do a proper calculation for the battery size, you also find the formulas in video #142.
What is next? We have to charge the battery, of course. In video #155, we did investigations
and found that, for low-power applications, no sophisticated MPPT charger is needed to get
decent performance. A simple TP4056 charger chip works fine. But we have to tweak it a little.
Fortunately, we get such boards that not only offer a charger chip but also two chips
to protect batteries from deep discharge. In video #160, you can see how they work.
This is the standard diagram of such boards. The TP4056 makes sure the battery is charged with
a proper charging curve. This means it uses a defined charging current up to 4.2 volts.
Below around 3 volts, this current is reduced to about 10% to safely
recover the battery from under voltage. The DW01, together with the FS8205 FETs, switches
the load off when the battery is below about 2.5 volts. Excellent! We quickly check the datasheet
of the TP4056. The maximum input voltage of the chip is 8 volts which fit our 6-volt solar cell,
and its maximum charging current is 1 ampere. For sure enough for our small solar panel.
So we can connect this board directly to the solar panel. But we have to take one thing into account:
The curve of a typical solar panel. They have a point where they deliver
maximum power. If we draw more current, for example, the power will decrease.
The datasheet of the charger board reveals that they chose a charging current of 1000mA.
Which sounds great but cannot be delivered by a typical panel used in this setup. This is why its
power can drop. You have to check with your panel if this happens, and if so, we have to find a way
to reduce the maximum current to a suitable value. The datasheet of the TP4056 shows how. If
we change this resistor to, for example, 10kOhms, the charging current is only 130mA.
Much better for our small panel. To do so, we have to replace this tiny resistor.
Good luck! I am too old for such tricks and have to do it like Indiana Jones:
I solder a 20k potentiometer from pin 2 to ground. Now I can adjust the charging current
to maximum current when the panel is in full sun. Problem solved! Our charger is finished,
and we can go on with the ESP board. The fully charged battery delivers 4.2 volts
and, if discharged, around 3 volts. The ESP32 is only rated up to 3.6 volts, and below 3 volts,
it becomes unstable. We have to keep this in mind. Most ESP32 boards sold run on 5 volt USB and have
additional components like a USB to serial chip on board. This is why I tend to use such a simple
PCB with a simple WROOM module. Unfortunately, it does not provide a 3.3-volt regulator. From other
videos, we know that the HT7333 is good enough for this purpose. And fortunately, if we cut its
middle leg, it perfectly fits here and connects to the ground and 3.3 volts. The battery voltage
can be connected to its cooling area on the other side of the chip. I even can add a 10uF tantalum
cap to make sure we comply with the datasheet. You see, my old hacker soul is still at work
Now our beloved ESP32 is protected against battery voltages above 3.6 volts,
and our solar-charged project is ready to rumble. But, as usual on this channel, we want more.
I add a battery monitor to all of my projects. With this simple voltage divider connected to
the regulator's input voltage, we can monitor the battery voltage with an ADC pin. The voltage
divider is needed to reduce the maximum voltage of 4.2 volts to below 3.3 volts for the ESP32 and
below one volt for the ESP8266. Its values are not critical because we can calibrate it in software.
All my devices include measured battery voltage in the values transmitted. I display them for
reference, and you even could use them for an alarm if something went wrong.
The second addition is a little more complex. As said before, the TP4056 charges the battery with
a low current if it is below 2.9 volts. If we have a closer look at our setup, we see what happens:
The battery and the ESP32 run in parallel, and the current coming from the TP4056
is divided into two parts. So the battery does not get the needed charging and stays below 2.9 volts
for a long time, or even forever. Not very good for a remote location.
Of course, you can prevent this situation by ensuring you never end here. This is how
I usually do it. With a too large solar panel and with monitoring the voltage, I feel safe.
But what can be done to avoid this situation in any case? We can add two diodes here and here.
If our solar panel delivers energy, its voltage is high, and the needed current flows directly to the
ESP. If we use a Schottky diode, the voltage drop is less than 0.3 volts. This power path removes
the battery from powering the load if solar energy is available. It also blocks this current if no
solar energy is produced. If current is left, it flows into the TP4056 and charges the battery.
This diode prevents solar current from going directly into the battery. It would be a
safety issue because it can go up to 6 volts. There is another advantage of this concept:
Without a power path, the load is always powered by the battery. As said before, the TP4056 charges
the battery up to 4.2 volts and stops charging, and only restarts at a lower voltage. This means
that your battery is continuously cycled a little and this might influence its lifetime.
The power path seems to be a simple and perfect solution! Unfortunately, it has a caveat:
This voltage drop across the diode reduces the usable battery capacity. The ESP stops working
even if the battery voltage is still ok. If we replace the diode with a P-channel FET,
the voltage drop is nearly zero, and the problem is solved. Excellent! Also, here I add the three
components to the charger board. Of course, it would be cool if the manufacturer would add
these components to its standard board. It would not be too difficult, I think.
Let s test the setup in full sun: The panel delivers nearly 130mA without the ESP32
connected. If we connect it, the panel delivers 143mA and the voltage at the ESP32 is 4.5 volts.
A clear indication that out power path works. If I turn the solar panel to simulate night, the ESP32
gets its power from the battery at around 3.5 volts. So the battery is not yet fully charged.
We now have simple and cheap solar power for all our small devices.
It even works without deep sleep if you increase the solar panel size and adjust the charging
current accordingly. Just make sure you stay below 8 volts. Otherwise, you fry the TP4056.
What should we remember? - A small solar panel can
easily power our ESP or similar boards - We only need a small battery
to survive periods without sun - If we use 6 volts solar panels, we can
use a simple and cheap TP4056 battery charger which includes all needed protection circuits
- To protect our 3.3-volt chips, usually, we have to add an LDO regulator like the HT7333
- Adding a power path makes our solution nearly professional. Unfortunately, the way I built it
was less professional but highly efficient Now, summer can come!
As always, you find all the relevant links in the description.
I hope this video was useful or at least interesting for you.
If true, please consider supporting the channel to secure its future existence. Thank you! Bye