ESP32 Boot Problem without USB

I have created an IR target based on an ESP32 (ESP32 Wroom 32D from espressif) for a Halloween project.

I adapted my own board from the ESP Dev Board and when I connect the board via USB to the CH340 chip everything works fine.

But as soon as I supply power to the board via an external power supply (also 5V - J7 or J8), the ESP does not seem to start.

I have a control LED for 5V and 3.3V on the board. These light up in both cases. The program that colors my SK6812 LEDs after booting only starts when I connect the board via USB.

As soon as I supply the board only by 5V over J7 or J8 the LEDs remain dark. Also the IO2 control LED flickers only when USB is connected.

I measured the 3.3V at the ESP in both cases - if the power supply is not via USB, it has even 0.01V more. Thus I exclude also an undersupply.

For me it seems as if the ESP is in "standby" and must somehow be "switched on" without USB.

I hope someone can help me here.

I have attached the schematic files (1 page = main schematic, 2 page= ESP programmer as sub schematic).
IrTarget.pdf (218.6 KB)

Edit: I attached also a image of the board (front and back - with and without USB):

What does that mean?

Are you using a custom ESP32 board?

You didn't post your sketch.
Is it waiting for Serial Monitor (Serial.begin) ?

I adapt the schematic for the ESP programmer from this devboard so that i can upload via USB a new Programm. That works.

Here is the dev board that i mean:

From this board is only the programmer part. The rest is based on my side.

The sketch is in the PDF that is linked direct under the description: IrTarget.pdf (218.6 KB)

Page 1 is a schematic. Page 2 is a schematic.

Sorry my fault :slight_smile:

It is only a demo script with basic function but if it helps here it is:


#include <Arduino.h>
#include <stdlib.h>

// Wifi
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
WiFiManager wm;
int cpTimeout = 90; // Timeout for the configuration portal
WiFiManagerParameter custom_led_delay("led_delay", "LED delay", "", 10);

// WifiManager configuration portal button
#define BTN_CP_START 15
int buttonState = 0;

// IR
#define DECODE_SAMSUNG
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 16

// LED
#include <Adafruit_NeoPixel.h>
#define LED_PIN     18
#define LED_COUNT  12
#define BRIGHTNESS 255 // Set BRIGHTNESS to about 1/5 (max = 255)
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);

// Switches
#define SW_1     19
#define SW_2     21
#define SW_3     22
#define SW_4     23

// Color Settings
int ledColorWifiReboot[4] = {0, 0, 0, 100};
int ledColorWifiWait[4] = {100, 100, 0, 0};
int ledColorIdle[4] = {100, 0, 100, 0};
int ledColorHit[4] = {50, 0, 0, 0};

// General
bool targetHit = false;

void setup() {
  // Wifi - 1
  WiFi.mode(WIFI_STA);
  
  Serial.begin(115200);
  Serial.println(F("Starting APP"));

  // Set configuration portal PIN
  pinMode(BTN_CP_START, INPUT);

  // Set Switch Pins
  pinMode(SW_1, OUTPUT);
  pinMode(SW_2, OUTPUT);
  pinMode(SW_3, OUTPUT);
  pinMode(SW_4, OUTPUT);

  // Custom configuration
  wm.addParameter(&custom_led_delay);

  // Set the default value for the custom field
  custom_led_delay.setValue("1000",4);

  // Custom menu
  // Added param for custom configuration
  // Added exit to start loop after configuration
  std::vector<const char *> menu = {"wifi","info","param","close","sep","update","exit"}; // Added param to the menu
  wm.setMenu(menu); // custom menu, pass vector
  
  // LED
  strip.begin();
  strip.show();
  strip.setBrightness(BRIGHTNESS);
  ledShowSetup();

  // Wifi - 2
  //wm.resetSettings(); // Only for Develop - Remove after
  // Auto Connect
  if(!wm.autoConnect("WMAutoConnectAP","12345678")) {
    Serial.println("failed to connect and hit timeout");
  }
    
  // IR
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);

  // General 
  targetHit = false;
}

void loop() {
  irDecode();

  if (IrReceiver.isIdle()) {
    configPortalButton();
    
    if (targetHit) {
      targetHitLoop();
    } else {
      targetNotHitLoop();
    }
  }
}

void targetNotHitLoop() {
  digitalWrite(SW_1, LOW);
  digitalWrite(SW_2, LOW);
  digitalWrite(SW_3, LOW);
  digitalWrite(SW_4, LOW);
  strip.fill(strip.Color(ledColorIdle[0], ledColorIdle[1], ledColorIdle[2], ledColorIdle[3]));
  strip.show();
}

void targetHitLoop() {
  digitalWrite(SW_1, HIGH);
  digitalWrite(SW_2, HIGH);
  digitalWrite(SW_3, HIGH);
  digitalWrite(SW_4, HIGH);
  strip.fill(strip.Color(ledColorHit[0], ledColorHit[1], ledColorHit[2], ledColorHit[3]));
  strip.show();
  targetHit = false;
  delay(1000);
  IrReceiver.resume();
}

void configPortalButton() {
  buttonState = digitalRead(BTN_CP_START);

  if (buttonState == HIGH) {
    ledShowSetup();
    wm.setConfigPortalTimeout(cpTimeout);
    wm.startConfigPortal("WM_ConnectAP","12345678");
  }
}

void irDecode() {
  if (IrReceiver.decode()) {
    if (IrReceiver.decodedIRData.address == 0x707) {
      if (IrReceiver.decodedIRData.command == 0x7) {
        targetHit = true;
      }
    }
    IrReceiver.resume();
  }
}

void ledShowSetup() {
  strip.fill(strip.Color(ledColorWifiReboot[0], ledColorWifiReboot[1], ledColorWifiReboot[2], ledColorWifiReboot[3]));
  strip.show();
  delay(150);
  strip.fill(strip.Color(ledColorWifiWait[0], ledColorWifiWait[1], ledColorWifiWait[2], ledColorWifiWait[3]));
  strip.show();
}

You do have Serial.begin, but you're not stuck waiting for that (which people have done a few times).

You may have to get in there with the voltmeter and verify that 5V is everywhere it's supposed to be with your power supply running the show.

Perhaps use an LED trial blink in setup to confirm that the ESP IC gets going at some point.

Is the supply voltage of your TSOP312xx really 5V ?

Thank you :slight_smile: The Serial part makes sence. I also try to build the blink in. Power was fine on all points that i checked. Also on the AZ1117-3.3 5V and 3.3V looks good.

i will come back with the Serial and LED result.

Hi, yes it fits:
https://www.reichelt.de/ir-empfaenger-module-38khz-90-side-view-tsop-31238-p107210.html
From 2,5 V to 5,5 V

Thank you very mutch :slight_smile:

The problem was the serial part. It was only there for debugging. for the quick test i removed it and all works fine :slight_smile: So now i can build a solution for borth :slight_smile:

but

Maybe you can help me with that. I see the specs at the datasheet and it works on my board.

What is the problem here and how can i optimize it :slight_smile:

When "high", the output pin of the TSOP312xx which is connected to IO16 of the ESP32 is pulled up to Vs (5V) by the 30K resistor inside the TSOP312.
It looks like the pullup is to weak to cause any damage so that is good.
I would use 3.3V instead of 5.

1 Like

Tahnk you for this description :slight_smile: I understand and will optimize this :slight_smile:

Ok i don't know what is now the problem... i changed a little bit in the code and now have the same issue that the code will not boot without USB connected... with USB still everything works fine.

What are the major changes:

After i recodnise the same problem i took a look into the serial output with USB and also tryed:

  • wm.setDebugOutput(false); to prevent debugging log from the WifiManager
  • Connect GPIO15 to GND to prevent Output log of the ESP32

So with USB i see no output but still does not boot up without USB.

After everything works and the Halloween test went successful i will put the board and code as open source for everyone :slight_smile:

Here is the current code:


#include <Arduino.h>
#include <stdlib.h>

#define LED_BUILTIN 2 // Fix for IRRemote lib warning
#define SEND_PWM_BY_TIMER // Fix for IRRemote lib warning

// Wifi
#include <WiFiManager.h>
WiFiManager wm;
int cpTimeout = 90; // Timeout for the configuration portal
WiFiManagerParameter custom_led_delay("led_delay", "LED delay", "", 10);

// Core
#include <Infinitag_Core.h>
Infinitag_Core infinitagCore;

// WifiManager configuration portal button
#define BTN_CP_START 17
int buttonState = 0;

// IR
#define DECODE_RC5
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 16
IRrecv irrecv(IR_RECEIVE_PIN);
decode_results results;

// LED
#include <Adafruit_NeoPixel.h>
#define LED_PIN     18
#define LED_COUNT  12
#define BRIGHTNESS 255
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);

// Switches
#define SW_1     19
#define SW_2     21
#define SW_3     22
#define SW_4     23

// Color Settings
int ledColorWifiReboot[4] = {0, 0, 0, 255};
int ledColorWifiWait[4] = {255, 255, 0, 0};
int ledColorIdle[4] = {255, 0, 255, 0};
int ledColorHit[4] = {255, 0, 0, 0};
int ledColorMissHit[4] = {0, 255, 255, 0};

// General
bool targetHit = false;
#define TEST_LED_PIN 2

void setup() {
  // Disable Log to prevent Serial Log
  wm.setDebugOutput(false); 

  // Test blink 
  pinMode(TEST_LED_PIN, OUTPUT);
  digitalWrite(TEST_LED_PIN, HIGH);
  delay(1000);
  digitalWrite(TEST_LED_PIN, LOW);
  
  // Wifi - 1
  WiFi.mode(WIFI_STA);

  // Set configuration portal PIN
  pinMode(BTN_CP_START, INPUT);

  // Set Switch Pins
  pinMode(SW_1, OUTPUT);
  pinMode(SW_2, OUTPUT);
  pinMode(SW_3, OUTPUT);
  pinMode(SW_4, OUTPUT);

  // Custom configuration
  wm.addParameter(&custom_led_delay);

  // Set the default value for the custom field
  custom_led_delay.setValue("1000",4);

  // Custom menu
  // Added param for custom configuration
  // Added exit to start loop after configuration
  std::vector<const char *> menu = {"wifi","info","param","close","sep","update","exit"}; // Added param to the menu
  wm.setMenu(menu); // custom menu, pass vector
  wm.setHostname("InfinitagTarget_1");
  
  // LED
  strip.begin();
  strip.show();
  strip.setBrightness(BRIGHTNESS);
  ledShowSetup();

  // Wifi - 2
  //wm.resetSettings(); // Only for Develop - Remove after
  // Auto Connect
  if (!wm.autoConnect("InfinitagTarget_1","12345678")) {
  }
    
  // IR
  irrecv.enableIRIn();

  // General 
  targetHit = false;
}

void loop() {
  irDecode();

  configPortalButton();
  
  if (targetHit) {
    targetHitLoop();
  } else {
    targetNotHitLoop();
  }
}

void targetNotHitLoop() {
  setAllSwitches(LOW);
  ledFillFull(ledColorIdle);
}

void targetHitLoop() {
  setAllSwitches(HIGH);
  
  ledFillFull(ledColorHit);
  
  targetHit = false;
  delay(1000);
  IrReceiver.resume();
}

void setAllSwitches(int state) {
  digitalWrite(SW_1, state);
  digitalWrite(SW_2, state);
  digitalWrite(SW_3, state);
  digitalWrite(SW_4, state);
}

void configPortalButton() {
  buttonState = digitalRead(BTN_CP_START);

  if (buttonState == HIGH) {
    ledShowSetup();
    wm.setConfigPortalTimeout(cpTimeout);
    wm.startConfigPortal("WM_ConnectAP","12345678");
  }
}

void irDecode() {
  // IR signal received?
  if (IrReceiver.decode()) {
    
    // Is the IR signal a Infinitag signal?
    if (infinitagCore.irDecode(IrReceiver.decodedIRData.decodedRawData)) {
      
      // Validate all required Infinitag parameters for a valid hit
      if (infinitagCore.irRecvIsSystem == false && infinitagCore.irRecvGameId == 0
        && infinitagCore.irRecvTeamId == 0 && infinitagCore.irRecvPlayerId == 0
        && infinitagCore.irRecvCmd == 1 && infinitagCore.irRecvCmdValue == 255) {
          targetHit = true;
      }
    } else {
      ledFillFull(ledColorMissHit);
      delay(150);
      strip.clear();
    }
    
    IrReceiver.resume();
  }
}

void ledShowSetup() {
  ledFillFull(ledColorWifiReboot);
  delay(150);
  ledFillFull(ledColorWifiWait);
}

void ledFillFull(int color[]) {
  strip.fill(strip.Color(color[0], color[1], color[2], color[3]));
  strip.show();
}

If anyone is interested: GitHub - Infinitag/Target: Lasertag target board for Infinitag open source system.

GPIO15 outputs a PWM signal at boot.
Maybe not happy to be grounded.
https://randomnerdtutorials.com/esp32-pinout-reference-gpios/

Thank you.

The boot does also not work with a "not connected" GPIO15.

This was also only a idea because i see in my serial monitor with USB connected that the ESP32 send some information over serial.
And this was the solution to disable this.

Unfortunately this is not yet the solution :frowning:

From the same page,

  • GPIO 15 (must be HIGH during boot)