

The Adafruit 128x64 OLED Bonnet (Manufacturer Part ID: 3531) is a compact, high-resolution OLED display module designed for use in embedded electronics projects. With a resolution of 128x64 pixels, it is ideal for displaying crisp text, detailed graphics, and animations. This module supports both I2C and SPI communication protocols, making it versatile and easy to integrate with microcontrollers and single-board computers like the Raspberry Pi.








The following table outlines the key technical details of the Adafruit 128x64 OLED Bonnet:
| Specification | Details |
|---|---|
| Manufacturer | Adafruit |
| Part ID | 3531 |
| Display Type | OLED (Organic Light Emitting Diode) |
| Resolution | 128x64 pixels |
| Communication Protocols | I2C, SPI |
| Operating Voltage | 3.3V to 5V |
| Current Consumption | ~10mA (varies with brightness and usage) |
| Dimensions | 2.4" x 1.3" x 0.2" (61mm x 33mm x 5mm) |
| Weight | 8.5g |
The Adafruit 128x64 OLED Bonnet features the following pin configuration:
| Pin Name | Description |
|---|---|
| VIN | Power input (3.3V to 5V) |
| GND | Ground |
| SCL | I2C Clock Line |
| SDA | I2C Data Line |
| Pin Name | Description |
|---|---|
| VIN | Power input (3.3V to 5V) |
| GND | Ground |
| SCK | SPI Clock Line |
| MOSI | SPI Master Out, Slave In |
| DC | Data/Command Select |
| CS | Chip Select |
| RST | Reset |
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// Define the OLED display dimensions
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
// Create an SSD1306 display object connected via I2C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
// Initialize the OLED display
if (!display.begin(SSD1306_I2C_ADDRESS, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Halt execution if initialization fails
}
// Clear the display buffer
display.clearDisplay();
// Display a welcome message
display.setTextSize(1); // Set text size
display.setTextColor(SSD1306_WHITE); // Set text color
display.setCursor(0, 0); // Set cursor position
display.println(F("Hello, OLED!"));
display.display(); // Render the text on the display
delay(2000); // Pause for 2 seconds
}
void loop() {
// Example: Draw a rectangle on the display
display.clearDisplay(); // Clear the display buffer
display.drawRect(10, 10, 50, 30, SSD1306_WHITE); // Draw a rectangle
display.display(); // Render the rectangle on the display
delay(1000); // Pause for 1 second
}
Display Not Turning On:
No Output on the Display:
0x3C) is being used in the code.Flickering or Unstable Display:
Partial or Distorted Graphics:
display.clearDisplay()) before drawing new content.Q: Can I use this module with a Raspberry Pi?
A: Yes, the Adafruit 128x64 OLED Bonnet is fully compatible with Raspberry Pi. Use the I2C or SPI interface and install the necessary Python libraries (e.g., Adafruit-SSD1306).
Q: What is the default I2C address of the module?
A: The default I2C address is 0x3C.
Q: Can I daisy-chain multiple OLED Bonnet modules?
A: No, the module does not support daisy-chaining. Each module requires a unique I2C address or separate SPI connections.
Q: How do I adjust the brightness?
A: Brightness can be adjusted programmatically using the ssd1306_command() function in the Adafruit SSD1306 library.
Q: Is the display sunlight-readable?
A: The OLED display is not optimized for direct sunlight and is best used indoors or in shaded environments.