Short answer

ESP32 I2C scan finds nothing. What is usually wrong?

  • Pull-ups must exist on SDA and SCL (typical 2.2k–10k to 3.3V). Many breakout boards already have them; a bare chip does not.
  • Address in the datasheet is often 7-bit. Shifting it as 8-bit in software is a common miss.
  • Voltage: a 5V sensor on a 3.3V ESP32 I2C bus needs a translator. Clamping with resistors is unreliable.
  • Start with the official simple read/write example at 100 kHz, then raise speed once ACK is stable.

中文

短答

ESP32 I2C 扫描什么都没有,通常错在哪?

  • SDA / SCL 要有上拉(常见 2.2k–10k 到 3.3V)。很多模块板已带,裸芯片没有。
  • 手册里地址经常是 7 位。软件里当成 8 位去移位,很常见。
  • 5V 传感器上 3.3V ESP32 的 I2C 要电平转换。靠电阻钳位不可靠。
  • 先用官方读写例程跑 100 kHz,ACK 稳定了再提高速率。