Electronic – arduino – Why does the LCD impede the ESP8266 NodeMCU initialization

arduinocircuit analysisesp8266lcd

I have a very simple setup on a breadboard that connects
a Lolin v3 NodeMCU ESP8266 with a 16×02 LCD. No I2C
communication, I'm doing with directly with Arduino IDE and
the LiquidCrystal library.

For some reason when I disconnect the LCD Vdd and connect
it after the MCU has booted everything works fine. My power
supply indicates it draws ~70mA during boot and then lowers
the current. However if I leave the LCD connected and turn
on the power supply, the MCU won't boot and the circuit is
stuck drawing 40mA with the LCD showing blocks on the first
line at 50% contrast.

How can I fix this?

Here's how I setup my wiring:

Wiring

And my code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(D8, D7, D6, D5, D4, D3);

void setup(void) {
  lcd.begin(16, 2);
}

void loop(void) {
  lcd.setCursor(0, 0);
  lcd.print("hello, world!");
  delay(10000);
}

Best Answer

Certains pins of the ESP are boot mode selection straps, and are internally weakly pulled high or low to boot normally, but these can be overridden externally to select other boot modes (to load firmware etc).

The LCD data, R/W and RS pins all have internal weak pull-ups to LCD supply voltage. These weak pull-ups of the LCD module override the weak pull-downs of the ESP, and select a boot mode where it does not boot normally.

What is even worse, is that the ESP pins are rated for 3.3V IO voltages, and the LCD pull-ups try to pull them to 5V. The current is very small due to the pull-up resistances are generally quite high, but still this should not be done for long-term reliability.