How to Connect an OLED Display to Arduino 🖥

How to Connect an OLED Display to Arduino 🖥 Beginner Robotics Project for Kids
🖥️ ROBOTICS FOR KIDS · LEVEL: BEGINNER

How to Connect an OLED Display to Arduino

Meet Pixel — your Arduino's new tiny screen! In just four wires, you can make an OLED display show text, shapes, and even simple animations. This is one of the best first projects for learning how Arduino talks to other parts.

⏱️ 30–45 minutes 🎂 Ages 8+ (with an adult) 🔌 Only 4 Wires!
VCC GND SDA SCL

✨ Say hi to Pixel, your Arduino's new screen!

What Is an OLED Display, Anyway?

An OLED (Organic Light-Emitting Diode) display is a tiny screen made of thousands of individual pixels that can each light up on their own — no backlight needed! That's why the black background looks so deep and the text glows so brightly. The most common beginner OLED is the 0.96 inch, 128x64 pixel SSD1306, and the best part is it only needs 4 wires to connect to an Arduino, using a communication method called I2C.

🧰

What You'll Need

This is a short parts list — one of the simplest projects to start with!

x1

Arduino Uno

Reads your code and sends data to the display.

x1

0.96" I2C OLED Display (SSD1306)

The 128x64 pixel screen — usually blue or white text on black.

x4

Jumper Wires

Male-to-female or male-to-male, depending on your breadboard setup.

x1

Breadboard (optional)

Handy for keeping wires tidy, though not strictly required.

x1

USB Cable

Connects your Arduino to the computer for uploading code.

🔌

The Circuit Diagram

Just four wires connect the OLED to your Arduino's I2C pins.

Arduino Uno UNO 5V GND A4 (SDA) A5 (SCL) OLED Display (SSD1306) VCC GND SDA SCL
Arduino 5V → OLED VCC Arduino GND → OLED GND Arduino A4 → OLED SDA Arduino A5 → OLED SCL
🛠️

Step-by-Step Instructions

This whole project can be done in under an hour!

1

Connect the four wires

Wire the OLED's VCC to Arduino's 5V, GND to GND, SDA to A4, and SCL to A5, exactly as shown in the circuit diagram above.

💡 Tip: Some OLED modules run on 3.3V instead of 5V — check the label on your specific module before powering it on.
2

Install the required libraries

In the Arduino IDE, open Tools → Manage Libraries, then search for and install Adafruit SSD1306 and Adafruit GFX Library.

3

Find your OLED's I2C address

Most 0.96" OLEDs use address 0x3C, but some use 0x3D. If your display stays blank later, try running an "I2C Scanner" sketch (searchable in the library examples) to find the correct address.

4

Upload the code below

Copy the code into a new sketch, double-check your wiring, and click Upload.

5

Watch Pixel come to life!

Your OLED should show text and a little smiley face animation. Try changing the text in the code and re-uploading to make it your own.

💻

The Arduino Code

Copy this code into the Arduino IDE, then click Upload. It shows a welcome message, then draws a simple animated face.

oled_display.ino
// 🖥️🤖 Pixel the OLED Display — Arduino Beginner Robotics Project
// Connects a 128x64 OLED and shows text plus a simple animated face

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_ADDRESS 0x3C  // change to 0x3D if your screen stays blank

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

void setup() {
  if (!display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDRESS)) {
    Serial.println("OLED not found — check your wiring!");
    while (true);  // stop here if the screen can't be found
  }

  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10, 25);
  display.println("Hi, I'm");
  display.setCursor(10, 45);
  display.println("Pixel!");
  display.display();
  delay(2000);
}

void loop() {
  drawFace(20);   // blink open
  delay(1000);
  drawFace(4);    // blink closed
  delay(200);
}

// Draws a simple round face with eyes of a given height (for blinking)
void drawFace(int eyeHeight) {
  display.clearDisplay();
  display.drawCircle(64, 32, 28, SSD1306_WHITE);           // face outline
  display.fillRoundRect(48, 24, 6, eyeHeight, 3, SSD1306_WHITE);  // left eye
  display.fillRoundRect(74, 24, 6, eyeHeight, 3, SSD1306_WHITE);  // right eye
  display.drawLine(50, 45, 78, 45, SSD1306_WHITE);        // smile
  display.display();
}
🧠

How Does Pixel Actually Work?

Here are the big ideas hiding inside this small project:

🔗

I2C: Talking with 2 Wires

SDA carries the actual data, while SCL is a timing "clock" wire that keeps both devices in sync — together they let dozens of devices share just two wires.

🖼️

A Screen Made of Pixels

The screen is a grid of 128 x 64 tiny lights. The Adafruit_GFX library gives you simple commands like drawCircle() instead of controlling each pixel by hand.

🎨

Draw, Then Display

Every drawing command actually changes a hidden "buffer" in memory first — nothing appears until you call display.display(), which pushes it all to the screen at once.

👁️

Animation with Timing

The "blink" is just two different pictures shown quickly one after another with a delay() in between — the same basic trick behind all animation.

🧑‍🔬 Safety First!

  • Double-check your OLED's voltage rating (3.3V or 5V) before connecting power — using the wrong voltage can damage the display.
  • Always disconnect power before changing any wiring.
  • Handle the OLED gently — the glass surface can crack if dropped or pressed too hard.
  • Ask an adult for help the first time you use the Arduino IDE's Library Manager.

Frequently Asked Questions

My screen stays completely blank — what's wrong?

Double-check all four wires first, then try changing OLED_ADDRESS from 0x3C to 0x3D (or vice versa) — different manufacturers sometimes use a different address.

Can I use pins other than A4 and A5?

On an Arduino Uno, A4 and A5 are the dedicated I2C pins (SDA and SCL) and generally shouldn't be changed. Other Arduino boards may have different dedicated I2C pins — check your board's pinout.

How do I show my own text?

Change the text inside the quotation marks after display.println() — for example, replace "Pixel!" with your own name, then re-upload.

What age group is this project good for?

This is one of the best beginner projects, great for kids around age 8 and up, especially as a first introduction to libraries and wiring.

🎉 Nice work — you just connected your first display and made it come alive! Try changing the text, size, or drawing your own shapes next.

⬆️ Back to Materials List

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course