Below is the specs. of the OLED display used:
- Driver IC: SSD1306
- Resolution: 128 x 64
- Interface: I2C
Wire up the OLED display to WeMos D1 Mini according to the below diagram.
Installing the required OLED libraries in Arduino IDE
First, install the Adafruit_SSD1306 library.
Second, install the Adafruit_GFX library.
Be sure to restart the Arduino IDE after the 2 libraries have been installed.
Finding the I2C address of the OLED Display
Use the sketch below to find the I2C address of the OLED display and to make sure the wiring is O.K.
The Arduino Sketch
O.K. So the I2C address of the OLED display is at 0x3C.
Running the OLED Example Sketch
Load the 128x64 I2C example sketch from the OLED examples provided by Adafruit1306 library.
The sample sketch
Upload the code to your ESP8266 board. Don’t forget to select the right board and COM port in the Tools menu.
You should get a series of different animations in the OLED.
1. If the OLED used doesn’t have a RESET pin, be sure to set the OLED_RESET variable (line 30 above) to -1 as shown below:
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
2. Be sure to run the I2C scanner sketch to find the I2C address of the OLED display. Don't trust the I2C address marking on the back of the display module. On the back of the OLED display module, it shows the address to be either 0x78 or 0x7A. However, the actual address is 0x3C.
ESP8266 0.96 inch OLED Display with Arduino IDE
Arduino Tutorial: OLED 0.96" I2C/SPI Display
#21 Two Equal Displays on One Arduino I2C Bus (Tutorial)