Menu
Microbots
0
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • ProtoBot
    • Wavelit Display
    • Modules & Parts
    • Tools & Gears
    • Coming Soon
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Sign in
  • English
  • Your Cart is Empty
Microbots
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • ProtoBot
    • Wavelit Display
    • Modules & Parts
    • Tools & Gears
    • Coming Soon
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Language

  • 0 0

CodeCell - Going to Sleep


CodeCell supports low-power sleep using a periodic RTC timer, external GPIO wakeup, or sensor-driven interrupts. Each method has different power and responsiveness characteristics, so choosing the right wake strategy is important for low-power applications.

Sleep Current by Board & Wake Source

Board RTC Timer GPIO Wakeup Brightness Interrupt Proximity Interrupt Tap Interrupt
CodeCell C3 Light ≈ 476 µA ≈ 537 µA — — —
CodeCell C3 ≈ 861 µA ≈ 757 µA — — —
CodeCell C6 ≈ 40 µA ≈ 41 µA ≈ 280 µA ≈ 425 µA ≈ 860 µA
CodeCell C6 Drive ≈ 40 µA ≈ 42 µA ≈ 280 µA ≈ 425 µA ≈ 1730 µA

All official sleep examples are available in the repo: examples/Sleep


RTC Timer vs GPIO vs Sensor Interrupt Wakeup

CodeCell offers three main wakeup strategies. The best choice depends on whether your application prioritizes minimum power consumption, instant external wakeup, or direct sensor-triggered wakeup.

🔹 RTC Timer Wakeup — Lowest Power

The device enters deep sleep and wakes periodically using the ESP32's RTC timer. While asleep, current can be as low as approximately 40 µA on CodeCell C6 and C6 Drive.

On each wake cycle, the firmware can:

  • Re-initialize the required sensors
  • Check whether the desired condition has occurred
  • Return to sleep if nothing happened

Because the ESP32 is in deep sleep and the sensors can be fully powered down between timer events, this method provides the lowest power consumption.

The longer the timer interval, the more time the CodeCell spends in deep sleep and the lower the overall average current.

The trade-off is response time. For example, if the CodeCell wakes once every second to check for motion, a movement may take up to approximately one second to be detected.

RTC Sleep vs Wake Graph

On this graph:

  • The long flat sections show deep sleep (~40 µA).
  • The tall spikes represent wake cycles where the device wakes and checks the sensors.
  • Increasing the timer interval makes the sleep sections longer, reducing average energy use.

🔹 GPIO Wakeup — Low Power + Instant External Trigger

GPIO wakeup allows an external signal to wake the CodeCell directly from deep sleep. This is useful when another circuit, switch, sensor, or external device can provide a digital wake signal.

The official example puts the CodeCell into deep sleep while the selected GPIO is LOW. Changing the GPIO to HIGH wakes the board immediately.

  • CodeCell C3: ≈ 756 µA
  • CodeCell C3 Light: ≈ 536 µA
  • CodeCell C6: ≈ 41 µA
  • CodeCell C6 Drive: ≈ 42 µA

On the C6 boards, GPIO wakeup consumes almost the same power as RTC deep sleep while still providing an instantaneous external wake trigger.

Available wake GPIOs:

  • CodeCell C3 / C3 Light / C6: GPIO 1, 2, or 3
  • CodeCell C6 Drive: GPIO 1

For the example, connect the selected wake GPIO to 3V3 to trigger a HIGH state. Do not connect the GPIO to VO, as VO can exceed the ESP32 GPIO voltage rating.

After a GPIO wakeup, the ESP32 restarts from deep sleep and runs setup() again. The WakeUpCheck() function can be used to determine whether the board has just woken from sleep.

The example uses:

myCodeCell.SleepGPIOTrigger(HIGH, TRIGGER_PIN);

This places the CodeCell into deep sleep and waits for the selected GPIO to become HIGH.

Note: While the CodeCell is in deep sleep, the Arduino IDE may not be able to connect to it over USB-C. Before uploading a new sketch, keep the wake GPIO HIGH so the board remains awake.

View the complete GPIO wakeup example →


🔹 Sensor Interrupt Wakeup — Instant Sensor Response

Sensor interrupt wakeup keeps part of the selected sensor circuitry powered while the ESP32 sleeps. This allows the CodeCell to wake immediately when an event occurs, such as a tap, proximity change, or change in ambient light.

The trade-off is higher sleep current because the sensor must remain active enough to detect the event.

  • Tap interrupt (BNO085): ≈ 860 µA (C6) · ≈ 1730 µA (C6 Drive)
  • Brightness interrupt (VCNL4040): ≈ 280 µA (C6 / C6 Drive)
  • Proximity interrupt (VCNL4040): ≈ 425 µA (C6 / C6 Drive)

This mode is ideal when the device needs to respond immediately to user interaction or a sensor event without periodically waking to check for changes.


Sleep Examples (Quick Navigator)

  • 1) GPIO Wakeup — C3 / C3 Light / C6 / C6 Drive
    Deep sleep with instant wake from an external GPIO signal.
    gpio_wakeup.ino
    Est. sleep ≈ 756 µA (C3) · 536 µA (C3 Light) · 41 µA (C6) · 42 µA (C6 Drive)
  • 2) Tap Interrupt Wakeup — C6 / C6 Drive
    Sleep on command; wake instantly on tap.
    tap_interrupt_wakeup.ino
    Est. sleep ≈ 860 µA (C6) · 1730 µA (C6 Drive)
  • 3) Brightness Interrupt Wakeup — C6 / C6 Drive
    Wake when ambient light rises above a threshold.
    brightness_interrupt_wakeup.ino
    Est. sleep ≈ 280 µA (C6 / C6 Drive)
  • 4) Proximity + Timer + EEPROM Wakeup — C3 / C3 Light / C6 / C6 Drive
    Timed deep sleep with periodic proximity checks.
    proximity_timer_eep_wakeup.ino
    Est. sleep ≈ 40 µA (C6 / C6 Drive) · 476 µA (C3 Light) · 861 µA (C3)
  • 5) Darkness Interrupt Wakeup — C6 / C6 Drive
    Wake when ambient light falls below a threshold.
    darkness_interrupt_wakeup.ino
    Est. sleep ≈ 280 µA (C6 / C6 Drive)
  • 6) Motion (RTC Timer Poll) Wakeup — C3 / C3 Light / C6 / C6 Drive
    Low-power motion detection using periodic RTC wakeups.
    motion_timer_wakeup (folder)
    Est. sleep ≈ 40 µA (C6 / C6 Drive) · 476 µA (C3 Light) · 861 µA (C3)
  • 7) Proximity Interrupt Wakeup — C6 / C6 Drive
    Instant wake when proximity crosses a threshold.
    proximity_interrupt_wakeup.ino
    Est. sleep ≈ 425 µA (C6 / C6 Drive)

Choosing a Strategy

  • Best battery life: Use RTC timer sleep — approximately 40 µA on C6 / C6 Drive.
  • Instant wake from a switch or external circuit: Use GPIO wakeup — approximately 41–42 µA on C6 / C6 Drive.
  • Instant reaction to light, proximity, or tap: Use the corresponding sensor interrupt wakeup.

For many C6 applications, GPIO wakeup provides an especially useful balance: nearly the same deep-sleep current as RTC sleep, but with immediate wakeup when an external trigger occurs.

  • Share:

Follow

Github

  • About
  • Software
  • Education
  • Contact
  • FAQs
  • Terms
  • Refund Policy
  • Privacy Policy

Join our Community ~ Be the first to know about new products and get exciting deals!

© 2026 Microbots.

★ Reviews

Let customers speak for us

83 reviews
Write a review
87%
(72)
5%
(4)
2%
(2)
2%
(2)
4%
(3)
77
21
G
Experiment in Progress Mug
Gerald Kendrick

I am enjoying my Experiment in Progress coffee mug. It fits in well in the lab.

K
12-in-1 Screwdriver (Pen-Size)
Klaas

Very useful fun little screwdriver for the all tiny stuff

f
ProtoBot
frederic marty

I don't have much time right now to test the micro bot, but it looks good.

f
MotorCell
frederic marty

I don't have much time right now to test it but it looks good.

M
ProtoBot
Mehmed Muslija

ProtoBot has met all my expectations.
Watching one of the videos on YouTube, I thought it would be interesting and educational to make a small project for my 8 year old cousin. ProtoBot has provided a wide range of experiences and encouraged my cousin to take on new projects.

User picture
123