Posts with «adafruit gfx» label

0.96-inch 128×64 OLED Display: SSD1306 and I2C

The 0.96-inch 128×64 OLED display is a compact module widely used in electronics projects. It uses the SSD1306 driver and communicates over I2C, so it connects to Arduino, ESP8266 and ESP32 with just a few wires. It shows text, sensor data, symbols and graphics. AdriRobot tested it with an Arduino UNO and with an ESP32-C3 SuperMini.

128×64 OLED display: technology and colours

OLED stands for Organic Light Emitting Diode. Each pixel emits its own light, so contrast is high and no backlight is needed. Power consumption is lower than that of a backlit LCD, and readability stays good both in the dark and in bright light. The module comes with white, blue or yellow pixels, or in a two-colour version with a yellow top strip and the rest in blue.

  • 0.96-inch size, 128 × 64 pixel resolution, SSD1306 driver;
  • supply from 3.3 to 5 V, 0.06 W consumption in normal display mode;
  • viewing angle greater than 160°;
  • operating temperature from -30 to +70 °C;
  • glass screen, lifetime of at least 16,000 hours;
  • module dimensions: 29.28 × 27.1 mm.

Pins, I2C address and power supply

The connector has four pins: VCC (3.3-5 V), GND, SCL and SDA. The reset circuit is on board, so no extra pin is needed. On the Arduino UNO the I2C pins are A5 for SCL and A4 for SDA, on the Mega they are 21 and 20.

Watch out for the two power pins, because on some modules their order is reversed. Displays marked JMDO.96C.1 let you choose: two pads on the PCB, shorted with 0 Ω SMD resistors or with a blob of solder, swap the two pins. Before connecting, it is therefore worth checking the silkscreen.

On some modules VCC and GND are swapped: read the silkscreen (photo: AdriRobot)

The I2C address is 0x3C, the same as other SSD1306 displays, and it cannot be changed. If other peripherals with that address are on the bus, another solution is needed.

Test with Arduino UNO

For the test, the display is mounted on a small breadboard and connected to an Arduino UNO. First you read the address with the i2c_scanner sketch (File, Examples, Wire): if nothing shows up, try swapping the SDA and SCL wires. Then install the Adafruit SSD1306 library from the Library Manager, accepting the Adafruit GFX dependency as well with Install all.

The test sketch then fills the screen, draws a pixel in each corner and writes a few lines of text. On the two-colour model, in fact, the first line comes out yellow because it sits in the top strip.

The test sketch running on the 128×64 OLED display (photo: AdriRobot)

Test with ESP32-C3 SuperMini

Connecting the display to the ESP32-C3 SuperMini (diagram: AdriRobot)

With the ESP32-C3 SuperMini the display uses 3.3 V, GND, GPIO9 as SCL and GPIO8 as SDA. In the IDE you select ESP32C3 Dev Module and enable USB CDC On Boot and Erase All Flash Before Sketch Upload, as in the other tests. Finally the sketch initialises I2C on pins 8 and 9, starts the display at address 0x3C and writes a few lines of text.

AdriRobot also used it on a board with an ESP8266 12F, to show temperature and humidity from a DHT11, and on a shield with a DFPlayer Mini, to print messages. The white-pixel model is available as a 0.96-inch I2C OLED display.

Source: AdriRobot’s original article includes the circuit diagram, the downloadable sketches and the test video.

Related products

The post 0.96-inch 128×64 OLED Display: SSD1306 and I2C appeared first on Open Electronics.