Introduction: A Tiny Display with Powerful Control Using SPI
Imagine having a small, sharp, glowing screen sitting on your breadboard — displaying exactly the text, numbers, or graphics that your Arduino Nano tells it to — responding almost instantly to every command your program sends.
That is what you get when you combine an Arduino Nano with a 0.96-inch SPI OLED display.
In a previous guide here on Vidumina STEM Zone, we connected an OLED display using I2C communication — a two-wire protocol that is simple and convenient. Today we are going one step further. We are going to use SPI communication — a faster, more direct protocol that uses more wires but gives you greater control and speed over your display.
If that sounds more complicated, do not worry. By the end of this guide, you will understand exactly what SPI is, how to wire it correctly, what every pin does, and how to write code that displays a custom message on your OLED screen. Everything is explained from the very beginning, step by step, in plain English.
The project goal is straightforward: connect a 0.96-inch SSD1306 OLED display to an Arduino Nano using SPI, write a simple program, and display the message "Welcome Vidumina STEM Zone" on the screen.
Let us build it.

What You Will Build
By the time you reach the end of this guide, you will have a working electronic circuit where an Arduino Nano communicates with a small OLED display using the SPI protocol. The display will show three lines of text:
Welcome
Vidumina
STEM Zone
The top line will appear in larger text, and the two lines below will be in a smaller, readable size — exactly like a welcome screen on a mini device.
Once you understand how this works, you can replace that static text with live sensor readings, countdown timers, temperature values, battery levels, or anything else your imagination and projects require. This project is a foundation skill that appears in robotics, IoT devices, wearable electronics, and countless other real-world applications.
Components Used


Before touching a single wire, let us identify everything you need. This project is intentionally simple — just a few components and a USB cable to your computer.
Arduino Nano The controller and brain of the project. The Nano is compact, breadboard-friendly, and runs the SPI communication hardware directly through its dedicated hardware pins. It executes your program and drives the entire display system.
0.96-inch SPI OLED Display — SSD1306 This is the star of the project. It is a small rectangular display module — 0.96 inches measured diagonally — based on the SSD1306 driver chip. Unlike the I2C version which has four pins, the SPI version has seven pins: VCC, GND, SCK, MOSI, CS, DC, and RST. The screen has a resolution of 128×64 pixels and produces crisp white text on a deep black background thanks to OLED technology.
Important distinction: When purchasing an SSD1306 OLED, check the number of pins carefully. Four-pin modules use I2C. Seven-pin modules use SPI. This guide is specifically for the seven-pin SPI version.
Breadboard The standard white prototyping board that lets you build circuits without soldering. Both the Arduino Nano and the OLED module insert into the breadboard rows, and jumper wires connect the appropriate pins.
Jumper Wires Seven short wires — one for each pin on the OLED display. Using different colours helps enormously when debugging connections: red for power, black for ground, and distinct colours for each of the five data and control pins.
USB Cable — Mini-B or Micro-B For connecting the Arduino Nano to your computer to upload the program.
What is SPI Communication? (The Simple Explanation)
Before connecting a single wire, it is worth understanding what SPI actually is — because understanding the protocol helps you understand why each wire exists and what it is doing.
SPI stands for Serial Peripheral Interface. It is a communication protocol invented by Motorola in the 1980s that allows a controller — in our case, the Arduino Nano — to communicate with one or more peripheral devices — in our case, the OLED display — using a set of dedicated wires.
The Master and Slave Concept
SPI uses a simple hierarchy. There is always one Master device that controls the communication — this is the Arduino Nano. There are one or more Slave devices that respond to the master's commands — this is the OLED display.
The master decides when communication happens, what speed it happens at, and which slave it is talking to. Slaves never initiate communication on their own — they only respond when the master addresses them. This is similar to a classroom where the teacher (master) calls on students (slaves) to respond. Students do not just start talking on their own — they wait to be called.
The Five SPI Wires
This is where SPI differs most visibly from I2C. While I2C uses just two wires (SDA and SCL), SPI uses five wires for full communication. Each wire has a specific, dedicated job.
MOSI — Master Out Slave In This is the data wire. When the Arduino Nano wants to send data to the OLED display, that data travels along the MOSI wire. The name tells you the direction: Master sends out, Slave receives in.
SCK — Serial Clock This wire carries the timing signal — a steady pulse that tells the OLED display exactly when to read each bit of data arriving on the MOSI wire. Without the clock, the display would not know when one bit ends and the next begins. The master (Arduino Nano) generates this clock signal.
CS — Chip Select This wire tells the OLED display "I am talking to you right now." When the Arduino pulls the CS pin LOW, the display knows it is the intended recipient and starts paying attention. When CS goes HIGH again, the display knows the transmission is over. In systems with multiple SPI devices, each device gets its own CS pin — this is how the master selects which slave it wants to communicate with at any given moment.
DC — Data/Command This is a control wire specific to display modules and some other devices. It tells the OLED whether the data arriving on the MOSI wire is a command (instructions about how to configure the display) or data (actual pixel information to show on screen). When DC is LOW, the display interprets incoming bytes as configuration commands. When DC is HIGH, it interprets them as display data.
RST — Reset This wire resets the OLED display to its default startup state. When the Arduino pulls RST LOW briefly during initialisation, it clears any previous configuration from the display and starts fresh. This is similar to pressing the restart button on a computer — it ensures the display begins from a known clean state every time.
How SPI Compares to I2C
If you have read our previous guide on I2C OLED displays on Vidumina STEM Zone, you might be wondering — if I2C works with just two wires, why use SPI with five?
The answer is speed and directness.
I2C is a shared bus protocol. Multiple devices can share the same two wires, and devices are identified by their addresses. This is elegant and pin-efficient, but there is overhead involved in addressing — every transmission must include the device address before data can flow.
SPI has no addressing overhead. The CS pin directly selects the device, and data flows immediately without any preamble. The clock can also run significantly faster in SPI than in standard I2C. For displays, this means SPI can refresh the screen more quickly, which matters for animations, fast-changing sensor data, or graphic-heavy content.
The trade-off is pin usage. I2C uses 2 pins. SPI uses 5 pins. For projects where pins are limited (like on the Arduino Nano), I2C is often more convenient. For projects where display speed matters, SPI is the better choice.
Simple rule: Use I2C when you need to save pins or connect multiple devices easily. Use SPI when you need maximum display speed and have pins available.
Pin Connections — Wiring the SPI OLED to Arduino Nano
This is the most critical section. Every wire must connect to exactly the right pin. Study this table carefully and verify each connection against your physical components before powering on.
Complete Wiring Table
| OLED Pin | OLED Label | Arduino Nano Pin | Wire Colour (Suggested) | Purpose |
|---|---|---|---|---|
| 1 | VCC | 5V | Red | Power supply |
| 2 | GND | GND | Black | Ground reference |
| 3 | SCK | D13 | Yellow | SPI Clock signal |
| 4 | MOSI | D11 | Blue | SPI Data — Nano to OLED |
| 5 | CS | D10 | Orange | Chip Select — activates OLED |
| 6 | DC | D9 | Green | Data or Command selector |
| 7 | RST | D8 | Purple | Reset signal |
Why These Specific Pins?
Pins D13 and D11 are not arbitrary choices. On the Arduino Nano, D13 is the hardware SCK pin and D11 is the hardware MOSI pin — these are the Nano's dedicated SPI hardware pins built into the ATmega328P chip. Using these pins allows the SPI communication to run at full hardware speed using the dedicated SPI module inside the chip.
Pins D10, D9, and D8 for CS, DC, and RST are configurable — you can use almost any digital pin for these control functions. D10, D9, and D8 are simply convenient choices that work well and are easy to remember. Note that in your code, you must tell the library which pins you chose for CS, DC, and RST.
Circuit Explanation — How Data Flows from Nano to OLED
Understanding the flow of data in your circuit helps you troubleshoot problems and build more complex projects later.
When you power on the circuit, the Arduino Nano first performs a hardware reset on the OLED display. It does this by pulling the RST pin LOW for a brief moment then releasing it HIGH. This wipes the display's internal configuration registers and starts it fresh — like clearing a whiteboard before writing on it.
Next, the Nano sends a series of configuration commands to the OLED. It pulls the CS pin LOW to select the display, sets DC LOW to indicate these are commands (not pixel data), and then sends bytes of configuration data over the MOSI line. These bytes tell the OLED things like: which way to scan the pixels, what contrast level to use, and how to map the display's internal memory to the physical pixel grid. The SCK line pulses with each bit of data, telling the display exactly when to read each bit.
Once configuration is complete, the Nano switches DC HIGH to indicate that what follows is actual display data — pixel information. It sends the entire 128×64 pixel buffer over MOSI, one bit at a time, clocked by SCK. The SSD1306 chip receives this stream of bits and sets each of its 8,192 pixels accordingly — on or off, white or black.
The entire process happens so fast that from your perspective it appears instantaneous. The display simply lights up with your text the moment the program runs.
Because SPI is a direct point-to-point connection with no addressing overhead, this data transfer is significantly faster than the equivalent I2C transfer. For static text like our welcome message, this speed difference is not noticeable. But for projects that update the display many times per second — showing live sensor readings or animations — SPI makes a visible difference.
Library Installation
Just like with the I2C version, you need two Adafruit libraries to drive the SPI OLED display. The good news is that these are the exact same libraries — the Adafruit SSD1306 library supports both I2C and SPI modes, and you switch between them by how you initialise the display object in your code.
How to Install
Step 1 — Open the Arduino IDE on your computer
Step 2 — Click Sketch in the top menu bar
Step 3 — Select Include Library → Manage Libraries
Step 4 — The Library Manager window opens. In the search box, type SSD1306
Step 5 — Find "Adafruit SSD1306" by Adafruit Industries in the results list
Step 6 — Click Install
Step 7 — A dialog box appears asking if you want to install dependencies. Click Install All — this also installs the Adafruit GFX Library which is required
Step 8 — Wait for both libraries to finish installing — approximately 30 to 60 seconds
Step 9 — Close the Library Manager
Both libraries are now installed. You will not need to do this again unless you reinstall the Arduino IDE or switch to a new computer.
The Complete Arduino Code
Here is the full working code for your SPI OLED project. Copy this exactly into a new Arduino IDE sketch, verify it compiles without errors, then upload it to your Nano.
// ============================================================
// SPI OLED Display with Arduino Nano
// Display: SSD1306 0.96 inch SPI OLED (7-pin)
// Displays: Welcome Vidumina STEM Zone
// Board: Arduino Nano (ATmega328P)
//
// Pin Connections:
// OLED VCC → Nano 5V
// OLED GND → Nano GND
// OLED SCK → Nano D13
// OLED MOSI → Nano D11
// OLED CS → Nano D10
// OLED DC → Nano D9
// OLED RST → Nano D8
//
// Libraries Required:
// Adafruit SSD1306
// Adafruit GFX Library
//
// Vidumina STEM Zone — vidumina.lk
// ============================================================
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// ---- Display Dimensions ----
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// ---- SPI Control Pin Definitions ----
#define OLED_CS 10 // Chip Select
#define OLED_DC 9 // Data / Command
#define OLED_RST 8 // Reset
// ---- Create SPI Display Object ----
// Parameters: width, height, SPI bus, DC pin, RST pin, CS pin
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
&SPI, OLED_DC, OLED_RST, OLED_CS);
void setup() {
// Start Serial Monitor for debugging
Serial.begin(9600);
Serial.println("Initialising SPI OLED Display...");
// Initialise the display
// SSD1306_SWITCHCAPVCC = generate display voltage internally
if (!display.begin(SSD1306_SWITCHCAPVCC)) {
Serial.println("ERROR: SSD1306 display not found.");
Serial.println("Check all 7 wires and pin definitions.");
while (true); // Halt — do not continue if display missing
}
Serial.println("Display initialised successfully.");
// Clear the display buffer
display.clearDisplay();
// =============================================
// LINE 1: "Welcome" — Large text, top of screen
// =============================================
display.setTextSize(2); // Size 2 = double pixels
display.setTextColor(SSD1306_WHITE); // White text on black
display.setCursor(8, 4); // X=8 pixels, Y=4 pixels from top
display.println("Welcome");
// =============================================
// LINE 2: "Vidumina" — Medium text, middle
// =============================================
display.setTextSize(1); // Size 1 = standard small
display.setTextColor(SSD1306_WHITE);
display.setCursor(22, 30); // Move down to middle area
display.println("Vidumina");
// =============================================
// LINE 3: "STEM Zone" — Medium text, bottom area
// =============================================
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(22, 46); // Move further down
display.println("STEM Zone");
// =============================================
// SEND BUFFER TO PHYSICAL DISPLAY
// Nothing shows on screen until this is called
// =============================================
display.display();
Serial.println("Message displayed successfully.");
}
void loop() {
// Static display — nothing needed in loop
// To add live updates, sensor readings, or animations,
// add code here and call display.display() again
// after each update
}
Code Explanation — Understanding Every Important Part
You do not need to understand every line in detail on your first attempt. But knowing what the key parts do will help you modify this code confidently for your own projects.
The Include Lines
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Three libraries are included this time instead of two. SPI.h is built into the Arduino IDE and provides the hardware SPI bus functionality — it handles the low-level timing and data transfer on pins D11 and D13. Adafruit_GFX.h provides the text and graphics drawing functions. Adafruit_SSD1306.h provides the display-specific commands that the SSD1306 chip understands.
Pin Definitions
#define OLED_CS 10
#define OLED_DC 9
#define OLED_RST 8
These three lines define which Arduino pins control the CS, DC, and RST functions of the OLED. Defining them at the top of your code makes it easy to change them if needed — you update one line instead of hunting through the entire code.
Creating the Display Object — SPI Mode
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &SPI, OLED_DC, OLED_RST, OLED_CS);
This line is the key difference between SPI and I2C mode. In the I2C version, you passed only the screen dimensions and reset pin. Here you pass the screen dimensions, a reference to the SPI bus (&SPI), and then the three control pin numbers — DC, RST, and CS in that order. This tells the library to use hardware SPI and which pins handle each control function.
Initialisation
if (!display.begin(SSD1306_SWITCHCAPVCC)) {
This initialises the display. SSD1306_SWITCHCAPVCC tells the library to use the display's internal charge pump to generate the voltage needed to drive the OLED pixels. Notice that unlike the I2C version, there is no I2C address parameter here — SPI does not use addresses because the CS pin handles device selection directly.
If the display does not respond, the function returns false, the error message prints to Serial Monitor, and the program halts. This is your first debugging tool — always check the Serial Monitor when your display does not work.
Text Drawing Functions
display.setTextSize(2);
display.setTextColor(SSD1306_WHITE);
display.setCursor(8, 4);
display.println("Welcome");
These four functions work together to place text on the display buffer.
setTextSize(2) sets the character scale. At size 1, each character is 6 pixels wide and 8 pixels tall. At size 2, characters are 12 pixels wide and 16 pixels tall — noticeably larger. At size 3, they are 18×24 pixels. For a 128×64 display, size 1 fits about 21 characters per line and 8 lines vertically. Size 2 fits about 10 characters per line and 4 lines.
setTextColor(SSD1306_WHITE) sets the text colour. On a monochrome OLED, white simply means the pixels are lit. You can also use SSD1306_BLACK to draw black (unlit) text on a white background if you invert the display mode.
setCursor(8, 4) moves the invisible text cursor to a specific pixel position. The first number is the horizontal position measured from the left edge. The second is the vertical position measured from the top edge. Pixel (0, 0) is the top-left corner.
display.println("Welcome") writes the text string to the memory buffer and advances the cursor to the next line. Nothing appears on the physical screen yet.
You can modify these words as your desire.
The Critical Final Step
display.display();
This single function call is what makes everything visible. Everything before this line — all the text drawing, cursor positioning, size settings — happens only in a buffer stored in the Arduino's RAM. The display.display() function takes that entire buffer and transmits it to the OLED via SPI, setting each of the 8,192 pixels on the physical screen.
If you forget this line, your display will be blank. Every time you want the screen to update, you must call display.display() again.
How It Works — The Complete Flow
Tracing exactly what happens from the moment you power on the circuit to the moment text appears on screen helps build a solid mental model for future projects.
Power On — The Arduino Nano receives power through USB. Its bootloader runs briefly, then execution begins at the top of setup().
Serial Initialisation — Serial.begin(9600) opens the serial port so debug messages can be read in the Arduino IDE's Serial Monitor.
Reset Sequence — display.begin() starts by pulling the RST pin LOW for a short pulse, then releasing it HIGH. This resets the SSD1306 chip to its default state, clearing any previous configuration.
SPI Configuration Commands — The library sends a sequence of configuration commands to the display via MOSI and SCK, with DC held LOW to indicate these are commands. These commands set the display orientation, contrast, scan direction, and pixel mapping.
Display Activation — The display is switched on and begins showing its blank (all black) state.
Buffer Drawing — Your code calls the text drawing functions which write pixel patterns into a 1024-byte array in the Nano's RAM — one bit per pixel for 128×64 pixels.
Buffer Transfer — display.display() pulls CS LOW to select the OLED, sets DC HIGH to indicate pixel data follows, then transmits all 1024 bytes over the SPI bus via MOSI, clocked by SCK. The SSD1306 receives each byte and updates its internal pixel memory accordingly.
Text Appears — The OLED pixels light up according to the data received, and your text glows white on the black screen. The display holds this image indefinitely without needing further data — the pixels stay in their set state until new data arrives.
Loop Starts — loop() begins running but contains no code, so the display simply continues showing the same static message until the power is removed or new code is uploaded.
Common Mistakes and How to Fix Them
SPI has more connections than I2C, which means more opportunities for wiring errors. Here are the mistakes that catch beginners most often, along with clear fixes.
Mistake 1 — MOSI and SCK Wires Swapped This is the most common SPI wiring error. MOSI must connect to D11 and SCK must connect to D13 — not the other way around. If these are swapped, the display receives malformed data and shows nothing. The fix is straightforward: unplug and recheck both wires against the wiring table above.
Mistake 2 — Incorrect CS, DC, or RST Pin Numbers in Code
You can physically wire CS to D10, DC to D9, and RST to D8 correctly — but if your code says #define OLED_CS 7 instead of #define OLED_CS 10, the library controls the wrong pin and the display does not respond. Always verify that the #define lines in your code match the actual physical connections.
Mistake 3 — Using I2C Library Initialisation for SPI
If you previously used the I2C OLED example and copy-pasted the display object creation line, it will use I2C mode rather than SPI mode. The SPI version requires &SPI as the third parameter and the three pin definitions for DC, RST, and CS. A display object created without &SPI will attempt I2C communication and find nothing, causing the initialisation to fail.
Mistake 4 — Forgetting display.display()
This catches even experienced users after a long coding session. All text and graphics functions write to the RAM buffer only. Until display.display() is called, the physical screen shows nothing new. If you add text in your code and it does not appear, check that you have called display.display() after your drawing commands.
Mistake 5 — Not Installing All Required Libraries
The code requires three libraries: SPI.h (built in — no installation needed), Adafruit GFX Library, and Adafruit SSD1306. If either Adafruit library is missing, the code will fail to compile with errors like "No such file or directory." Go to Library Manager, search for each one, and install them with their dependencies.
Mistake 6 — Loose Breadboard Connections on Power Pins A loose VCC or GND wire causes the display to flicker, show garbage, or not initialise at all. With seven wires going into a breadboard, it is easy for one to sit slightly incorrectly. Press each wire firmly into its hole and give each one a gentle tug to confirm it is seated properly before powering on.
Mistake 7 — Using a 3.3V Pin for VCC While the SSD1306 can technically operate at 3.3V, some SPI OLED modules are designed specifically for 5V. If your module has a voltage regulator on board (which most breakout modules do), use 5V. If your display shows very faint or invisible content, check whether it is receiving adequate voltage.
Real-World Applications
Mastering SPI OLED display control opens up a wide range of practical project possibilities. Here are applications that directly build on what you have learned.
Live Sensor Dashboard Connect a DHT22 temperature and humidity sensor to your Arduino Nano alongside the SPI OLED. Display both readings on the screen, updating every second. The speed advantage of SPI means the display refreshes smoothly without any visible lag. Label each reading clearly on screen — "Temp: 28C" on one line, "Humidity: 65%" on another.
Mini Robot Status Display Mount an Arduino Nano and SPI OLED on a small wheeled robot. Display the robot's current mode (forward, turning, stopped), distance reading from an ultrasonic sensor, and battery voltage. Because SPI updates faster than I2C, the display keeps up even as values change rapidly during movement.
Portable Scientific Instrument Build a handheld device that reads from a pressure sensor, calculates altitude, and displays both values on the OLED. Add a small LiPo battery and a power switch. The resulting device is a functional altimeter that you built and programmed yourself.
Smart Classroom Timer Display a countdown timer on the OLED for classroom activities. Show the remaining minutes and seconds in large text that is visible from across a room. Add a buzzer that sounds when time expires. This connects directly to the smart classroom system concept explored in other Vidumina STEM Zone projects.
Menu-Driven Interface Add three push buttons to your circuit — up, down, and select. Use the SPI OLED to display a scrollable menu system. Navigate between options and display results or trigger actions based on the selection. This technique is used in everything from commercial electronic devices to DIY synthesisers and data loggers.
Weather Station Display Combine a BMP280 barometric pressure sensor, a DHT22 for temperature and humidity, and the SPI OLED for a three-value weather display. Show temperature, humidity, and atmospheric pressure on separate lines of the screen, updating every few seconds with fresh readings.
Conclusion: More Wires, More Power, More Control
The SPI OLED display takes a little more wiring than its I2C cousin — seven connections instead of four — but it rewards that extra effort with faster data transfer, more direct control, and a deeper understanding of how serial communication protocols actually work in real electronics.
You have now learned two of the most important communication protocols in embedded electronics: I2C and SPI. You understand what Master and Slave mean, what each SPI wire does, how the CS pin selects a device, and how the DC pin distinguishes between commands and data. These are not just facts about this one project — they are foundational concepts that appear in virtually every advanced Arduino and embedded systems project.
More importantly, you have built something that works. Your Arduino Nano is sending data down an SPI bus to a driver chip that is lighting up individual pixels on an organic LED matrix to form characters that carry a message you chose. Every layer of that process is now something you understand.
From here, the possibilities multiply quickly. Swap the static text for a live temperature reading. Add a second SPI device — an SD card module, for example, which also uses SPI. Create a scrolling animation. Draw shapes and icons alongside text. Build a complete graphical interface.
Every one of those next steps uses exactly the same principles you learned today. The screen is 0.96 inches wide. What you can build with it is not limited at all.
Keep experimenting. Keep building. Vidumina STEM Zone will be here with the next step whenever you are ready.
Frequently Asked Questions (FAQ)
Q1: What exactly is SPI and how is it different from regular serial communication? SPI stands for Serial Peripheral Interface. Like regular serial communication (UART), it sends data one bit at a time over a wire. The key differences are that SPI uses a dedicated clock wire (SCK) to synchronise the transfer precisely, uses separate wires for sending and potentially receiving data, and uses a Chip Select wire to choose which device is being addressed. This makes SPI faster and more reliable than UART for high-speed device communication, and far faster than I2C for display updates. Regular UART serial (like the Serial Monitor connection) is designed for longer-distance, lower-speed communication. SPI is designed for short-distance, high-speed chip-to-chip communication on the same circuit board.
Q2: Why does SPI use more wires than I2C if they both do the same job? They do a similar job but with different design priorities. I2C was designed to connect many devices efficiently using as few wires as possible — it achieves this through addressing, where each device has a unique ID and the master calls it by that ID. The addressing adds a small amount of overhead to every transmission. SPI was designed for maximum speed and simplicity of transfer — it uses a dedicated CS wire to select each device directly, eliminating all addressing overhead. The result is faster data transfer at the cost of more wires. For displays that need to refresh quickly, SPI's speed advantage is worth the extra wiring. For sensor networks where many devices share a bus and speed is less critical, I2C's efficiency wins.
Q3: Can I use this exact code and wiring with an Arduino UNO instead of a Nano? Yes, with the wiring staying identical. On the Arduino UNO, the hardware SPI pins are D13 (SCK), D11 (MOSI), and D10 (SS/CS) — exactly the same pin numbers as on the Nano. This is because both boards use the same ATmega328P microcontroller chip. The DC and RST pins — D9 and D8 in this project — are also the same on both boards. So you can transfer this project from a Nano to a UNO by simply moving the components to the UNO without changing a single line of code. The UNO does not fit into a breadboard as neatly as the Nano, but the electrical connections are identical.
Q4: My previous OLED project used I2C. When should I choose SPI over I2C? Choose I2C when you want to minimise pin usage, when you need to connect multiple devices to the same bus easily, or when display refresh speed is not a priority. The four-wire I2C OLED is ideal for beginner projects, sensor displays, and systems where many I2C devices coexist. Choose SPI when you need the fastest possible display refresh rate, when you are displaying rapidly changing values or animations, or when you simply have enough pins available and want the most direct connection possible. For the "Welcome Vidumina STEM Zone" static text display, I2C would work equally well. But as your projects grow more complex and dynamic, SPI becomes increasingly valuable.
Q5: My display shows nothing and the Serial Monitor says the display was not found. How do I debug this step by step?
Follow this systematic approach. First, check all seven physical wire connections against the wiring table — a single incorrect connection prevents everything from working. Second, verify your code's #define lines match the actual pins you used for CS, DC, and RST. Third, make sure you are using the SPI version of the display object constructor — it must include &SPI as the third argument. Fourth, confirm both Adafruit libraries are installed by checking Sketch → Include Library for their names. Fifth, try a different USB cable or USB port — sometimes the Nano is not receiving the uploaded code properly. Sixth, check that your breadboard connections are firm by pressing each wire in and giving a gentle tug. If after all these checks the display still does not respond, try swapping the OLED module with a known working one if available — occasionally a module arrives defective from manufacturing.
Tags: Arduino Nano, SPI OLED display, SSD1306 SPI, I2C vs SPI, beginner electronics, Arduino tutorial, OLED display project, SPI communication, STEM projects, Arduino display, Vidumina STEM Zone
Published on Vidumina STEM Zone — Explore Science, Technology, Engineering & Mathematics
Comments (0)
Be the first to leave a comment on this article!
Leave a Comment