XIAO ESP32C3 Solar panel

Hello guys,

I’d like to use a solar panel with the Xiao esp32 and still use the internal charger for the 18650 battery.

Would it work if I just attach the panel to the 5v pin with a diode so current just flows from the panel to the 5v pin not the other way?

Would it charge the battery if the sun delivers enough power ? Should it reset if the supply changes from 5v to battery if the solar panel stops delivering enough?

Cheers Michael