SPI OLED running direct off ESP8266 built in Arduio IDE

I've trying to get an SSD1306 OLED display working directly from an ESP8266 ESP-12 module using hardware SPI.

The OLED works fine on a Mega2560 with the U8g_lib and AdaFruitSSD_1306 libraries.

I understood that the U8g_lib hasn't been modified to run on ESP8266 but the AdaFruit library has. (as long as you get the latest files directly and don't use the IDE Library manager).

Sadly I'm not getting a glimmer from the display though.

Pretty sure it should run on 3.3V.

A lot of examples I have seen working use I2C but I don't have that interface on my OLED board.

Any ideas?

I have since found that I can reconfigure my OLED board to I2C.

Tested with U8Glib on an Arduino Mega2560 and it works BUT only with No Ack option. The SSD1306 doesn't support I2C Acknowledge?

The board supplier mentions this in their data and the driver datasheet says this:

SDA acts as a communication channel between the transmitter and the receiver. The data and the
acknowledgement are sent through the SDA.
It should be noticed that the ITO track resistance and the pulled-up resistance at “SDA” pin becomes
a voltage potential divider. As a result, the acknowledgement would not be possible to attain a valid
logic 0 level in “SDA”.
“SDAIN” and “SDAOUT” are tied together and serve as SDA. The “SDAIN” pin must be connected to
act as SDA. The “SDAOUT” pin may be disconnected. When “SDAOUT” pin is disconnected, the
acknowledgement signal will be ignored in the I2C-bus.

So now I went back to the ESP Oled code I found, that uses the WIRE library and tested that on the Mega2560. It didn't work, because of the Ack problem.

I modified the WIRE library to ignore NACK's and the display now works, sort of. Text comes up bu the font looks screwed up.

Next I'll try this on the ESP-12.

I have that tft device working fine with esp8266. What's probably not widely known is that you need a pull-down resistor on pin15.

Here's an accelerated graphics library set that i created (supports multiple tft chips and multiple arduino type boards). The acceleration on the esp8266 is very good. Use pretty much the same as Adafruit libraries. Check the examples.


Hey thanks, I'll try your library.

So GPIO15 does what exactly? I found GPIO2 changes the bootloader baud rate. GPIO0 to select Bootloader.

I have had no issues flashing with GPIO15 n/c.

Now I understand that the ESP8266 add on for Arduino doesn't use local copies of library source code, I can see why me modding twi.c is only going to work on Arduino boards and not the ESP8266!

For some reason, which I have not gotten to the bottom of, my OLED won't do ACK's in I2C mode.

I can get around this my modding twi.c but of course it doesn't help on the ESP8266...

Back to the drawing board.

Finally have success, switched back to spi interface and used the adafruit libarary with somhi's mods which make it work on the ESP8266...