Views: 222 Author: Tina Publish Time: 2025-06-19 Origin: Site
Content Menu
● Understanding the SH1106 OLED Screen
● Hardware Specifications and Pinout
● Wiring the SH1106 OLED to Microcontrollers
>> Connecting to Arduino (I2C)
>> Connecting to Raspberry Pi (I2C)
● Setting Up the Software Environment
>> Arduino
● Initializing and Testing the Display
>> Arduino
>> Raspberry Pi
● Displaying Text, Numbers, and Graphics
>> Text Display
>> Drawing Lines, Rectangles, and Circles
● Drawing Images and Animations
>> Animations
● Advanced Features: Scrolling, Contrast, and Power Modes
>> Scrolling
>> Power Modes
● Troubleshooting Common Issues
>> 1. What is the default I2C address for SH1106 OLED screens?
>> 2. Can I use the SH1106 OLED with both Arduino and Raspberry Pi?
>> 3. How do I display custom images on the SH1106 OLED?
>> 4. Why is my SH1106 OLED screen blank or flickering?
>> 5. How can I improve the display contrast or reduce power consumption?
OLED displays have become a staple in modern electronics projects due to their crisp visuals, low power consumption, and versatility. Among the various OLED controllers, the SH1106 stands out for its widespread use in 1.3-inch 128x64 pixel screens. Whether you are building a DIY gadget, upgrading a Raspberry Pi project, or adding a display to your Arduino, mastering the SH1106 OLED screen opens up a world of creative possibilities.
This in-depth guide will walk you through everything you need to know about using the SH1106 OLED screen. From understanding its hardware features to wiring, coding, displaying text, graphics, and troubleshooting, this article aims to be your definitive resource. Throughout the article, you will find illustrative diagrams, code snippets, and detailed explanations to enhance your learning experience.

The SH1106 is a single-chip CMOS OLED/PLED driver with a controller, designed for monochrome dot-matrix graphic displays. It supports resolutions up to 132x64 pixels and is commonly found in 1.3-inch displays with a 128x64 pixel active area. The SH1106 offers multiple interface options, including I2C, 3-wire SPI, and 4-wire SPI, making it compatible with a wide range of microcontrollers and single-board computers.
One key distinction between the SH1106 and similar controllers like the SSD1306 is the slightly larger internal memory addressing of the SH1106, which accounts for 132 columns even though only 128 are visible on the screen. This difference means that some libraries designed for SSD1306 may not work perfectly with SH1106 without modification.
The SH1106's internal architecture allows for efficient control of the OLED pixels, enabling high contrast and fast refresh rates. Its monochrome nature means it displays pixels as either on or off, which simplifies rendering but also requires creative use of dithering or animation for more complex visuals.
Key Features:
- Display Size: 1.3 inches
- Resolution: 128x64 pixels (active area)
- Controller: SH1106
- Interface: I2C (default), 3-wire SPI, 4-wire SPI
- Operating Voltage: 3.3V to 5V (check your module)
- Viewing Angle: >160°
- Colors: Monochrome (typically blue, white, or yellow)
- Operating Temperature: -20°C to 70°C
Pinout Diagram:
Below is a typical pinout for an SH1106 OLED module using I2C:
| Pin | Function | Description |
|---|---|---|
| GND | Ground | Connect to microcontroller GND |
| VCC | Power Supply | 3.3V or 5V depending on module |
| SCL | I2C Clock | Serial clock line |
| SDA | I2C Data | Serial data line |
For SPI mode, additional pins like CS (Chip Select), DC (Data/Command), and RES (Reset) are used. Always refer to your specific module's datasheet for exact pin labeling.
The physical layout of the pins may vary between manufacturers, so it is crucial to verify the pin functions before wiring. Some modules also include a reset pin or allow switching between I2C and SPI via solder jumpers or pins.
The most common and straightforward way to connect the SH1106 OLED to an Arduino is via the I2C interface. This method uses only four wires, simplifying connections and reducing pin usage.
1. Connect GND on the OLED module to the Arduino GND pin.
2. Connect VCC on the OLED to the Arduino 3.3V or 5V pin, depending on your module's voltage requirements.
3. Connect SCL on the OLED to the Arduino's SCL pin (A5 on Uno/Nano).
4. Connect SDA on the OLED to the Arduino's SDA pin (A4 on Uno/Nano).
Ensure that your Arduino board supports I2C on these pins or use the dedicated I2C pins on boards like the Arduino Mega or Leonardo.
For Raspberry Pi, the SH1106 OLED can be connected via the Pi's I2C interface:
1. Connect GND on the OLED to any GND pin on the Pi.
2. Connect VCC to the Pi's 3.3V pin (do not use 5V unless the OLED module supports it).
3. Connect SCL to the Pi's SCL pin (GPIO 3).
4. Connect SDA to the Pi's SDA pin (GPIO 2).
Before running your code, enable I2C on the Raspberry Pi via `raspi-config` and install necessary libraries.
If your SH1106 module supports SPI, wiring will involve additional pins:
- CS (Chip Select): Selects the device for SPI communication.
- DC (Data/Command): Switches between sending data or commands.
- RES (Reset): Resets the display.
Connect these pins to available GPIOs on your microcontroller and configure your software accordingly.

To work with the SH1106 OLED on Arduino, you need to install a compatible library. The U8g2 library is highly recommended because it supports SH1106 displays and offers a wide range of fonts and graphics functions.
- Open the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries.
- Search for U8g2 and install it.
Once installed, include the library in your sketch and initialize the display with the correct constructor for SH1106.
After wiring and setting up the software, the next step is to initialize the display and perform a simple test to confirm everything works.
Begin by initializing the display in your `setup()` function. Then, clear the display buffer, set a font, and write a simple message to the screen. Finally, send the buffer to the display to render the content.
Using Python, initialize the device object and create a drawing canvas. Write text or draw shapes on the canvas, which will be rendered on the OLED screen.
This initial test confirms that your wiring is correct, the display is functional, and your software environment is properly configured.
Displaying text on the SH1106 involves selecting a font, positioning the cursor, and writing the string. The U8g2 library for Arduino and the luma.oled library for Python both support multiple fonts, including scalable and fixed-width fonts.
You can display static messages or dynamically update text, such as sensor readings or status updates. Positioning is controlled by pixel coordinates, allowing precise placement anywhere on the screen.
Numbers are typically converted to strings before display. This allows you to format decimal places, add units, or concatenate with other text. For example, displaying temperature readings or time values is straightforward.
The SH1106 supports basic graphic primitives. You can draw lines, rectangles (filled or outlined), circles, and other shapes. These are useful for creating custom UI elements like progress bars, frames, or icons.
Using these primitives combined with text allows you to build rich interfaces despite the monochrome display.
To display images, convert your graphics to monochrome bitmaps. This can be done using image editing software or online converters that output arrays of bytes representing pixel data.
Once converted, include the bitmap array in your code and use the display library's bitmap drawing functions to render the image.
Animating on the SH1106 involves updating the display buffer repeatedly with new frames. Since the display is monochrome and has limited resolution, animations are typically simple, such as blinking icons, moving bars, or frame-by-frame sprite animations.
Keep animations smooth by controlling the update rate and minimizing the amount of data sent per frame.
The SH1106 controller supports hardware scrolling in horizontal and vertical directions. This can be used to create marquee text effects or to scroll through menus.
Scrolling commands are available in the controller's instruction set and can be accessed via libraries or direct command sending.
Adjusting the contrast helps optimize visibility under different lighting conditions. Higher contrast improves readability but may increase power consumption.
Use library functions to set contrast levels dynamically based on ambient light or user preference.
The SH1106 supports sleep and wake modes to conserve power. When the display is not needed, putting it to sleep reduces current draw significantly.
Implementing power management is essential for battery-powered projects to extend operating time.
- Blank Screen: Double-check wiring, ensure the power supply is adequate, and verify the I2C address.
- Garbled or Partial Display: Confirm that you are using the correct library for SH1106 and not SSD1306. Also, check for loose connections.
- No Response: Make sure the display is not in sleep mode and that your microcontroller pins match your code configuration.
- Flickering: This can be caused by unstable power or incorrect initialization sequences. Use capacitors on power lines if necessary.
Thoroughly testing each step from wiring to code helps isolate issues quickly.
The SH1106 OLED screen is a versatile and powerful display solution for hobbyists and professionals alike. With its flexible interface options, crisp visuals, and robust library support, integrating it into your projects is straightforward. By following the steps outlined in this guide—covering hardware setup, software configuration, and advanced features—you can unlock the full potential of your SH1106 OLED display.
Whether you aim to display sensor data, graphics, or animations, the SH1106 offers reliable performance and creative flexibility. Experiment with different fonts, images, and effects to create engaging user interfaces for your electronics projects.

The default I2C address for most SH1106 OLED modules is 0x3C. Some modules may use 0x3D; always check your module's datasheet or test both addresses if you encounter issues.
Yes, the SH1106 OLED is compatible with both Arduino and Raspberry Pi platforms. You need to use the appropriate libraries for each platform and ensure correct wiring for I2C or SPI communication.
Convert your image to a monochrome bitmap (1-bit per pixel) using an image editor or online tool. Save the bitmap as a byte array in your code and use the display library's bitmap function to render it.
Common causes include incorrect wiring, insufficient power, wrong I2C address, or using a library designed for a different controller (such as SSD1306). Double-check your connections and library selection.
Use the display library's contrast adjustment function to set optimal contrast. To save power, enable sleep mode when the display is not in use, and reduce screen updates to the minimum necessary.
This comprehensive article answers the question "Can I Upgrade My E-Bike LCD Display Easily?" by exploring display types, compatibility, practical upgrade steps, troubleshooting, and maintenance tips. Boost your riding experience and get the most from your LCD display e-bike with the best current advice, illustrations, and video guidance.
This comprehensive guide explores the troubleshooting and repair of backpack LCD display issues, covering blank screens, flickers, garbled text, address conflicts, and more. It offers stepwise solutions and practical videos to help users swiftly restore functionality in their hardware projects.
Discover why the Sharp memory LCD display outperforms traditional LCDs with lower power use, unmatched sunlight readability, robust reliability, and a straightforward interface. Learn about its technology, applications, pros and cons, integration tips, and get answers to common engineering questions.
OLED displays, though admired for their visuals, may cause digital eye strain or "OLED screen eye tire" during extended use because of blue light, potential PWM flicker, and intense color/contrast. By using optimal settings and healthy habits, users can safely enjoy OLED with minimal discomfort.
Does displaying a white screen on an LG OLED TV fix persistent burn-in? The answer is no: true burn-in results from irreversible pixel wear and chemical aging. The best practice is to use preventive features, moderate settings, and varied content to safeguard screen health. For severe cases, panel replacement is the only cure.
An in-depth guide to the LCD display bezel: its definition, history, materials, structure, and growing role in display design. Explores bezel importance, types, aesthetic trends, maintenance, and innovation, offering expert insights—including an expanded FAQ and practical visuals—to help users understand its unique place in technology.
This article provides a complete, practical guide to diagnosing and fixing non-responsive SPI LCD displays using methods including hardware validation, logic level correction, library configuration, and advanced diagnostic tools. Perfect for hobbyists and engineers alike.
LCD display liquid coolers deliver top-tier performance with visually stunning customizable LCD panels that display system data and artwork. They suit enthusiasts and streamers aiming for unique builds but may be unnecessary for budget or basic systems. The price premium is justified by advanced hardware, software, and customization features.
Black bars on an OLED screen do not cause burn-in as those pixels are switched off. Only with excessive, repetitive content does minor uneven aging become possible. Varying viewing habits and enabling panel maintenance prevents problems in daily use.
OLED TVs provide spectacular picture quality but rely heavily on the quality of the video input. Most cable broadcasts are limited to lower resolutions and compressed formats, so an OLED screen connected to a regular cable box will look better than older TVs but may not realize its full potential. Upgrading cable boxes and utilizing streaming services can unlock the best OLED experience.
OLED screen burn-in remains one of the key challenges inherent in this display technology. While no universal fix exists for permanent burn-in, a blend of app-based tools, manufacturer features, and maintenance practices can help reduce appearance and delay onset. Proper prevention strategies and use of built-in pixel shift and refresher tools offer the best chances of avoiding this issue.
This article comprehensively explores will OLED screen burn in over time by explaining the science of OLED displays, causes and types of burn in, manufacturer solutions, prevention tips, and real-world user experiences. Burn in risk does exist, but modern panels and user habits greatly reduce its likelihood, making OLED an excellent and long-lasting display choice.
This article provides an in-depth guide to selecting the best LCD display driver IC for various applications, covering driver types, key features, leading manufacturers, integration tips, and practical examples. It includes diagrams and videos to help engineers and hobbyists make informed decisions about LCD display driver selection.
Dead pixels are a common type of LCD display defect, caused by manufacturing faults, physical damage, or environmental factors. While stuck pixels may be fixable, dead pixels are usually permanent. Proper care and understanding can help prevent and address these issues.
This comprehensive guide explains every symbol and function found on e-bike LCD displays, using clear explanations and practical tips. Learn to interpret battery, speed, PAS, error codes, and customize settings using your e-bike LCD display manual for a safer, smarter ride.
This comprehensive guide explains how to set an LCD display clock, covering everything from hardware setup and wiring to coding, troubleshooting, and creative customization. With detailed instructions and practical tips, you'll learn to confidently build and personalize your own LCD display clock for any setting.
This article explores whether OLED laptop screens are prone to burn-in, examining the science, real-world evidence, prevention methods, and lifespan. It provides practical advice and answers common questions to help users make informed decisions about OLED technology.
Displaying a black screen on an OLED TV will not cause burn-in, as the pixels are turned off and not subject to wear. Burn-in is caused by static, bright images over time. With proper care and built-in features, OLED TVs are reliable and offer exceptional picture quality.
This article explores the causes of OLED screen burn-in, the science behind it, and effective prevention strategies. It covers signs, effects, and potential fixes, with practical tips to prolong your OLED display's lifespan and answers to common questions about burn-in.
OLED screens deliver unmatched image quality, with perfect blacks, vivid colors, and ultra-fast response times. Despite higher costs and some risk of burn-in, their advantages make them the top choice for premium displays in TVs, smartphones, and monitors.