I'm working on an ESP8266-based water level monitoring system using an ultrasonic sensor and an I2C LCD. The problem I'm facing is that sometimes the ESP8266 does not boot properly when powered on for the first time. However, if I turn the power off and on again, it boots and works fine.
Project Details
Microcontroller: ESP8266 (NodeMCU)
Peripherals:
Ultrasonic sensor (JSN-SR04T)
16x2 I2C LCD
Buzzer
Push button
Wiring:
const int trigPin = D3;
const int trigPin2 = D8;
const int echoPin = D0;
const int echoPin2 = D6;
const int overflow = D4;
const int buzzer_out1 = D5;
const int push_Button = D7;
LCD Connections:
SCL: D1
SDA: D2
Issue Description:
When I first power on the ESP8266, it sometimes does not boot properly. The LCD either remains blank or shows a pattern of blocks (see attached image). If I turn off the power and turn it back on immediately, the ESP8266 boots and works correctly. The issue is inconsistent but happens frequently enough to be a concern.
Any insights on what might be causing this and how to fix it would be greatly appreciated!
-
possibly a problem with the codejsotola– jsotola03/21/2025 07:05:59Commented Mar 21 at 7:05
-
But most of the time esp boots properly Without any issue, so might be issue with my pin selection or wiringjohnson veigas– johnson veigas03/21/2025 07:10:48Commented Mar 21 at 7:10
-
What is "overflow" (d4) ? Please, show full schematic.Matt– Matt03/21/2025 09:57:20Commented Mar 21 at 9:57
-
1This is for an ESP32 but the situation is the same for the ESP8266 where the enable (EN) pin is broken out: reddit.com/r/esp32/comments/ou6r8d/… The idea is to delay enabling the device for a few milliseconds after power is applied to it to help ensure the power is stable. But also add some details of the power supply to your question.6v6gt– 6v6gt03/21/2025 10:22:02Commented Mar 21 at 10:22
-
I am using 5V adapter connected directly to Vin pin of ESP8266johnson veigas– johnson veigas03/21/2025 14:26:56Commented Mar 21 at 14:26