October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Generate and Simulate a QR Code on an Arduino SSD1306 OLED

An SSD1306 OLED needs a QR encoder plus a drawing library. Here’s how to fit and center the matrix, match the display hardware, and simulate frames on a host.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To show a QR code on an Arduino SSD1306 OLED, use two parts: a QR encoder to create the symbol and an Adafruit_GFX-compatible renderer to draw its modules on the display. QRCodeGFX is one option and explicitly supports Adafruit_SSD1306. To test without the physical screen, use a host-side SSD1306 emulator that captures or renders display frames; that is different from assuming a browser simulator reproduces Arduino hardware behavior.

What you need to generate a QR code on an SSD1306

The SSD1306 is the display driver, not a QR generator. Your sketch needs a QR encoder as well as the display library. The QRCodeGFX library connects QR-code drawing to displays that inherit from Adafruit_GFX, including Adafruit_SSD1306. The Arduino Project Hub example combines Wire.h, Adafruit_GFX.h, Adafruit_SSD1306.h and qrcode.h.

As an Amazon Associate I earn from qualifying purchases.

  • QR encoding: a QRCode/qrcodegen engine creates the module matrix.
  • Display control: Adafruit_SSD1306 manages the SSD1306 OLED over I2C or SPI.
  • Drawing: QRCodeGFX or a comparable Adafruit_GFX-compatible renderer draws the matrix. Alternatively, the Hub example paints active modules as rectangles.

Install and include libraries compatible with your board and sketch. The documented support establishes the display sizes and interfaces described below, but does not establish a single library version or exact board configuration for every Arduino.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to fit and center the QR matrix

Use the actual QR matrix size and the OLED dimensions to choose an integer number of pixels per module. For a 128×64 display, the example’s calculation is scale = min(128 / qrcode.size, 64 / qrcode.size). Integer division keeps the modules aligned to whole pixels. If the result is zero, that matrix cannot be rendered at even one pixel per module at the chosen dimensions.

#1 Best Overall
ELEGOO 0.96 Inch OLED Display Screen Module, Self-Luminous, SSD1306, 3PCS
  • Three Displays For More Projects: Build a sensor dashboard, robot status panel and classroom demo at the same time, or keep spare modules ready for testing; each compact screen delivers 128x64 graphics with self-luminous pixels and no backlight
  • Fixed Yellow-Blue Zones Make Status Information Easy To Scan: Use the yellow upper band for headings, alerts or icons and the blue lower area for readings and menus; the display colors are fixed by the OLED panel rather than programmable RGB, and the screen does not support touch input
  • Four-Wire I2C Connection Saves Controller Pins: Connect GND, VCC, SCL and SDA according to the module labels, scan the I2C bus and use the default 7-bit address 0x3C; the 0x78 PCB marking represents the corresponding 8-bit write-address format used by some documentation
  • Works With Common 3.3 V & 5 V Project Platforms: Add compact visual feedback to compatible microcontroller and single-board computer projects, but verify the module pin order, supply voltage, I2C logic levels, pull-up voltage and SSD1306 software configuration before powering
  • Three Modules Plus Ten Dupont Wires: Includes 3 OLED display modules, 5 female-to-female and 5 male-to-female jumper wires; controller boards, breadboards and enclosures are not included, and multiple displays on one I2C bus require unique addresses where supported or an I2C multiplexer
  1. Generate the QR matrix and read its side length, qrcode.size.
  2. Calculate the scale as the smaller of the width-based and height-based integer fits.
  3. Calculate the unused space: shiftX = (128 - qrcode.size * scale) / 2 and shiftY = (64 - qrcode.size * scale) / 2.
  4. For each active module, draw a filled square of scale pixels per side at the offset position.
  5. Send the completed display buffer to the OLED with the display library’s update call; the Hub example calls display.display().

This preserves square modules and centers the matrix rather than stretching it to fill the panel. The example’s dimensions and initialization address are specific to its 128×64 setup: it initializes the display at I2C address 0x3C. Check the address and bus for the particular module rather than assuming that value applies to every board.

Which SSD1306 display configuration fits?

Adafruit_SSD1306 documents support for monochrome 128×64 and 128×32 SSD1306 OLEDs over I2C and SPI. A common direct hardware choice for reproducing the example is a 0.96-inch I2C SSD1306 module in 128×64 form, but the controller, resolution, interface, voltage level and address must match the board and sketch.

Rank #2
Hosyond 5 Pcs 0.96 Inch OLED I2C IIC Display Module 12864 128x64 Pixel SSD1306 Mini Self-Luminous OLED Screen Board Compatible with Arduino Raspberry Pi (White)
  • 0.96 inch,Resolution: 128 x 64, View angle: > 160°, Support voltage: 3.3V-5V DC, Power consumption: 0.04W during normal operation, full screen lit 0.08W
  • Embedded Driver IC: SSD1306. Communication: I2C/IIC Interface, only need two I / O ports
  • It compatibles with Arduino Nano, R3 board and Mega, Raspberry pi, 51 MCU, STIM 32, etc.
  • No backlight is required, and the display unit can be self-luminous. It has ultra-high contrast, bright and clear dots, and it is easy to read even small fonts
  • There are no fonts embedded in the OLED controller, users can create fonts through font generation software.
Choice or check What is established What to verify
128×64 versus 128×32 Both monochrome sizes are supported by Adafruit_SSD1306. The 128×64 panel has twice the pixel area of 128×32. Whether the QR matrix fits at a useful integer scale on the selected panel.
I2C versus SPI The library supports both interfaces. The module’s actual interface, wiring and sketch configuration; an I2C address applies only to an I2C connection.
Common physical example A 0.96-inch I2C SSD1306 module, commonly in 128×64 form, is the direct match for the Hub example’s screen dimensions. Controller, resolution, voltage level, wiring and the module’s I2C address.
QR version and data length The example selects a QR version and computes its display fit from the resulting matrix size. The specific encoder’s capacity and the space available after choosing the QR content and screen.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to simulate the display without OLED hardware

The documented SSD1306 emulator options are host-side tools: they can capture display frames as numbered PNG files, assemble frames into an animated GIF, or render them through pygame. The Adafruit_SSD1306_EMULATOR project describes forwarding display bytes over serial for a host emulator to process. These approaches let you inspect drawing output during development, but they do not establish that a browser simulator reproduces Arduino timing, wiring or electrical conditions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Choose an emulator workflow that supports your display output: frame capture, GIF assembly or interactive rendering through pygame.
  2. Configure the sketch and host emulator to exchange display data using that tool’s documented method. The serial-forwarding approach is described by Adafruit_SSD1306_EMULATOR.
  3. Inspect the captured or rendered frames for the matrix’s placement, scale and clipping.
  4. Test on the intended OLED and board to confirm the actual wiring, address and hardware behavior.

The emulator documentation establishes those rendering approaches, not a universal setup command or a guarantee that every Arduino board and sketch works unchanged with every emulator.

Quick Recap

Bestseller No. 2
Hosyond 5 Pcs 0.96 Inch OLED I2C IIC Display Module 12864 128x64 Pixel SSD1306 Mini Self-Luminous OLED Screen Board Compatible with Arduino Raspberry Pi (White)
Hosyond 5 Pcs 0.96 Inch OLED I2C IIC Display Module 12864 128x64 Pixel SSD1306 Mini Self-Luminous OLED Screen Board Compatible with Arduino Raspberry Pi (White)
Embedded Driver IC: SSD1306. Communication: I2C/IIC Interface, only need two I / O ports; It compatibles with Arduino Nano, R3 board and Mega, Raspberry pi, 51 MCU, STIM 32, etc.
$14.99
Bestseller No. 3
UCTRONICS 0.96 Inch OLED Module 12864 128x64 Yellow Blue SSD1306 Driver I2C Serial Self-Luminous Display Board for Arduino Raspberry Pi Pico
UCTRONICS 0.96 Inch OLED Module 12864 128x64 Yellow Blue SSD1306 Driver I2C Serial Self-Luminous Display Board for Arduino Raspberry Pi Pico
Embedded Driver IC: SSD1306. Communication: I2C/IIC Interface, only need two I / O ports
$6.99
Bestseller No. 5
Hosyond 5 Pcs 0.96 Inch OLED I2C IIC Display Module 12864 128x64 Pixel SSD1306 Mini Self-Luminous OLED Screen Board Compatible with Arduino Raspberry Pi(Blue and Yellow)
Hosyond 5 Pcs 0.96 Inch OLED I2C IIC Display Module 12864 128x64 Pixel SSD1306 Mini Self-Luminous OLED Screen Board Compatible with Arduino Raspberry Pi(Blue and Yellow)
Embedded Driver IC: SSD1306. Communication: I2C/IIC Interface, only need two I / O ports; It compatibles with R3 board and Mega, Raspberry pi, 51 MCU, STIM 32, etc.
$14.98
Best Value
Hosyond 5 Pcs 0.96 Inch OLED I2C IIC Display Module 12864 128x64 Pixel SSD1306 Mini Self-Luminous OLED Screen Board Compatible with Arduino Raspberry Pi(Blue and Yellow)
  • 0.96 inch,Resolution: 128 x 64, View angle: > 160°, Support voltage: 3.3V-5V DC, Power consumption: 0.04W during normal operation, full screen lit 0.08W
  • Embedded Driver IC: SSD1306. Communication: I2C/IIC Interface, only need two I / O ports
  • It compatibles with R3 board and Mega, Raspberry pi, 51 MCU, STIM 32, etc.
  • No backlight is required, and the display unit can be self-luminous. It has ultra-high contrast, bright and clear dots, and it is easy to read even small fonts
  • There are no fonts embedded in the OLED controller, users can create fonts through font generation software.
Rank #4
ELEGOO 3PCS 0.96 Inch OLED Display Screen Module, Self-Luminous, SSD1306
  • Three White OLED Displays For More Projects: Build multiple sensor monitors, status panels or classroom demonstrations at the same time, or keep spare modules ready for testing; each 0.96-inch screen provides 128 × 64 pixels
  • White Monochrome OLED For Clear Status Information: Active pixels display white on the dark OLED panel for text, numbers, icons and simple graphics; the display color is fixed by the panel and the screen does not support touch input
  • Four-Wire I2C Connection Saves Controller Pins: Connect GND, VCC, SCL and SDA according to the module labels and use the default 7-bit I2C address 0x3C with compatible software libraries
  • 3.3–5 V Power For Controller Projects: Add compact visual feedback to compatible microcontroller and single-board-computer projects while verifying pin order, supply voltage, I2C logic levels, pull-up voltage and SSD1306 software configuration before powering
  • Three Modules Plus Ten Jumper Wires: Includes 3 OLED display modules, 5 female-to-female and 5 male-to-female jumper wires for prototyping; controller boards, breadboards, sensors, headers and enclosures are not included
Rank #3
UCTRONICS 0.96 Inch OLED Module 12864 128x64 Yellow Blue SSD1306 Driver I2C Serial Self-Luminous Display Board for Arduino Raspberry Pi Pico
  • UCTRONICS 0.96 Inch OLED Module for showing graphical & textual information directly on your micro-controller projects. It supports many chips: Arduino UNO and Mega, Raspberry pi, 51 MCU, STIM 32, etc., the UNO shown in the picture is NOT INCLUDE
  • Resolution: 128 x 64, View angle: > 160°, Support voltage: 3.3V-5V DC, Power consumption: 0.04W during normal operation, full screen lit 0.08W
  • Embedded Driver IC: SSD1306. Communication: I2C/IIC Interface, only need two I / O ports
  • Needn't backlight, the oled screen unit can self-luminous. It has Super High Contrast, bright and crisp dots, even tiny fonts quite readable
  • No embedded fonts inside the OLED controller, user can create the fonts through the font generation software. We offer technical support and software library as well as the guide book in the package. Note: the display part is 15mm±0.5 tall.

Common reasons the QR does not appear as expected

  • The display is blank: confirm that the display library is configured for the panel’s resolution and interface, and that the I2C address or SPI wiring matches the hardware.
  • The matrix is clipped or off-center: calculate scale from both screen dimensions, then compute offsets from the remaining width and height. Do not use only the screen width on a shorter panel.
  • The QR is too small: the matrix size grows with the selected QR version and content. Recalculate the integer scale for the generated matrix rather than assuming a fixed module size.
  • The host image looks right but the physical display does not: frame emulation checks rendering output, not all electrical or timing conditions. Verify the board and OLED directly.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.