I’ve got an Arduino Nano ESP32 that I’m trying to use with an OLED I2C Display. ESPHome can’t seem to communicate with the display.
I’m going crazy trying to figure this out. Any extra eyes on the problem would be immensely appreciated. Photos of the current setup:
Pins are connected as follows:
| ESP32 | Display | 
|---|---|
| GND | GND | 
| 3.3v | VCC | 
| A5 (GPIO12) | SCK | 
| A4 (GPIO11) | SDA | 
Log Output
[17:14:12][I][app:100]: ESPHome version 2024.6.1 compiled on Jun 20 2024, 17:13:49
[17:14:12][C][wifi:599]: WiFi:
<snip>
[17:14:12][C][logger:185]: Logger:
[17:14:12][C][logger:186]:   Level: VERY_VERBOSE
[17:14:12][C][logger:188]:   Log Baud Rate: 115200
[17:14:12][C][logger:189]:   Hardware UART: USB_CDC
[17:14:12][C][i2c.arduino:071]: I2C Bus:
[17:14:12][C][i2c.arduino:072]:   SDA Pin: GPIO11
[17:14:12][C][i2c.arduino:073]:   SCL Pin: GPIO12
[17:14:12][C][i2c.arduino:074]:   Frequency: 50000 Hz
[17:14:12][C][i2c.arduino:086]:   Recovery: bus successfully recovered
[17:14:12][I][i2c.arduino:096]: Results from i2c bus scan:
[17:14:12][I][i2c.arduino:098]: Found no i2c devices!
[17:14:12][C][homeassistant.time:010]: Home Assistant Time:
[17:14:12][C][homeassistant.time:011]:   Timezone: 'EST5EDT,M3.2.0,M11.1.0'
[17:14:12][C][captive_portal:088]: Captive Portal:
[17:14:12][C][mdns:115]: mDNS:
[17:14:12][C][mdns:116]:   Hostname: test-esp32
[17:14:12][V][mdns:117]:   Services:
[17:14:12][V][mdns:119]:   - _esphomelib, _tcp, 6053
[17:14:12][V][mdns:121]:     TXT: version = 2024.6.1
[17:14:12][V][mdns:121]:     TXT: mac = ecda3b552920
[17:14:12][V][mdns:121]:     TXT: platform = ESP32
[17:14:12][V][mdns:121]:     TXT: board = arduino_nano_esp32
[17:14:12][V][mdns:121]:     TXT: network = wifi
[17:14:12][V][mdns:121]:     TXT: api_encryption = Noise_NNpsk0_25519_ChaChaPoly_SHA256
[17:14:12][C][esphome.ota:073]: Over-The-Air updates:
[17:14:12][C][esphome.ota:074]:   Address: test-esp32.local:3232
[17:14:12][C][esphome.ota:075]:   Version: 2
[17:14:12][C][esphome.ota:078]:   Password configured
[17:14:12][C][safe_mode:018]: Safe Mode:
[17:14:12][C][safe_mode:020]:   Boot considered successful after 60 seconds
[17:14:12][C][safe_mode:021]:   Invoke after 3 boot attempts
[17:14:12][C][safe_mode:023]:   Remain in safe mode for 300 seconds
[17:14:12][C][api:139]: API Server:
[17:14:12][C][api:140]:   Address: test-esp32.local:6053
[17:14:12][C][api:142]:   Using noise encryption: YES
[17:14:12][C][ssd1306_i2c:023]: I2C SSD1306
[17:14:12][C][ssd1306_i2c:023]:   Rotations: 0 °
[17:14:12][C][ssd1306_i2c:023]:   Dimensions: 128px x 64px
[17:14:12][C][ssd1306_i2c:024]:   Address: 0x3C
[17:14:12][C][ssd1306_i2c:025]:   Model: SH1106 128x64
[17:14:12][C][ssd1306_i2c:027]:   External VCC: NO
[17:14:12][C][ssd1306_i2c:028]:   Flip X: YES
[17:14:12][C][ssd1306_i2c:029]:   Flip Y: YES
[17:14:12][C][ssd1306_i2c:030]:   Offset X: 0
[17:14:12][C][ssd1306_i2c:031]:   Offset Y: 0
[17:14:12][C][ssd1306_i2c:032]:   Inverted Color: NO
[17:14:12][C][ssd1306_i2c:033]:   Update Interval: 0.5s
[17:14:12][E][ssd1306_i2c:036]: Communication with SSD1306 failed!
[17:14:12][E][component:082]:   Component display is marked FAILED
[17:14:36][VV][scheduler:226]: Running interval '' with interval=60000 last_execution=4294941765 (now=34469)
[17:15:04][I][safe_mode:041]: Boot seems successful; resetting boot loop counter
Configuration:
esphome:
  name: test-esp32
esp32:
  board: arduino_nano_esp32
  framework:
    type: arduino
    version: 2.0.14
# Enable logging
logger:
  baud_rate: 115200
  tx_buffer_size: 512
  deassert_rts_dtr: false
  hardware_uart: USB_CDC
  level: VERY_VERBOSE
  logs: {}
# Enable Home Assistant API
api:
  encryption:
    key: [redacted]
  port: 6053
  password: ''
  reboot_timeout: 15min
safe_mode:
  reboot_timeout: 5min
  num_attempts: 3
ota:
  - platform: esphome
    password: [redacted]
    version: 2
    port: 3232
wifi:
  ap:
    ssid: Test-Esp32 Fallback Hotspot
    password: [redacted]
    ap_timeout: 1min
  domain: .local
  reboot_timeout: 15min
  power_save_mode: LIGHT
  fast_connect: false
  passive_scan: false
  enable_on_boot: true
  networks:
  - ssid: [redacted]
    password: [redacted]
    priority: 0.0
  use_address: test-esp32.local
captive_portal:
time:
  - platform: homeassistant
    id: ha_time
i2c:
  id: bus_a
  scan: true
  sda: GPIO11
  scl: GPIO12
display:
  - platform: ssd1306_i2c
    model: "SH1106 128x64"
    update_interval: 0.5s
    address: 0x3C
    lambda: |-
      it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Temperature:");
font:
  - file: 'fonts/slkscr.ttf'
    id: font1
    size: 8
Things I’ve tried that haven’t helped so far:
- 
Powering the display from the 3.3v pin on the Nano as well as the VBUS pin 
- 
Changing I2C frequencies. I’ve tried 50Hz and 100Hz - 900Hz in increments of 100Hz 
- 
Changing the display model to ssd1306 128x64andSH1106 128x64
- 
The Arduino gets power via USB-C. I’ve tried this connected to both a normal AC adapter as well as my computer. 
- 
Various lengths/brands of USB-C cables 
- 
If I test with a multi-meter across the 3.3v and ground pins on the Arduino, I get just shy of 3.3v. Same across the GND and VCC pins on the display. 
- 
The displays came in a 5-pack. I have tried multiple units to ensure one wasn’t bad. 
- 
Setting setup_priority: -500in thedisplay:block
I used the Arduino sketch below to verify the I2C address of the display. The output is:
I2C scanner. Scanning ...
Found address: 60 (0x3C)
Done.
Found 1 device(s).
Code:
#include <Wire.h>
void setup() {
  Serial.begin (115200);
  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }
  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup
void loop() {}
In case it helps, here’s the Arduino Nano ESP32 cheat sheet which includes a pin map.

