1
\$\begingroup\$

I have a very simple setup on a breadboard that connects a Lolin v3 NodeMCU ESP8266 with a 16x02 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);
}
\$\endgroup\$
4
  • \$\begingroup\$ I don't see any power supply decoupling capacitors. \$\endgroup\$
    – Andy aka
    Jan 20 at 18:43
  • \$\begingroup\$ @Andyaka how can I add them? \$\endgroup\$
    – sidyll
    Jan 20 at 18:44
  • \$\begingroup\$ this may help ... zoetrope.io/tech-blog/… \$\endgroup\$
    – jsotola
    Jan 20 at 18:51
  • \$\begingroup\$ @jsotola Ah, that's it! Thank you very much. Since I have connections to spare I simply replaced the three GPIO pins 0, 2 ad 15 for the other remaining free pins and it works flawlessly. Do you want to post this as an answer? I think it could be useful to someone in the future. \$\endgroup\$
    – sidyll
    Jan 20 at 19:20
3
\$\begingroup\$

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.

\$\endgroup\$
5
  • \$\begingroup\$ Thank you for your detailed answer. I had just finished reading the article posted in the commends and avoiding the GPIO 0, 2 and 15 did the trick of letting it boot normally. On the other hand, I'm now thinking about the long-term reliability you mentioned. I was wondering if there is a way around it. Any pointers to the right direction are greatly appreciated. Thank you very much. \$\endgroup\$
    – sidyll
    Jan 20 at 19:25
  • \$\begingroup\$ It depends which way you want to solve it. One way is to use an LCD module that works with 3.3V so they have the same supply. Another way is to do some kind of level conversion between the chips, and that can be done in many ways like a buffer chip or FET pass gate. \$\endgroup\$
    – Justme
    Jan 20 at 19:36
  • \$\begingroup\$ Thank you very much. \$\endgroup\$
    – sidyll
    Jan 20 at 19:38
  • \$\begingroup\$ the question was about esp8266, not esp32 \$\endgroup\$
    – Juraj
    Jan 21 at 7:49
  • \$\begingroup\$ @Juraj fixed, but this is a general concept, it does not have to be an ESP at all - many MCUs have special bootstrap pins which must be connected with care or it won't boot. \$\endgroup\$
    – Justme
    Jan 21 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.