Sub topic 12
Fixing blank, garbled, or missing displays
Assume you can upload sketches, use a breadboard, read a wiring diagram, and install Arduino libraries. This chapter uses the 16x2 HD44780 LCD, an I2C LCD backpack, and an SSD1306 OLED from earlier chapters. Troubleshoot one change at a time. Disconnect power before moving jumper wires.
Start with the symptom
A display problem usually belongs to one of four groups:
- Blank screen: power, contrast, initialization, or address failure.
- Backlight on but no text: contrast, wiring, or incorrect LCD initialization.
- Garbled characters: loose wires, wrong pin order, timing, or an incorrect LCD mode.
- OLED stays dark: wrong I2C address, wrong controller size, missing
display(), or a failed initialization.
Use a known-good minimal sketch before adding sensors, menus, or changing-value code.
| Symptom | Most likely causes | First check |
|---|---|---|
| LCD backlight is on, but no blocks or text | Contrast, power, or wiring | Turn the contrast potentiometer slowly |
| LCD shows dark blocks | LCD has power, but the controller was not initialized | Check `lcd.begin(16, 2)` and signal wiring |
| Characters are random | Data pins are swapped or floating | Compare every wire with the constructor |
| OLED is completely dark | Address, power, reset, or library setup | Run the I2C scanner and check `display.begin()` |
| Old characters remain | New text is shorter than old text | Clear or overwrite the remaining positions |
Check power and ground first
Measure voltage between the display’s VCC and GND pins. A typical 5 V HD44780 module expects about 5 V. Many SSD1306 modules accept 3.3 V, while some breakout boards include a regulator and level shifting. Follow the module’s documentation rather than assuming that every board uses the same voltage.
The Arduino and display must share ground. A signal wire without a shared ground can produce random characters or an unresponsive bus. Keep jumper wires short while testing. Confirm that the breadboard power rail is continuous. Some breadboards split the rail in the middle.
Troubleshoot an HD44780 LCD
For a direct 4-bit connection, compare the physical wires with this constructor:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);The values mean RS, E, D4, D5, D6, and D7, in that order. A single swapped data wire can create unreadable symbols. The RW pin should normally connect to ground when the sketch only writes to the LCD. The contrast pin, often labeled VO, needs a potentiometer between 5 V and ground. Rotate it through its range while the sketch runs.
The LCD dimensions must match the actual module:
lcd.begin(16, 2);This setting describes the display geometry. It does not repair incorrect wiring.
If the screen shows dark rectangles on the first row after power-up, the LCD has power and contrast but probably did not receive valid initialization commands. Recheck RS, E, the four data pins, and the board ground. Avoid connecting the LCD data pins to pins that another library or circuit is actively using.
Troubleshoot I2C displays
An I2C display needs SDA, SCL, VCC, and GND. On an Arduino Uno, SDA is A4 and SCL is A5. Other boards use different pins, so check the board pin labels.
Run the scanner from the earlier chapter. If it finds no device:
- Check that
SDAandSCLare not reversed. - Confirm that the display and Arduino share ground.
- Check the module voltage.
- Try shorter wires.
- Verify that the board actually supports I2C.
If the scanner finds an address but the display sketch fails, use that address in the object declaration. Common LCD backpack addresses include 0x27 and 0x3F, but the scanner result is authoritative. LCD backpack libraries are not identical. One fork may use init(), while another expects begin().
For an SSD1306, check both the address and the geometry:
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
for (;;) {}
}A 128x32 display must not be configured as 128x64. Some OLED modules also require a reset pin instead of -1. After drawing, call display.display(). Adafruit GFX normally draws into a RAM buffer first, so pixels do not reach the panel until that call.
Fix updates and visual artifacts
When replacing a longer LCD value with a shorter one, old characters remain. Print trailing spaces or clear the field first:
lcd.setCursor(0, 1);
lcd.print("Value: ");
lcd.setCursor(7, 1);
lcd.print(value);For an OLED, redraw the whole frame:
- Call
clearDisplay(). - Draw every item again.
- Call
display()once.
This prevents leftover pixels. Avoid calling display() many times during one frame because it slows updates and can cause visible flicker.
Exercise
Exercise
An OLED scanner finds address 0x3D, but the sketch initializes address 0x3C and the screen stays dark. What should you change first?
Show answer
Change the address passed to display.begin() from 0x3C to 0x3D, then upload the minimal sketch again. If it remains dark, check the OLED geometry, power, ground, and whether display() is called.