Glad to see the New Xiao living up to the hype it draws a tiny amount of juice. Man batteries will go a while now.
Here is some basic code that blinks the led and uses the RTC to wake up from sleep. attached are the power profiles collected.
HTH
GL PJ
Test code…
// Basic Sleep code Counts reboots saves the number in the RTC memory
// and blinks USER LED (10)times , then Pauses and then sleeps.
// Wakes Up after 30 seconds and repeats.
// Using board 'XIAO_ESP32C6' from platform esp32\3.0.0-rc1
// Paoched and Toasted by PJG
// --------------------------------------------------------------------
#include <Arduino.h>
#include "esp32-hal-gpio.h"
#include "esp_sleep.h"
#include "driver/rtc_io.h"
const int ledPin = 15; // Built-in LED pin on the Xiao ESP32C6
const int wakeUpPin = 2; // GPIO 2 as the wake-up pin
RTC_DATA_ATTR int bootCount = 0; // Counter to keep track of wake-ups
void setup() {
// Increment boot count and print it
bootCount++;
//Serial.begin(9600);
delay(2000);
//Serial.println("Processor OUT of RESET ");
//Serial.println("");
//Serial.println("Boot number: " + String(bootCount));
pinMode (LED_BUILTIN,OUTPUT);
pinMode(wakeUpPin, INPUT_PULLUP);
// Blink LED 10 times
for (int i = 0; i < 10; i++) {
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
}
// Configure wake-up sources
//esp_sleep_enable_ext1_wakeup(1 << wakeUpPin, ESP_EXT1_WAKEUP_ANY_HIGH); // Wake on high level
esp_sleep_enable_timer_wakeup(30 * 1000000); // 1 minute in microseconds , 30 seconds
// Pause for 15 seconds
delay(15000);
// Serial.println("Going to sleep now");
// Serial.flush();
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
// Enter deep sleep
esp_deep_sleep_start();
}
void loop() {
// This function will not be called as the device enters deep sleep
}
Sleeping… Again No optimisation. some more could be squeezed
This chip is definitely feels faster than the C3 albeit same clk’s you can tell by how responsive it is. Wifi connects faster too on my tests with the WPS. I like it! Why would you want a C3 I’m thinking?
here’s the setup, pic…
Hi PJ,
I am just now putting together a summary of sleep currents. I will post it as soon as it is done.
Preliminary results are 16mA (room temperature 25C).
Since SBD with high leakage current are used, the sleep current can easily double as the temperature rises. If you measure it with no wake-up, the temperature rise will be eliminated and the current will be around 16mA.
I’m using the ESP-IDF deep_sleep sample and I’m getting a little over 300µA during the deep sleep portion. The chip should be completely asleep and get woken once every 20 seconds. Connect my PPK to the battery terminals shows the behaviour pattern, but during the sleep, it’s averaging 324µA
@PJ_Glasso If you’re getting a tiny 15µA via Arduino, how can I determine what the configuration it’s using?
I’m hoping to get a battery powered Matter device working on this C6, but I’m hoping for a better sleep draw than 300µA! Any advice or tips are welcome.
To compare apples with apples, I tried the Arduino code and flashed that onto my ESP32-C6.
The LED Blinks as expected, but deep sleep is drawing 299µA!
In PPK2, zoom in on the area that is DeepSleep.
I think the SELECTION-average (current value in the gray area) in the bottom column is 15uA.
Perhaps what you are seeing is the average current value including the part before DeepSleep.
The spike is probably generated by the 3.3V regulator SGM6029.
If you consider the Sleep current as an average current, it would be 15uA including this spike.
As the input voltage drops, the regulator changes its mode of operation and its efficiency also decreases.
Also, the minimum operating voltage of the ESP32C6 is 3.0V, so if VDD falls below 3.0V due to the voltage drop of the regulator, it may be unable to operate and not be able to enter Sleep mode.
So you are in good hands with the Power Ninja @msfujino. I use a 3.85vDc battery So my results are based around same, AT the lower end it appears the voltage regulator switching modes is indeed the culprit I have found so far to effect if it will even go to sleep let alone , wakeup properly. We are out on the edge so expect some cuts…
HTH
GL PJ
FWIW the BSP’s also can have an effect overall current so Beware.