Skip to content
Free delivery, every order. Want a bulk deal or can't find what you need? Email support@pmdway.com now!
Free delivery, every order. Want a bulk deal or can't find what you need? Email support@pmdway.com now!
Tutorial - Using the 0.49" 64 x 32 Graphic I2C OLED Display with Arduino

Tutorial - Using the 0.49" 64 x 32 Graphic I2C OLED Display with Arduino

Your new 0.49" 64 x 32 Graphic I2C OLED display is a compact and useful display, that require a small amount of time to get working with your Arduino or compatible board. 

The purpose of this guide is to get your display successfully operating with your Arduino, so you can move forward and experiment and explore further types of operation with the display.

This includes installing the Arduino library, making a succesful board connection and running a demonstration sketch. So let's get started!

Connecting the display to your Arduino

The display uses the I2C data bus for communication, and is a 5V and 3.3V-tolerant board.  

Arduino Uno to Display

GND ---- GND (GND)
5V/3.3V- Vcc (power supply, can be 3.3V or 5V)
A5 ----- SCL (I2C bus clock)
A4 ----- SDA (I2C bus data)

I2C pinouts vary for other boards. Arduino Leonard uses D2/D3 for SDA and SCL or the separate pins to the left of D13. Arduino Mega uses D20/D21 for SDA and SCL. If you can't find your I2C pins on other boards, email support@pmdway.com for assistance.

Installing the Arduino library

To install the library - simply open the Arduino IDE and select Manage Libraries... from the Tools menu. Enter "u8g2" in the search box, and after a moment it should appear in the results as shown in the image below. Click on the library then click "Install":

0.49" 64 x 32 White Graphic OLED - I2C from PMD Way with free delivery worldwide

After a moment the library will be installed and you can close that box. 

Now it's time to check everything necessary is working. Open a new sketch in the IDE, then copy and paste the following sketch into the IDE (you may find the "view raw" link at the end useful):

Your display should go through the demonstration of various font sizes and so on as shown in the video below:

You can see how we've used a different font in the sketch - at lines 19, 30 and 38. The list of fonts included with the library are provided at https://github.com/olikraus/u8g2/wiki/fntlistall.

Note that the initial location for each line of text (for example in line 20): 

  u8g2.drawStr(0, 5, "Hello,");	 // write something to the internal memory 

The x and y coordinates (0,5) are for the bottom-left of the first character. 

If you want to display values, not text - such as integers, use: 

    u8g2.print();

 ... an example of which is show around line 49 in the example sketch. 

Where to from here?

Now it's time for you to explore the library reference guide which explains all the various functions available to create text and graphics on the display, as well as the fonts and so on.

These can all be found on the right-hand side of the driver wiki page.

If you have a problem with your display from PMD Way, please email support@pmdway.com for technical and order support.

And to keep up to date with interesting news, tutorials offers and new products - interact with us on facebook, instagram, and twitter.

Previous article Tutorial – LED Real Time Clock Temperature Sensor Shield for Arduino
Next article Tutorial - Using Long Range 315MHz RF Wireless Transceivers with Arduino