20×4 I2C LCD on the cleanroom pressure display only shows a row of solid blocks
Small side project. We want a local readout next to a cleanroom door: an ESP32 reads a differential pressure transmitter (4-20 mA through a 165 ohm shunt into the ADC), sends the value to Hermetry, and shows it on a 20×4 LCD with the usual PCF8574 I2C backpack so people can see it without opening a dashboard. The Hermetry side is done.
The LCD shows the first and third rows as solid blocks and nothing else. Backlight is on. Code:
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 20, 4);
void setup() {
Wire.begin(21, 22);
lcd.init();
lcd.backlight();
lcd.print("dP: 12.4 Pa");
}
Backpack VCC is on the 5V pin, SDA/SCL straight to 21/22. I’ve swapped the display for a second one, same result. Wrong pins somewhere?
Have you turned the little blue screw on the back? Mine showed blocks until I did. Not sure it’s the same thing.
Yes, turned it end to end. Blocks get lighter and darker, no text.
Blocks on rows 1 and 3 with contrast fine means the display powered up but never got initialised, so it’s sitting in its one-line power-on mode. Almost always the I2C address. Backpacks with a PCF8574A chip are at 0x3F, not 0x27, and from the outside they look identical. Run a scanner:
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
for (uint8_t a = 1; a < 127; a++) {
Wire.beginTransmission(a);
if (Wire.endTransmission() == 0) Serial.printf("found 0x%02Xn", a);
}
}
void loop() {}
Second thing for an ESP32: the backpack on 5V has its pull-ups to 5V, so SDA/SCL idle at 5V into a 3.3V chip. It usually works and it’s not great. Either power the backpack from 3.3V (some LCDs go faint at 3.3V) or remove the backpack’s pull-up resistors and add 4.7k to 3.3V, or put a small level shifter in between. For something on a cleanroom wall for years I’d do the level shifter.
Same experience, two of my backpacks from the same seller were 0x3F.
0x3F. Changed the constructor and it reads “dP: 12.4 Pa” on the first line. Going with a BSS138 level shifter board for the final build as you suggest. Bit embarrassed I didn’t scan first.
- Bu konuyu yanıtlamak için giriş yapmış olmalısınız.
Sohbete katılın
Soru sormak ve yanıtlamak, yararlı gönderileri beğenmek ve sorununuzu çözen yanıtı işaretlemek için oturum açın. Her katkı puan ve seviye kazandırır.

