LCD Shows Strange Characters After Running for a While

Character LCD displays such as 1602, 2004 and 1604 modules are often used in Arduino, ESP32, ESP8266, RP2040 and CANABLOX projects. They are simple, readable and inexpensive. But one frustrating problem appears again and again: the LCD works at first, then later shows strange characters, random symbols, missing letters or corrupted text.

This can be confusing because the display clearly works. It may show the correct message after reset, but after a few minutes, after a relay switches, after a motor starts, or after the project runs for a while, the text becomes unreadable.

In many cases, the LCD is not defective. The real cause is usually power noise, weak ground, I2C communication errors, wrong voltage levels, poor wiring, memory problems in the sketch, or updating the LCD too often without managing the display state properly.

Typical Symptoms

  • The LCD starts correctly, then later shows random characters.
  • The display shows strange symbols after a relay, motor or servo turns on.
  • Text appears on the wrong line after the project runs for a while.
  • Characters are missing or replaced by blocks.
  • The LCD freezes but the microcontroller keeps running.
  • The display works after reset, then becomes corrupted again.
  • The problem appears only when other modules are connected.
  • The display works on short wires but fails with longer wires.

First Important Point: The LCD Can Lose Communication Without Losing Power

An LCD module can still have power and backlight while the displayed text is corrupted. The backlight may stay on, but the LCD controller may have received bad commands or missed data.

This means a glowing display does not prove the LCD communication is healthy.

When strange characters appear after the display worked correctly, the likely causes are:

  • The LCD received corrupted data.
  • The LCD controller was disturbed by power noise.
  • The I2C backpack had a communication error.
  • The sketch wrote text to the wrong position.
  • The microcontroller reset partially or restarted part of the code.
  • A library or memory issue caused invalid text output.

Common Cause: Power Supply Noise

LCD modules need stable power. A small voltage dip or noise spike can disturb the LCD controller even if the microcontroller does not fully reset.

This is especially common when the project includes:

  • Relays.
  • Motors.
  • Servos.
  • Solenoids.
  • LED strips.
  • WiFi modules.
  • Long power wires.

If the LCD becomes corrupted exactly when a load switches, suspect power and grounding before changing the display library.

Common Cause: Relay or Motor Switching Noise

Relays, motors and solenoids can create electrical noise. A relay coil may create a voltage spike when switched off. A motor can create brush noise and current spikes. A solenoid can disturb the supply when energized or released.

This noise can enter the LCD through the power supply, ground wiring or signal wires.

Possible fixes include:

  • Use proper flyback diodes for relay coils and solenoids.
  • Use motor driver boards with proper suppression.
  • Add capacitors near the LCD module and near noisy loads.
  • Keep relay and motor wiring away from LCD/I2C wiring.
  • Use a separate supply for high-current loads.
  • Connect grounds correctly without routing load current through the logic ground path.

Common Cause: Weak or Missing Common Ground

If the LCD, controller and other modules do not share a stable ground reference, communication can become unreliable.

This is especially important when using separate power supplies. The LCD may be powered from one supply and the controller from another. If their grounds are not connected correctly, the I2C or parallel signals may not have a reliable reference.

Even when grounds are connected, high-current load current should not flow through the same thin ground wire used by the LCD and microcontroller.

Common Cause: I2C Wiring Problems

Many 1602 and 2004 LCD modules use an I2C backpack. If SDA or SCL wiring is weak, too long or noisy, the LCD may receive bad data.

This can cause the display to show strange characters even though it worked at first.

Check for:

  • Loose SDA or SCL jumper wires.
  • Long I2C wires.
  • Missing or incorrect pull-up resistors.
  • Too many I2C modules with pull-ups in parallel.
  • I2C wires routed near motor, relay or LED power wiring.
  • Wrong voltage level on the I2C bus.

For troubleshooting, connect only the LCD and controller with short wires and run a simple display test.

Common Cause: I2C Bus Speed Too High

Some LCD backpack modules work reliably at 100 kHz but become unreliable at higher I2C speeds, especially with long wires or multiple modules.

If the display shows strange characters after some time, try lowering the I2C clock speed:

Wire.begin();
Wire.setClock(100000); // 100 kHz

On ESP32 or other boards with custom I2C pins, define the pins first:

Wire.begin(SDA_PIN, SCL_PIN);
Wire.setClock(100000);

Do this before initializing the LCD library.

Common Cause: 5V LCD Backpack with 3.3V Controller

Many character LCD modules are designed for 5V operation. ESP32, ESP8266, RP2040 and many modern boards use 3.3V logic.

This can create two problems:

  • The LCD backpack may pull SDA and SCL up to 5V, which is unsafe for 3.3V GPIO pins.
  • The 5V LCD backpack may not reliably recognize 3.3V logic levels.

A setup may appear to work at first but fail randomly, especially with longer wires or electrical noise.

For reliable operation, use a 3.3V-compatible LCD module, proper I2C level shifting, or a display module designed for modern 3.3V controllers.

Common Cause: Contrast Is Marginal

If the LCD contrast is set near the edge of readability, temperature changes or supply voltage changes can make the display look strange. This is usually not true data corruption, but it can look like bad characters or missing text.

Adjust the contrast potentiometer slowly while the display is running. If the text becomes clear again, the LCD controller may be fine and the issue was contrast setting or supply voltage.

Common Cause: Updating the LCD Too Often

Some sketches clear and rewrite the whole LCD many times per second. This can cause flicker and may make the display appear unstable. It can also make debugging harder because the display is constantly being overwritten.

Bad pattern:

void loop() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Temperature:");
  lcd.setCursor(0, 1);
  lcd.print(temp);
}

This clears and rewrites the display as fast as the loop runs.

A better approach is to update the display only when needed or at a reasonable interval.

unsigned long lastDisplayUpdate = 0;

void loop() {
  if (millis() - lastDisplayUpdate >= 500) {
    lastDisplayUpdate = millis();

    lcd.setCursor(0, 0);
    lcd.print("Temperature:   ");
    lcd.setCursor(0, 1);
    lcd.print(temp);
    lcd.print(" C   ");
  }
}

Notice that spaces are printed after the value to erase leftover digits from previous longer values.

Common Cause: Not Clearing Old Characters Correctly

Character LCDs do not automatically erase old text when new shorter text is printed.

Example:

  • First you print Temperature: 100.
  • Later you print Temperature: 99.
  • The display may show Temperature: 990 if the old last digit was not erased.

This is not random corruption. It is leftover text.

Fix it by printing spaces after shorter values or formatting the field with fixed width.

lcd.setCursor(0, 1);
lcd.print(value);
lcd.print("   ");

Common Cause: Writing Outside the Display Size

If the sketch assumes the wrong display size, text may appear in unexpected places or wrap strangely.

Make sure the LCD constructor matches the display:

Display Correct Size Example Constructor
1602 16 columns x 2 rows LiquidCrystal_I2C lcd(0x27, 16, 2);
2004 20 columns x 4 rows LiquidCrystal_I2C lcd(0x27, 20, 4);
1604 16 columns x 4 rows LiquidCrystal_I2C lcd(0x27, 16, 4);

If the display is initialized with the wrong size, cursor positions and line wrapping can become confusing.

Common Cause: Wrong LCD Backpack Mapping

Most I2C character LCD backpacks use a PCF8574 or similar I/O expander. The expander pins are connected to the LCD control and data pins. But not every backpack uses the same mapping.

If the mapping is wrong, the LCD may not initialize correctly or may behave unpredictably.

This problem usually appears immediately, but some marginal setups may seem partly functional and then fail later. If one LiquidCrystal_I2C library does not work, another library with the correct backpack mapping may work better.

Common Cause: Memory Corruption in the Sketch

Sometimes strange LCD text is caused by the sketch, not the LCD hardware. If the program writes outside an array, uses invalid pointers, overuses dynamic strings, or runs out of memory, the text sent to the LCD may become corrupted.

This is more common in larger sketches that combine:

  • Display menus.
  • Sensor libraries.
  • Serial commands.
  • WiFi.
  • Large text buffers.
  • Many String operations on small-memory boards.

If the LCD works perfectly in a simple test sketch but fails in the full project, the full sketch may be corrupting memory or sending bad data.

Common Cause: Using String Carelessly on Small Boards

On small AVR boards such as Arduino Uno and Nano, repeated use of the Arduino String class can fragment limited RAM in long-running projects.

This may cause strange behavior after the project runs for a while, including corrupted LCD output.

For small AVR projects, prefer fixed character buffers, avoid unnecessary dynamic string building, and keep an eye on RAM usage.

Common Cause: Microcontroller Reset Looks Like LCD Corruption

Sometimes the LCD is not the first part that failed. The microcontroller may have reset because of power problems, but the LCD was not reinitialized correctly or still shows old data during restart.

Add a startup message to the serial monitor:

void setup() {
  Serial.begin(115200);
  Serial.println("Controller restarted");
}

If this message appears again whenever the LCD becomes corrupted, the controller is resetting. Then the real problem is power, brownout, watchdog reset or code crash.

Simple LCD Stability Test

Use a simple test sketch to separate hardware problems from full-project software problems.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

unsigned long counter = 0;

void setup() {
  Serial.begin(115200);

  Wire.begin();
  Wire.setClock(100000);

  lcd.init();
  lcd.backlight();

  lcd.setCursor(0, 0);
  lcd.print("LCD test");
}

void loop() {
  lcd.setCursor(0, 1);
  lcd.print("Count: ");
  lcd.print(counter);
  lcd.print("   ");

  counter++;
  delay(500);
}

If this runs for a long time without corruption, the LCD hardware is probably fine. The problem is likely in the full project wiring, power, noise or code.

Recommended Troubleshooting Steps

  1. Test the LCD alone with a simple sketch.
  2. Use short wires between controller and LCD.
  3. Lower I2C speed to 100 kHz.
  4. Measure voltage at the LCD module while the project runs.
  5. Check SDA and SCL pull-ups and idle voltage.
  6. Keep relay, motor and LED wiring away from LCD/I2C wiring.
  7. Add decoupling capacitors near the LCD and noisy loads.
  8. Check whether the microcontroller is resetting.
  9. Update the LCD only at a reasonable interval.
  10. If the simple LCD test works, look for memory problems in the full sketch.

Quick Diagnostic Table

Symptom Likely Cause First Thing to Try
Strange characters after relay switches Electrical noise or power dip Improve relay suppression, power and grounding
LCD works alone, fails in full project Power noise, I2C issue or memory problem Add modules one at a time and test again
Old digits remain on screen New text shorter than previous text Print spaces after values or use fixed-width fields
Display flickers constantly LCD cleared and rewritten too often Update display only when needed or on interval
Corruption after minutes or hours Memory corruption or unstable wiring Run simple LCD test and check RAM/string usage
Works at 100 kHz, fails faster Marginal I2C wiring or pull-ups Keep 100 kHz and shorten SDA/SCL wires

What Not to Do

  • Do not assume the LCD is defective because strange characters appear.
  • Do not keep clearing and rewriting the whole LCD as fast as possible.
  • Do not run I2C wires beside relay, motor or LED power wiring.
  • Do not power relays, motors or servos from the same weak supply path as the LCD.
  • Do not ignore microcontroller resets that happen at the same time.
  • Do not use a 5V LCD backpack directly with a 3.3V controller unless voltage levels are safe.

CANABLOX Practical Note

CANABLOX helps reduce LCD troubleshooting problems by keeping controller, display and I2C wiring modular and repeatable. Instead of a large breadboard with loose jumper wires, the LCD module can be tested alone, then combined with other modules one step at a time.

If strange LCD characters appear in a CANABLOX project, start by testing only the controller and display module. Then add relays, sensors, ADC modules, keypads or other modules one by one. This makes it much easier to find whether the problem is power, I2C wiring, a noisy load or the full sketch.

Conclusion

If an LCD shows strange characters after running for a while, the display is often not broken. The most likely causes are electrical noise, unstable power, I2C errors, poor grounding, excessive display updates, leftover characters or memory problems in the sketch.

Start with a simple LCD-only test, short wires, stable power and 100 kHz I2C. If that works reliably, add the rest of the project back one piece at a time.

Most LCD corruption problems become much easier once you separate display hardware, power quality, I2C communication and sketch behavior instead of treating the LCD as a mystery box.

Shopping Cart
Scroll to Top