ESP32 not working on battery

lbranco93
Posts: 1
Joined: Tue Mar 22, 2022 5:31 pm

ESP32 not working on battery

Postby lbranco93 » Tue Mar 22, 2022 6:45 pm

Hello everyone,

I'll start by saying that I'm quite new to the ESP32. I have been trying to use this development board from AZ-delivery (the link provided has all the schematics) and everything has gone smoothly until I tried to run it on a battery with the Wifi enabled.

I use a 9V battery and an MB-V2 power supply module to convert the output voltage to 3.3V. The power supply module has the following specs:
  • Input voltage: 6.5-9v (DC) via 5.5mm x 2.1mm plug
  • Output voltage: 3.3V/5v
  • Maximum output current: 700 mA
My multimeter measures 3.3V:
Image

I connect the power supply 3.3V output to the 3.3V pin. Here's a quick schematics of my simple setup and some more pictures (I didn't have a schematic for this specific devkit, I'll use the one from DOIT hence the pins are off in the schematics):
Image
Image

The board starts by lighting up the red LED and then tries to connect to the Wifi. After at most 10 secs, it switches off the red LED and switches on either the yellow LED, if it is connected to the WiFi, or the blue LED if it isn't connected to the Wifi. Last, I send the board into deep sleep as I want to measure it's current requirements. The code is as follows:

Code: Select all

#include <WiFi.h>

const int uS_TO_S_FACTOR = 1000000;
const int TIME_TO_SLEEP = 3;
const int RED_LED_PIN = 32;
const int BLUE_LED_PIN = 25;
const int YELLOW_LED_PIN = 26;
const char SSID[] = "SSID"; 
const char PASS[] = "PASS";

void setup(){
  Serial.begin(115200);
  while(!Serial){}
  pinMode(RED_LED_PIN, OUTPUT);
  pinMode(BLUE_LED_PIN, OUTPUT);
  pinMode(YELLOW_LED_PIN, OUTPUT);
  delay(500);
  digitalWrite(RED_LED_PIN, HIGH);
  delay(1000);
  Serial.print("Connecting to ");
  Serial.println(SSID);
  WiFi.begin(SSID, PASS);  
  while ((WiFi.status() != WL_CONNECTED) && (millis()<10000)) {
      Serial.print(".");
      delay(500);
  }
  Serial.print("Connected. IP: ");
  Serial.println(WiFi.localIP());
  digitalWrite(RED_LED_PIN, LOW);
  if(WiFi.status() == WL_CONNECTED) //Run this only the first time
  {
    Serial.println("Connected");
    digitalWrite(YELLOW_LED_PIN, HIGH);
  } else
  {
    Serial.println("Not connected");
    digitalWrite(BLUE_LED_PIN, HIGH);
  }
  delay(3000);
  digitalWrite(BLUE_LED_PIN, LOW);
  digitalWrite(YELLOW_LED_PIN, LOW);
  Serial.println("Going to sleep");
  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
  esp_deep_sleep_start();
}

void loop(){}
When I run it while connected to the PC, everything works fine, but when I switch to the battery the board gets stuck: it doesn't go beyond the Wifi loop and the red LED never shuts down.

I've read some posts about this issue, but all of them seems to be caused by incorrect or insufficient battery voltage, which doesn't seem to be the case. What could be the issue here?

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 not working on battery

Postby ESP_Sprite » Wed Mar 23, 2022 1:22 am

Your power supply needs to be able to output 500mA, and while your regulator can do that, your battery probably is too high-impedance to do that. You *might* be able to fix that by putting a large cap (e.g. 1000uF) in parallel with your battery, but in general, 9V batteries aren't ideal to run an ESP32 off.

Who is online

Users browsing this forum: No registered users and 93 guests