In our previous guide on ESP32 Arduino With LCD, we used an I²C module. OLED displays with I²C are sold as one unit. These days, they does not cost huge.
In our earlier guides we have explained about different protocols, interfaces like I²C, Serial Peripheral Interface. Another relevant tutorial is breadboard power supply module).
We are using a 0.96 inch SSD1306 OLED display (blue/white) for this example. This OLED display module can be interfaced with any microcontroller using SPI/I²C protocols. It has a resolution of 128×64. Theory on
OLED (Organic Light-Emitting Diode) explained earlier.
---
OLEDs consists of organic materials between the cathode and the anode. The organic materials is a multi-layered thin film, which includes the Hole Transporting Layer (HTL), Emission Layer (EML) and the Electron Transporting Layer (ETL). Upon charge of electric voltage, the holes and the electrons are injected into the EML from the anode and the cathode. This basic results electro luminescence. You’ll get a library for these displays here :
https://github.com/ThingPulse/esp8266-oled-ssd1306
We can use the ESP32 pins 21 and 22 as I2C SDA and SCL, respectively. SSD1306 can operate at 3.3 V, we can use the the 3.3 V supply pin that most ESP32 boards have to power the display. However we suggest to use different source of external electric supply while making the grounds common (that is why we added the link to breadboard power supply).
SSD1306 OLED display’s GND will connect to ESP32’s GND
SSD1306 OLED display’s VCC will connect to ESP32’s 3.3V
SSD1306 OLED display’s SDA will connect to ESP32’s pin 21 (which is SDA)
SSD1306 OLED display’s SCL will connect to ESP32’s pin 22 (which is SCL)

Coding part is like our example shown for 1602A LCD display :
#include#include "SSD1306.h" SSD1306 display(0x3c, 21, 22); void setup() { display.init(); display.drawString(0, 0, "Hello World"); display.display(); } void loop() {}
The constructor for the mentioned class `SSD1306 display` receives as first parameter the I2C address of the device, which is 0x3c. In earlier guide on ESP32 Arduino With LCD we supplied example code on how to get the `0x3c` value. If your thing does not work with `0x3c` you’ll need that code.
Tagged With ESP32 I2C , esp32 cam drive oled , software i2c esp32 arduino , arduino bluetooth esp32 example 2019 , arduino esp32 with I2c on 7 segment display , arduino i2c frequencies 2019 , esp32 i2c arduino example , arduino oled display example , arduino oled display example i2c , i2c display arduino examples