Try   HackMD

LHB阿好伯, 2024/10/22

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

模式/(mA) ESP32-C3 ESP32-C3_3V3 RP2040 RP2040_去除OLED RP2040_3V3
運行 30.68 28.22 24.47 23.01 22.72
輕度休眠 0.404 0.371 3.53 2.06 1.32
深度休眠 0.155 0.136

本文針對兩款我常用的微控制器 - ESP32-C3和RP2040
在不同運作模式下的功耗特性進行深入分析
測試使用功耗計進行量測,著重於正常運行、輕度休眠及深度休眠模式的表現。

測試配置

ESP32-C3測試配置:

  • 標準配置(使用板載降壓器)_Arduino
  • 直接3.3V供電(繞過降壓器)
  • 包含輕度休眠和深度休眠模式
// GPIO定義 const int LED_PIN = 4; // D4 LED void setup() { Serial.begin(115200); pinMode(LED_PIN, OUTPUT); } void loop() { // 測試1: 閃爍3秒後暫停3秒 Serial.println("Test 1: Normal mode - 3 seconds blink"); digitalWrite(LED_PIN, HIGH); delay(3000); digitalWrite(LED_PIN, LOW); delay(3000); // 測試2: 閃爍2秒後輕度睡眠3秒 Serial.println("Test 2: Light sleep - 2 seconds blink"); digitalWrite(LED_PIN, HIGH); delay(2000); digitalWrite(LED_PIN, LOW); // 進入輕度睡眠 Serial.println("Entering light sleep mode for 3 seconds"); esp_sleep_enable_timer_wakeup(3 * 1000000); // 3秒 esp_light_sleep_start(); // 測試3: 閃爍1秒後深度睡眠3秒 Serial.println("Test 3: Deep sleep - 1 second blink"); digitalWrite(LED_PIN, HIGH); delay(1000); digitalWrite(LED_PIN, LOW); // 進入深度睡眠 Serial.println("Entering deep sleep mode for 3 seconds"); esp_sleep_enable_timer_wakeup(3 * 1000000); // 3秒 esp_deep_sleep_start(); delay(1000); // 等待一秒後重新開始測試循環 }

RP2040測試配置:

  • 標準開發板_micropython
  • 移除電源指示OLED後的開發板
  • 直接3.3V供電
  • 正常運行和輕度休眠模式
import machine from machine import Pin import time led = Pin(25, Pin.OUT) def blink_time(duration): start = time.time() while time.time() - start < duration: led.on() time.sleep(0.5) led.off() time.sleep(0.5) def main(): # 休眠後喚醒時執行 if machine.reset_cause() == 3: # Deep sleep wake print("從休眠喚醒") blink_time(3) return # 首次執行 print("開始閃爍") blink_time(3) print("進入休眠") led.off() machine.deepsleep(5000) if __name__ == "__main__": main()

測試結果與分析

正常運行模式

ESP32-C3:

標準配置:30.68mA

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

直接3.3V:28.22mA

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

直接供電效率提升:約8%

RP2040:

標準配置:24.47mA

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

移除OLED:23.01mA(降低約6%)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

3.3V直接供電:22.72mA(較標準配置降低約7.2%)

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

休眠模式

ESP32-C3:

輕度休眠:

0.404mA(標準)

ESP32-C3_輕度休眠

0.371mA(3.3V)

ESP32-C3_輕度休眠—3V3

深度休眠:

0.155mA(標準)

ESP32-C3_深度休眠

0.136mA(3.3V)

ESP32-C3_深度休眠_3V3

深度休眠相較正常運行節省約99.5%

RP2040:

輕度休眠:
3.53mA(標準)

RP2040_5s

2.06mA(無OLED)

RP2040_5s_去除oled

1.32mA(3.3V)

RP2040_5s_去除oled_3V3_Vin
未測試深度休眠模式
相比運行模式節電效率:約94.2%

結論

運行模式:

RP2040和ESP32-C3的功耗差異不大
RP2040略低約19%,但差距不足以成為選型的決定性因素

休眠模式:

ESP32-C3具有明顯優勢
輕度休眠比RP2040節省72%功耗
深度休眠模式為其獨特優勢

最佳實踐:

需要頻繁休眠的應用選擇ESP32-C3
持續運行的應用可考慮RP2040

全文分享至

https://www.facebook.com/LHB0222/

https://www.instagram.com/ahb0222/

有疑問想討論的都歡迎於下方留言

喜歡的幫我分享給所有的朋友 \o/

有所錯誤歡迎指教

全部文章列表