0.96 OLED Display Tutorial for Beginners | I2C/IIC White Pixels | Step-by-Step Guide

Beginner's guide to 0.96-inch OLED Display with I2C/IIC 4-pin module, featuring an Arduino Nano.

In this guide, we’ll walk you through the process of connecting the 0.96 OLED display to the Arduino Nano, uploading a sample code to demonstrate its capabilities, and customizing the display with simple text using the I2C communication protocol. Let’s dive in!

Watch Complete Video on Youtube

About the OLED Display:

OLED displays are available in various sizes and colours. In this tutorial, we’re using a white-coloured 0.96” OLED display with a resolution of 128×64 pixels. This display is perfect for showing text, graphics, and even small animations!

Components You’ll Need:

Before getting started, ensure you have the following components:

Arduino Nano

0.96” I2C OLED Display Module

Breadboard

Jumper wires

Step 1: Connecting the OLED Display

We’ll be using the Arduino Nano, a compact and versatile microcontroller, to control the OLED display. You may use any Microcontroller including all other Arduino or ESP boards.

Here’s how to connect it with Nano Board:

1. OLED VCC to Arduino 5V

2. OLED Ground to Arduino Ground

3. OLED SDA to Arduino A4

4. OLED SCL to Arduino A5

Step 2: Setting Up the Arduino IDE

Next, let’s move to the programming part. Open your Arduino IDE and install the necessary libraries for the OLED display.

1. Go to ‘Sketch’ > ‘Include Library’ > ‘Manage Libraries’.

2. In the Library Manager, search for ‘Adafruit_SSD1306’ and click ‘Install’.

3. Similarly, search for ‘Adafruit_GFX’ and install it.

You may also simply download the zip files from below and include zip library in Arduino IDE

Note: If you’re new to using the Arduino Nano, we recommend checking out our Beginner’s Tutorial first. You can check the following getting started with Nano Video:

Getting Started with Arduino Nano

Step 3: Running the Example Code

Now, let’s start with an example code. In the Arduino IDE, go to:

‘File’ > ‘Examples’ > ‘Adafruit SSD1306’ > ‘ssd1306_128X64_i2c’

This will open the sample code. Depending on your specific microcontroller and OLED display model, you might need to adjust the code slightly:

1. Simply replace the Screen Address to 0X3C from current 0X3D

After making these changes, upload the code to your Arduino Nano to see the OLED display in action!

With the code successfully uploaded you should see the display initializing with Adafruit logo and then demonstrating all its capabilities, now we can head to customizing the display and printing a custom text on our OLED

Step 4: Customizing the Display

Let’s customize the code to display a personalized message:

1. Include the necessary libraries for I2C communication and graphics like before.

2. Define the screen width and height of the OLED display.

3. Initialize the OLED display in the ‘setup()’ function and verify that it’s working correctly.

4. Clear the display buffer, set the text size, and colour the text in white.

5. Display the text ‘Hello OLED!’ at position (0, 0) on the screen.

6. Finally, render the content on the OLED display using ‘display.display()’.

Upload the updated code (refer above) to your Arduino Nano, and voilà! You should see the text “Hello OLED!” displayed on the screen.

Conclusion:

With this setup, you can easily integrate the OLED display into your Microcontrollers projects and add visual feedback to your designs. The code is highly customizable, allowing you to display other text, graphics, or even create small animations—the possibilities are endless!

Thanks for following along with this tutorial on the 0.96” I2C OLED Display Module with Arduino Nano. If you have any questions or suggestions, feel free to leave them in the comments. Happy tinkering!

Categories :
Share This :

Leave a Reply

Your email address will not be published. Required fields are marked *

Search Post

Recent Post