20×4-I2C-LCD an der Reinraum-Druckanzeige zeigt nur eine Reihe voller Blöcke
Von English mit KI übersetzt ·
Kleines Nebenprojekt. Wir wollen eine lokale Anzeige neben einer Reinraumtür: Ein ESP32 liest einen Differenzdrucktransmitter (4-20 mA über einen 165-Ohm-Shunt an den ADC), sendet den Wert an Hermetry und zeigt ihn auf einem 20×4-LCD mit dem üblichen PCF8574-I2C-Rucksack an, damit man ihn ohne Öffnen eines Dashboards sehen kann. Die Hermetry-Seite ist fertig.Das LCD zeigt die erste und dritte Zeile als volle Blöcke und sonst nichts. Hintergrundbeleuchtung ist an. 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");
}
Der Rucksack ist mit VCC an den 5V-Pin angeschlossen, SDA/SCL direkt an 21/22. Ich habe das Display gegen ein zweites getauscht, gleiches Ergebnis. Sind irgendwo die Pins falsch?
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?
Von English mit KI übersetzt ·
Hast du die kleine blaue Schraube auf der Rückseite gedreht? Bei mir wurden Blöcke angezeigt, bis ich das gemacht habe. Ich bin nicht sicher, ob es dasselbe Problem ist.
Have you turned the little blue screw on the back? Mine showed blocks until I did. Not sure it’s the same thing.
Von English mit KI übersetzt ·
Ja, ich habe es Ende zu Ende gedreht. Die Blöcke werden heller und dunkler, kein Text.
Yes, turned it end to end. Blocks get lighter and darker, no text.
Von English mit KI übersetzt ·
Blöcke in den Zeilen 1 und 3 bei guentem Kontrast bedeuten, dass das Display zwar eingeschaltet wurde, aber nie initialisiert wurde und daher im einzeiligen Power-on-Modus steht. Fast immer liegt es an der I2C-Adresse. Backpacks mit einem PCF8574A-Chip sitzen auf 0x3F, nicht auf 0x27, und von außen sehen sie identisch aus. Starte einen 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() {}
Zweiter Punkt für einen ESP32: Das Backpack wird an 5V betrieben und hat seine Pull-up-Widerstände auf 5V, daher liegen SDA/SCL im Ruhezustand bei 5V an einem 3,3V-Chip an. Meist funktioniert das, ist aber nicht sauber. Entweder versorgst du das Backpack mit 3,3V (manche LCDs werden bei 3,3V schwach), oder du entfernst die Pull-up-Widerstände des Backpacks und legst 4,7k gegen 3,3V an, oder du setzt einen kleinen Level-Shifter dazwischen. Für etwas, das jahrelang an einer Reinraumwand hängt, würde ich den Level-Shifter nehmen.
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.
Von English mit KI übersetzt ·
Dasselbe Problem: Zwei meiner Backpacks vom selben Verkäufer hatten 0x3F.
Same experience, two of my backpacks from the same seller were 0x3F.
Von English mit KI übersetzt ·
0x3F. Den Konstruktor geändert, jetzt steht „dP: 12.4 Pa“ in der ersten Zeile. Für den finalen Aufbau nehme ich wie von dir vorgeschlagen eine BSS138-Pegelwandlerplatine. Ein bisschen peinlich, dass ich vorher nicht gescannt habe.
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.
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.
Mitdiskutieren
Melde dich an, um Fragen zu stellen und zu beantworten, hilfreiche Beiträge mit „Gefällt mir“ zu markieren und die Antwort zu kennzeichnen, die dein Problem gelöst hat. Jeder Beitrag bringt Punkte und Stufen.

