XIAO ESP32C3 Battery ussage

Update now power is 36ma. Put CPU at half speed dropped tp 27ma. Plenty of power to run off a good 18650 for day. charging works great using USB C charger.

Happy so far.

Good morning. Can someone tell me how to implement an ON OFF switch when the battery is being used to turn off the ESP32C3?
thank you so much.

I am facing a similar issue, battery is working fine when charging. I have tried on 2 different ESP32C3 xiao modules. They work fine for one day and next day when I remove usb type C, they don’t work on battery. Battery and xiao ESP32C3 is mounted inside an enclosure.

Hi there,
I see several options for Battery’s holder with a switch


Cr2032, or 18650. These are AOK.and if you want to ONLY charge the battery. one like this.

HTH
GL :slight_smile: PJ :v:

News? Can I purchase some of them, or it’s just a waste of money?

1 Like

Battery is working fine for me. Here is my test script.
Hardware is just a basic lipo battery attached and two buttons connected to gpio 2/3 and gnd

#include "WiFi.h"
#include <PubSubClient.h>

#define DEBUG_ENABLED 0

const char* ssid     = "DronesAreWatching";
const char* password = "";   

const char* mqtt_server = "blue.home";
const char* mqttUser = "internal";
const char* mqttPassword = "";


void debug(String msg){
  if (DEBUG_ENABLED){
    Serial.println(msg);
  }
}

WiFiClient espClient;
PubSubClient client(espClient);

void setup_wifi() {
  delay(10);
  // We start by connecting to a WiFi network
  debug("Connecting to ");
  debug(ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    debug(".");
  }

  debug("WiFi connected");
  debug("IP address: ");
  // debug(WiFi.localIP());
}

void setup() {
  if (DEBUG_ENABLED){
    Serial.begin(115200);
    delay(100);
  }
  
  pinMode(D0, INPUT_PULLUP);
  debug("Startup...send message");

  setup_wifi();

  client.setServer(mqtt_server, 1883);
  client.connect("ESP8266Client", mqttUser, mqttPassword);

  uint64_t gpio_reason = esp_sleep_get_gpio_wakeup_status(); 
  debug(String(gpio_reason));
  int GPIO = 0;
  if (gpio_reason > 0){
    GPIO = log(gpio_reason)/log(2);
  }
  debug(String(GPIO));


  String GPIOString = String(GPIO);
  int str_len = GPIOString.length() + 1; 
  char char_array[str_len];
  GPIOString.toCharArray(char_array, str_len);

  client.publish("mouse/trigger", char_array);


  esp_deep_sleep_enable_gpio_wakeup((1ULL << 2), ESP_GPIO_WAKEUP_GPIO_LOW);  //GPIO2
  esp_deep_sleep_enable_gpio_wakeup((1ULL << 3), ESP_GPIO_WAKEUP_GPIO_LOW);  //GPIO3

  debug("Going to sleep in 5 seconds"); //time to send message
  delay(5000);

  if (DEBUG_ENABLED){
    Serial.flush();
  } 
  esp_deep_sleep_start();
}

void loop() {
}