Skip to content

OLED

Overview

The AlphaBot2 kit often comes with a 0.96-inch OLED display (usually 128x64 pixels) that connects via I2C (Inter-Integrated Circuit) communication. This small but sharp display is useful for showing real-time data, sensor readings, or debugging information without needing a serial monitor.

Key Feature

  • Size
    • 0.96 inches (diagonal)
  • Resolution
    • 128x64 pixels (monochrome or sometimes blue/yellow)
  • Interface
    • I2C (uses SDA and SCL pins)
  • Low Power Consumption
    • OLEDs only light up active pixels, saving energy.

Working

  • Libraries
    • Wire.h: Enables I2C communication between Arduino and the OLED..
    • Adafruit_GFX: Provides basic graphics functions (text, shapes).
    • Adafruit_SSD1306: Driver for the OLED display.
    • Adafruit_SSD1306: Creates an object named display for controlling the OLED.
  • begin(SSD1306_SWITCHCAPVCC, 0x3C)
    • Starts the OLED with internal voltage (address 0x3C for I2C).
  • Buffer Management
    • clearDisplay() is called before new content to avoid Overlapping of text.
    • display() is required to push changes to the OLED.
  • Text Positioning
    • setCursor(X, Y) sets the text origin (top-left is (0, 0)).
  • I2C Address
    • 0x3C is the default I2C address for most OLEDs in AlphaBot2.