So you're a Noob? Post your questions here until you graduate! Don't be shy.
User avatar
By TomTheFrustrated
#64937 First thanks to everyone in this great community! I have searched and read and learned a lot here.

But I've come up against a problem (well a few) that I just cannot figure out and I'm hoping someone can help: I2C simply refuses to work or be recognized.

I have an ESP12 (not the NodeMCU, just the chip soldered to a breakout board) connected with an FTDI. I've had this chip connected to my local network, gotten OTA working on it, and hooked up the MFRC522 via SPI to it, all without issue. Now I am trying to connect an OLED using I2C to it (without anything else connected) and it just will not work (I should also mention I have a regulated 3.3V external power supply connected)

I tried using several SSD1306 libraries including this one that has been recommended here by others:

I've tried using Wire with GPIO 4,5 using Wire.begin(4,5) (also 5,4 just in case). I've tried GPIO 2,0 (and 0,2) with Wire.begin() and no matter what I do the OLED will never even turn itself on.

Using the exact same ssd1306 library, sketch and OLED hooked up to an Arduino UNO on A4 and A5 the OLED works 100% fine, so I know its not the actual screen.

So I guess my question is, what are the pins I should be trying with the OLED to get it to work? I have seen about 700 different versions of pin-outs online and am utterly confused.

The sketch I've been using is very basic just to get it to turn on. Any help at all is appreciated!

Code: Select all#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`

// Initialize the OLED display using Wire library
SSD1306  display(0x3c, 4, 5);   //display(I2C address, SDA, SCL)
// Wemos D1 + SD1306 display(I2C address, SDA = D2, SCL = D1)
// ESP-12 + SD1306 display(I2C address, SDA = GPIO4, SCL = GPIO5)

void setup() {
  Serial.begin(115200);   //for debug by terminal
  Serial.println();   //for debug by terminal
  Serial.println("Debug");   //for debug by terminal

  display.init();  // Initialising the UI will init the display too.
  display.flipScreenVertically();   // up side down or straight
  display.setFont(ArialMT_Plain_10);  //default font. Create more fonts at


void loop() {
  String MyTekst = "Hello world";
  display.clear();    // clear the display

  display.setFont(ArialMT_Plain_24);    // change font
  display.drawString(0, 26, MyTekst);   // draw string (column(0-127), row(0-63, "string")

  display.display();  //display all you have in display memory

  delay(10);  // give some time to finish function loops
User avatar
By TomTheFrustrated
#64966 Still no luck with I2C on this thing....I found this post and added 10k pull-ups to both SDA and SCL: no change. I tried the patched Adafruit library here: and no change.

I've tried other spots on the breadboard, I've tried different cables, different resistors.....I am literally out of ideas. I have no clue how to get I2C working on this ESP board so please help!

Anything at all I can try I am willing to give it a shot to get this working.
User avatar
By Ocsav
#65111 Use an I2C scanner. I know that I2C works ok in ESP-12, I have a node-mcu accessing 2 I2C sensors, and I've use them in different pins, at first I had 4,5 but now in 0,2 so, it works ok.
Unless you have some problem in your breakout board wring the scanner should clear the matter.
My OLED is still in SPI mode, so I can't help you here...
User avatar
By rudy
#65114 I tried your sketch as is, no changes, and it worked. :o

I didn't add pull-up resistors since I think the module I have has some. I had previously checked. Normally I use 0 and 2 for my I2C but I decided to just use the sketch as is.

Are you sure you don't have SDA and SLC swapped? And as has been suggested, try a scanner to see if it is seen as an I2C device.


I used this library