LCD 16x2 with I2C backpack con ESP32
Alimentazione 5 V
Bus I2C
Indirizzo I2C
0x20 / 0x21 / 0x22 / 0x23 / 0x24 / 0x25 / 0x26 / 0x27 / 0x38 / 0x39 / 0x3A / 0x3B / 0x3C / 0x3D / 0x3E / 0x3F
Pin e collegamento all’ESP32
| Pin | Ruolo | Pin ESP32 | Note |
|---|---|---|---|
| GND | Massa | GND | |
| VCC | Alimentazione | VIN | Needs 5 V for good contrast: use VIN |
| SDA | Dati I2C (SDA) | D21 | The backpack pulls SDA up to 5 V. Usually works; a level shifter is safer |
| SCL | Clock I2C (SCL) | D22 | The backpack pulls SCL up to 5 V. Usually works; a level shifter is safer |
Collegamento consigliato per l’ESP32 DevKit a 30 pin, evitando i pin della flash, di sola lettura e di strapping. BoardPilot lo controlla mentre colleghi.
Questo modulo è venduto per 5 V. Le sue uscite possono essere a 5 V: usa un traslatore di livello o un partitore sugli ingressi dell’ESP32.
Codice di partenza (Arduino)
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin(21, 22); // SDA = GPIO 21, SCL = GPIO 22
Wire.beginTransmission(0x20);
bool found = Wire.endTransmission() == 0;
Serial.println(found ? "LCD 16x2 with I2C backpack found at 0x20" : "Not found: check power, GND and SDA/SCL");
}
void loop() {}
Fonti
- NXP PCF8574 / PCF8574A datasheet, Address 0x20 to 0x27 (PCF8574T) or 0x38 to 0x3F (PCF8574AT) via A0-A2; most backpacks ship as 0x27 or 0x3F
- Hitachi HD44780U datasheet, Supply 5 V for standard character LCDs
Provalo in 3D in BoardPilot
Componenti simili
HT16K33 4-digit 7-segment backpack (I2C)HT16K33 8x8 LED matrix backpack (I2C)LCD 20x4 with I2C backpackSH1106 OLED 1.3" 128x64 (I2C)SSD1306 OLED 0.91" 128x32 (I2C)SSD1306 OLED 128x64 (I2C)
Dati dei componenti: CC BY 4.0, riutilizzabili citando BoardPilot.