Very high level thoughts here.
It looks like you have the battery connected to the ESP32 board ?
Im not sure how that is connected (sorry if posted and I have missed it).
But if direct to the 3.3V pin on the esp32, wont that risk some damage if the charger can output up to “* Charging Cutoff Voltage: 4.2V”
If the lipo is 3.7V, maybe some form of LDO between the lipo pack and the esp32. The LDO can be selected such that it wont supply power if the input its input range, thus not allowing the esp32 to run at a higher voltage. Which in tern should stop the lipo from getting down too low for it to work. If it does get down lower, 2.5V then in theory the max 4.2V would still be lower then the LDO turn on voltage (I dont know the charger profile).
I will leave an official comment to the gurus, but Im thinking you just need to keep the esp32 off until there is enough power to run and turn off before the battery gets too low.
i.e. from memory that 2.5V is too lower for a long term safe running of the lipo; so something needs to stop the draw before that point.
Note:
After some reading I see that “that” ESP32 S3 module has a battery input/output pads on that back (that I missed), thus looking after that Supply voltage to/from the ESP32S2 modules.
I wonder what would be the affect of a higher brownout settings (If you can tweak that in code)
7: ~3.20V (Highest/Most sensitive)
6: ~3.05V
5: ~2.90V
4: ~2.75V
3: ~2.60V
2: ~2.45V (Typical factory default)
1: ~2.30V
0: ~2.15V (Lowest)
// 1. Ensure the Brownout Detector is enabled
REG_SET_BIT(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_ENA);
// 2. Set the threshold voltage level (0 to 7)
// Example: Set to Level 7 (~3.2V)
REG_SET_FIELD(RTC_CNTL_BROWN_OUT_REG, RTC_CNTL_BROWN_OUT_THRES, 7);
i.e. holding the voltage a bit higher on the battery.
Correct my XIAO has a LDO, not exactly LDO but switching regulator SGM6029.
I hadn’t thought of that, but I can indeed configure my XIAO so that when it shuts down, it doesn’t keep trying to turn itself back on. I would then have to turn it on manually after the battery drains, but that could work.
However, I haven’t found the option to turn off the XIAO before the voltage on the LIPO gets too low; that could prevent damage to the battery indeed.
My initial thought that might be enough, but you need access to tweak the firmware.
Are you writing your own firmware ? or at least compiling and flashing.. If so youi may be able to tweak the brownout level. If you can it will mean it will cut out at a higher voltage, and should auto restart when high enough.
But the bit sticking in my mind is the power draw at boot v what can supply that at boot time. If your close to the limits now, then that bit extra in the battery might just me enough to be ok…
Great news that your charger is working as expected Time to go to the next step …
That is the next step and it is common, so do not worry - it can be worked out. My guess is that your XIAO-S3 is running all the time, and so using more power per day than the limited amount of sunshine can fill up your battery. So … you could put more power into your battery, or get the XIAO S3 to use less power - both can be done.
LiPo batteries are normally called 3.7 volt - but actually vary from 4.2v fully charged to 2.5v when empty. The XIAO ESP32-S3 has LDO circuitry to buck/boost the battery power to get the steady 3.3v it requires - however it cannot work properly at 2.5v, and so your XIAO keeps trying to start … but cannot.
Try to avoid letting the battery get so low as it shortens the life of the battery - I have found that voltage drops rapidly below 3.4 volts and In my greenhouse project I take action at 3.2v.
The solution is in two parts:
First you want to put some charge in your battery. Seeed expect you to connect a USB charger or powerbank to the XIAO’s USB socket to charge the battery. This will work even with the solar charger connected. Some powerbanks will turn of if the connected device is only drawing a small current.
I guess that you have the solar charger because you do not want your XIAO permanently connected to a USB charger - so you can disconnect the USB charger once the battery has enough charge to run the XIAO S3 for a while.
If you need the XIAO to run all the time you can use a big solar panel and large capacity battery.
But I have found that most applications actually only require the microcontroller to run periodically for a short time - for example to wake up for 2 minutes to read sensors and transmit the results, then it can sleep for 30 or 60 minutes. To do this you need to look at the documentation for deep_sleep in whichever programming language/environment you are using.
Johann, what environment/programming language are you using (eg Arduino IDE with C++, Circuit Python, PlatformIO, ESPHome) ? I use ESPHome, so the code I use is probably not helpful for you. Over the last 2 years I have added my thoughts and findings to the Notes on ESPHome deep_sleep discussion thread.
For that matter, I am curious what you will be using the XIAO and solar panel for ?
Additional considerations:
On an ESP32-S3, deep_sleep is actually powering off the main processor, and using the secondary low power processor to wake the main processor after a period of time, or on some other signal. There is also a light_sleep option (which I’m not familiar with).
Every time the main processor starts (wakes) it performs a full boot, including re-establishing communication on whatever network you have programmed
wi-fi consumes a lot of power, especially when it starts up and connects to the network.
This is the way to go.
But I think the limit here would be the maximum charging rate of the on board charging system on the XIAO. This will limit the battery size. The Solar panel can be as big as you like. Probably the bigger the better within reason but should be just a bit bigger that the on board charger wants for max charging current of the XIAO system.
If this is not enough to operate your XIAO for as long as you need you will have to re think your whole power system. A larger battery is all well and good but you have to be able to charge it in the Sun time available. The Max charging current of the XIAO system limits this as I said above.
If it is feasible and convenient the 2 Battery system I used as an example above in post 17 would be worth considering. Run everything from this and discard everything else.
Cheers Bob
As far as I’m aware, the XIAO doesn’t have a configurable battery cut-off that fully disconnects its load. A firmware voltage check can request deep sleep, but it isn’t independent protection if the software crashes or the voltage collapses during boot.
The simplest hardware solution would be a product like the Pololu regulator with a fixed low-voltage cut-off. If you wire it between the battery and XIAO, it would then turn the XIAO off at approximately 3.0 V. Hysteresis then keeps it off while the unloaded battery rebounds, only reconnecting once solar charging raises it above approximately 3.4 V. That should stop the repeated reboot cycle while giving the battery time to recover.
I have noticed that some of the ESP32 development boards have an ENable pin which can be used to turn off the LDO which powers the microprocessor … however I would suggest a different approach…
Since Johann is using an ESP32-S3, deep_sleep is his friend. Deep_sleep extends battery life by reducing the amount of power drained with a duty cycle of say 5 minutes awake then 30 minutes asleep. But it also can give longer time for the Solar Charger to top up the battery while the ESP32 is asleep. Ok, there won’t be any charge during the night, but during the day hopefully …
I have found that LiPo voltage drops off quite quickly from 3.4 volts, and I do not recommend letting it drop below 3.0volts.
I suggest checking the battery voltage at the start of each awake period.
A high voltage is not an issue since the XIAO won’t charge the battery over 4.2V.
As the voltage gets below 3.4v I send a notification to the user. Hopefully they can rectify the situation.
When the LiPo voltage is below 3.2v I go into a “hibernation” mode, setting a global variable and setting the sleep_duration to something like 4 hours, and start deep_sleep.
If the hibernation variable is set and there is now >3.4v then reset the hibernation variable, and restore the deep_sleep duration.
While in the hibernation mode the ESP32 is still waking briefly to test the battery voltage. With luck the battery has charged up and it resumes normal operation … otherwise goes back to sleep.
thank you for all your answer, sorry I was overseas. I will take time to study your message
Michael99645 No I didn’t plug my own firmware, I use meshtastic with official firmware
Donald23173 Correct my goal is to unplug my XIAO from USB, if it is unavailable sometimes is not a problem. Deep sleep is not suitable for me, because I connect my smartphone device on it and it is not compatible with this mode.
Robert93820 Change my solar panel is not currently an option. I just bought it, how I said if my Xiao is not available anytime is not a problem.
Jane To be sure to understand, the regulator can prevent the Xiao from restarting until there is a certain voltage in the battery? I’m not sure that when the Lipo is completely discharged, the solar panel can recharge it… but it could be my solution.
To summarize, I simply want the device to shut down if the solar panel doesn’t provide enough power (which it already does) and if the battery runs out. Then it will come back on (after several days?) once the solar panel has sufficiently recharged the battery
Thanks all again for your help and your good advice
What a strange statement. I have just read it for the fifth time and still don’t believe it.
If you have a device that is not up to the job you had planned for it, does not matter what it is, the fact you have just bought it is immaterial. The only way you are going to have success is to change your expectations or purchase a device that WILL do the job.
You get nothing for nothing in this world and that is especially true when talking of electrical power as in Watts. If what you have (just purchased or not) will not supply your requirement then you have to get something that will. Easy formula and no way around it.
Cheers Bob
Ahhh, yes. I understand that meshtastic is a communications channel, and so for this use you will want it available all the time. And it’s probably using wi-fi, which uses a lot of the power.
There are some things which can reduce the amount of power used - but not by much
Deep-sleep can still be useful
when the battery voltage gets too low - since it can automatically resume when the battery has stored enough charge.
if you don’t need the mesh available 24 hours per day, you could program it to sleep at night (thus reducing the power consumed while there is no solar)
Position and angle of the solar panel can also give a noticeable difference in the electricity generated. Best is when the sun is at 90 degrees to the panel.
In the longer term, you may need to rethink your battery and solar panel. But for now I suggest you monitor the battery voltage and see how it goes over time. Maybe your solar panel and LiPo battery are large enough that, once it is installed, the battery won’t run totally down. And if you find you do need longer battery life … then you will have a good knowledge of your local environment (amount of current/day consumed by your hardware & software, average hours of sun/day, how many days with no sun, etc), with which to calculate how large a battery you might need, and big a solar panel to keep it charged.