asking for review: low power wifi on ESP32 S3

klaus_123
Posts: 1
Joined: Sun Mar 01, 2026 11:48 am

asking for review: low power wifi on ESP32 S3

Postby klaus_123 » Sun Mar 01, 2026 11:54 am

Hi
I am trying to setup a low power arduino sketch. It wont go below 45 ma current consumption although I just send 1024 bytes over UDP once every 3 seconds.
What am I missing?
I am using an ESP32 S3 Dev Kit: ESP32S3DK-C1N8R8
Here my sketch:

Code: Select all

#include <WiFi.h>
#include <WiFiUdp.h>
#include "esp_pm.h"
#include "esp_wifi.h"

const char* ssid     = "my_wifi_1";
const char* password = "my_wifi_1";
const char* targetIP = "192.168.1.5";
const uint16_t port  = 6454;

WiFiUDP Udp;
const int packetSize = 1024;
byte packetBuffer[packetSize];
int dataToSend = 0;


void setup() {
  Serial.begin(115200);
  memset(packetBuffer, 0, packetSize);

  WiFi.mode(WIFI_STA);
  
  WiFi.setSleep(true);

  esp_pm_config_esp32s3_t pm_config = {
    .max_freq_mhz = 240,  // Max speed when awake
    .min_freq_mhz = 40,   // Slowest speed (XTAL)
    .light_sleep_enable = true // ENABLE AUTO LIGHT SLEEP
  };
  
  esp_err_t err = esp_pm_configure(&pm_config);
  if (err == ESP_OK) {
    Serial.println("Power management configured.");
  }

  wifi_config_t conf;
  esp_wifi_get_config(WIFI_IF_STA, &conf);
  // Set the Listen Interval (Number of beacons to skip)
  // 10 intervals * ~100ms beacon = ~1 second of sleep
  conf.sta.listen_interval = 10; 
  esp_wifi_set_config(WIFI_IF_STA, &conf);

  esp_wifi_set_ps(WIFI_PS_MAX_MODEM);
  WiFi.setSleep(true);

  Serial.print("Connecting WiFi");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(100);
    Serial.print(".");
  }
}

void loop() {
  // 1. Send the packet
  if (WiFi.status() == WL_CONNECTED) {
  	memset(packetBuffer, dataToSend++ , packetSize);
    Udp.beginPacket(targetIP, port);
    Udp.write(packetBuffer, packetSize);
    Udp.endPacket();
  }
  
  delay(3000);

}

lbernstone
Posts: 1132
Joined: Mon Jul 22, 2019 3:20 pm

Re: asking for review: low power wifi on ESP32 S3

Postby lbernstone » Fri Mar 06, 2026 3:33 pm

PM is not currently supported on arduino, and CONFIG_PM_ENABLE is not set in the compiled sdk.
It *should* work if you use arduino as a component.
You can follow the feature progress

Who is online

Users browsing this forum: PerplexityBot and 3 guests