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
}
Average function run current is 30 Ma. with no optimisation.
Zoomed
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…