🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to power M5Stack CoreS3 through 5V pin properly?

    General
    2
    3
    49
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      ThronKatze0
      last edited by

      So, for my project I need to power my M5Stack CoreS3 through an external power source.
      I figured I just had to connect the 5V pin to the power source and GND to GND, but that doesn't quite work.
      It seems like the CoreS3 boots up (display starts), but

      1. It doesn't connect to Wifi
      2. It doesn't control my LED strips

      I added a short sound to the code and I can hear it, but not as loud as with USB. Maybe it's some kind of power saving mode?

      Would really appreciate any help I get!

      This is the code I use:

      #include <NeoPixelBus.h>
      #include <M5Unified.h>
      #include <ArduinoOTA.h>
      #include <WiFi.h>
      
      const char* wifi_ssids[] = {/*ssids*/};
      const char* wifi_passwords[] = {/*passwords*/};
      const int wifi_count = sizeof(wifi_ssids) / sizeof(wifi_ssids[0]);
      
      const uint16_t numLeds = 38;
      
      NeoPixelBus<NeoGrbFeature, NeoEsp32LcdX8Ws2812xMethod> strip1(numLeds, 37);
      NeoPixelBus<NeoGrbFeature, NeoEsp32LcdX8Ws2812xMethod> strip2(numLeds, 5);
      NeoPixelBus<NeoGrbFeature, NeoEsp32LcdX8Ws2812xMethod> strip3(numLeds, 6);
      NeoPixelBus<NeoGrbFeature, NeoEsp32LcdX8Ws2812xMethod> strip4(numLeds, 7);
      NeoPixelBus<NeoGrbFeature, NeoEsp32LcdX8Ws2812xMethod> strip5(numLeds, 1);
      NeoPixelBus<NeoGrbFeature, NeoEsp32LcdX8Ws2812xMethod> strip6(numLeds, 36);
      NeoPixelBus<NeoGrbFeature, NeoEsp32LcdX8Ws2812xMethod> strip7(numLeds, 35);
      
      uint16_t hue = 0;
      const uint16_t hueMax = 360;
      const uint16_t hueDelta = 8;
      
      void setup_wifi() {
        for (int i = 0; i < wifi_count; i++) {
          Serial.printf("Trying WiFi SSID: %s\n", wifi_ssids[i]);
          WiFi.begin(wifi_ssids[i], wifi_passwords[i]);
      
          int retries = 0;
          while (WiFi.status() != WL_CONNECTED && retries < 10) {
            delay(500);
            Serial.print(".");
            retries++;
          }
      
          if (WiFi.status() == WL_CONNECTED) {
            Serial.printf("Connected to WiFi SSID: %s\n", wifi_ssids[i]);
            Serial.printf("IP address: %s\n", WiFi.localIP().toString().c_str());
            return;
          } else {
            Serial.printf("Failed to connect to %s\n", wifi_ssids[i]);
          }
        }
      
        Serial.println("All WiFi connection attempts failed. Restarting...");
        delay(5000);
        ESP.restart();
      }
      
      void setup() {
        auto cfg = M5.config();
        cfg.external_speaker.module_display = true;
        M5.begin(cfg);
        M5.Speaker.begin();
      
        auto spk = M5.Speaker.config();
        spk.dma_buf_len   = 256;
        spk.dma_buf_count = 8;
        M5.Speaker.config(spk);
      
        M5.Speaker.setVolume(32);
      
        setup_wifi();
      
        M5.Speaker.tone(6000, 50);
        Serial.begin(115200);
        while (!Serial);
        Serial.println("Initializing...");
      
        strip1.Begin();
        strip2.Begin();
        strip3.Begin();
        strip4.Begin();
        strip5.Begin();
        strip6.Begin();
        strip7.Begin();
      
        ArduinoOTA.setHostname("SmartPBL");
        ArduinoOTA.setPassword("innovativsmart");
      
        ArduinoOTA.onStart([]() {
          Serial.println("Start OTA update");
        });
        ArduinoOTA.onEnd([]() {
          Serial.println("\nOTA update finished");
        });
        ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
          Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100)));
        });
        ArduinoOTA.onError([](ota_error_t error) {
          Serial.printf("OTA Error[%u]: ", error);
          if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
          else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
          else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
          else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
          else if (error == OTA_END_ERROR) Serial.println("End Failed");
        });
      
        ArduinoOTA.begin();
      
        Serial.println("Running...");
      }
      
      void loop() {
        ArduinoOTA.handle();
        for (uint16_t i = 0; i < numLeds; i++) {
          uint16_t ledHue = (hue + (i * 360 / numLeds)) % hueMax;
          HslColor color(ledHue / (float)hueMax, 1.0f, 0.5f);
      
          strip1.SetPixelColor(i, color);
          strip2.SetPixelColor(i, color);
          strip3.SetPixelColor(i, color);
          strip4.SetPixelColor(i, color);
          strip5.SetPixelColor(i, color);
          strip6.SetPixelColor(i, color);
          strip7.SetPixelColor(i, color);
        }
      
        strip1.Show();
        strip2.Show();
        strip3.Show();
        strip4.Show();
        strip5.Show();
        strip6.Show();
        strip7.Show();
      
        hue = (hue + hueDelta) % hueMax;
      
        delay(20);
      }
      
      T 1 Reply Last reply Reply Quote 0
      • T
        ThronKatze0 @ThronKatze0
        last edited by

        Fix: just had to remove this line

        while (!Serial);
        
        1 Reply Last reply Reply Quote 0
        • samantha_martinS
          samantha_martin
          last edited by

          hola
          I was actually wondering the same thing because I’m planning to power my CoreS3 through the 5V pin for a compact project. It’s great to know that 5V input on the BAT or 5V pin is possible, but now I’ll be more careful about current limits and the regulator specs. If anyone has real-world usage experience with powering it directly from a battery or 5V rail long-term, I’d love to hear more about reliability or heat issues.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post