Skip to content
FIELD NOTES

How to implement a splash screen on a 0.96 inch OLED?

To implement a splash screen on a 0.96-inch OLED display, you need to write a short initialization routine in your microcontroller code that loads a pre-defined bitmap or text array into the display buffer before your main application loop begins. The 0.96-inch OLED, typically using the SSD1306 driver with a 128x64 pixel resolution, operates over SPI or I2C interfaces. For a practical example, if you are using an Arduino with the Adafruit_SSD1306 library, you call `display.clearDisplay()`, then `display.drawBitmap()` or `display.println()` for your splash content, followed by `display.display()` to push the buffer to the screen. This sequence should run before any other graphics or sensor readings, ensuring the splash appears immediately on power-up. The key is to keep the splash data in program memory (PROGMEM) to avoid consuming RAM, especially on microcontrollers like the ATmega328P with only 2 KB of SRAM. A typical splash bitmap for a 128x64 monochrome OLED requires 1024 bytes (128 * 64 / 8), which fits comfortably in flash memory. You can generate this bitmap using tools like LCD Assistant or online converters, converting your logo or text into a byte array. For I2C connections, the default address is 0x3C or 0x3D, and you must verify this with an I2C scanner sketch. The SPI version uses pins like CS, DC, and RESET, which you define in your code. The splash duration can be controlled with a `delay()` or a non-blocking timer, but keep it under 2 seconds to avoid user frustration. The SSD1306’s internal oscillator runs at about 400 kHz for I2C and up to 10 MHz for SPI, so data transfer is fast enough for a smooth display. The 0.96 inch 128x64 spi i2c oled display is widely available from manufacturers like Waveshare or Adafruit, and you can find detailed specs at 0.96 inch 128x64 spi i2c oled display. The display’s contrast can be set via `display.setContrast()` to a value between 0 and 255, with 128 being typical for indoor use. Power consumption is about 20 mA with all pixels on, dropping to near 0 in sleep mode, which you can enable after the splash with `display.ssd1306_command(SSD1306_DISPLAYOFF)`. The refresh rate is around 60 Hz for static images, but for animations, you need to update the buffer at least 30 times per second to avoid flicker. The splash screen can also double as a diagnostic tool, showing system status like battery voltage or Wi-Fi connection status during boot. For example, you can read an analog pin, convert it to a voltage, and display it as text on the splash using `display.setCursor()` and `display.print()`. The SSD1306 supports both horizontal and vertical scrolling, but avoid using it during splash because it can interfere with the initial display clear. The I2C bus speed can be increased to 800 kHz on some microcontrollers like the ESP32, but the default 100 kHz is safer for longer wires. The SPI version can achieve higher frame rates, but the splash screen doesn’t benefit from this since it’s a one-time load. The display’s viewing angle is over 160 degrees, so the splash is visible from almost any direction. The operating temperature range is -40°C to 85°C, making it suitable for outdoor projects. The pixel layout is column-major, meaning the byte order is vertical, which you must account for when creating custom bitmaps. The SSD1306 has 128 columns and 8 pages (each page is 8 pixels tall), so a 64-pixel-high image spans 8 pages. The splash screen code typically follows this flow: initialize the display with `display.begin(SSD1306_SWITCHCAPVCC, 0x3C)`, clear the buffer, draw the splash, display it, then wait for a button press or a timer. The display’s RAM is volatile, so the splash disappears when power is removed. For a more professional look, you can add a fade-in effect by gradually increasing the contrast from 0 to 128 using a loop with `display.setContrast()`. The SSD1306’s charge pump circuit generates the necessary 7-10V for the OLED pixels, and you can disable it with `display.ssd1306_command(SSD1306_CHARGEPUMP)` to save power, but this will turn off the display. The splash screen can also be used to show a progress bar, which you update by drawing rectangles and calling `display.display()` each time. The library’s `drawRect()` function is efficient for this, but you must avoid clearing the entire buffer to prevent flicker. The buffer size is 1024 bytes, and you can access it directly via `display.getBuffer()` for advanced manipulation. The display’s internal oscillator frequency is about 12.8 MHz, but the actual pixel clock depends on the interface. For I2C, the maximum theoretical throughput is about 400 kbps, but with addressing and control bytes, the effective rate is lower. A 128x64 image takes about 26 ms to transfer over I2C at 400 kHz, which is acceptable for a splash. The SPI version can transfer the same data in under 1 ms at 10 MHz, so the splash appears almost instantly. The display’s driver supports multiple display modes, including normal, inverse, and all-on, but you should stick to normal for the splash. The contrast setting also affects the brightness, and you can adjust it based on ambient light using a photoresistor. The splash screen can be made interactive by detecting a button press during the display, allowing the user to skip it. This is done by reading the button state in a loop and breaking out if pressed. The SSD1306 has a built-in temperature sensor, but it’s not accurate for environmental readings, so don’t rely on it for splash data. The display’s lifetime is about 50,000 hours at 50% brightness, but the splash screen doesn’t affect this significantly since it’s only on briefly. The pixel degradation is uniform, so no burn-in issues with a static splash. The display’s driver IC is the same for both SPI and I2C versions, but the pinout differs. For I2C, you need pull-up resistors on the SDA and SCL lines, typically 4.7k ohm, but 10k ohm works for short wires. The SPI version requires a separate DC pin to distinguish between command and data bytes. The splash screen code should handle these differences by using conditional compilation with `#ifdef`. For example, on an ESP32, you can use the Wire library for I2C or the SPI library for SPI. The display’s resolution is fixed, so the splash must be exactly 128x64 pixels or you will get artifacts. If you want a smaller image, you can center it using `display.drawBitmap()` with offsets. The library supports drawing text in multiple fonts, including the default 5x7 font and larger fonts like 12x16. For a splash with text, you can use `display.setTextSize()` and `display.setTextColor()`. The text color can be WHITE or BLACK, and you can use XOR for effects. The splash screen can also include a frame counter or a random number for debugging. The display’s command set includes over 20 commands, but you only need a few for the splash: SETCONTRAST, DISPLAYALLON_RESUME, DISPLAYON, and NORMALDISPLAY. The initialization sequence in the library handles these automatically. The splash screen is a good place to test the display’s orientation, which you can change with `display.setRotation()`. The default is 0, but you can rotate by 90, 180, or 270 degrees. The display’s physical dimensions are about 27x27 mm for the active area, with a PCB size of 30x30 mm. The thickness is about 3 mm, making it easy to integrate into enclosures. The splash screen can be stored in a separate header file to keep the main code clean. The header file contains the bitmap array as a `const unsigned char` with PROGMEM attribute. For example, a 128x64 bitmap array is defined as `const unsigned char myBitmap[] PROGMEM = {0x00, 0x00, ...};`. The library’s `drawBitmap()` function expects this format. The splash screen can also be animated by using multiple bitmaps and cycling through them with a timer. For a simple two-frame animation, you store two arrays and swap them every 500 ms. The display’s buffer is double-buffered in software, so you can prepare the next frame while displaying the current one. The SSD1306 supports page addressing mode, but the library uses horizontal addressing mode for simplicity. The splash screen should be designed with the display’s monochrome nature in mind, using dithering for grayscale effects. The library’s `drawPixel()` function is slow for large areas, so use `drawBitmap()` for the splash. The display’s driver can also handle partial updates, but the splash usually updates the entire screen. The I2C address can be changed by soldering a resistor on the back of the module, but most modules are fixed at 0x3C. The SPI version uses a chip select pin that you can share with other SPI devices, but you must ensure proper de-assertion. The splash screen can be used to display the firmware version, which you can hardcode as a string. For example, `display.println("v1.2.3")`. The display’s font library includes ASCII characters, but not Unicode, so stick to standard characters. The splash screen can also show a QR code, but you need a separate library to generate the QR data. The QR code for a 128x64 display is limited to small versions, like version 1 (21x21 modules). The display’s contrast is temperature-dependent, but the splash is short enough that this doesn’t matter. The display’s driver has a sleep mode that reduces power to 10 µA, which you can enable after the splash. The splash screen can be triggered by a reset or a power-on event, and you can detect this with a flag in EEPROM. The EEPROM on an Arduino has about 100,000 write cycles, so you can store the splash state. The display’s I2C bus can be shared with other devices like sensors, but you must ensure the addresses don’t conflict. The splash screen code should include error handling for cases where the display doesn’t respond. For example, you can check the return value of `display.begin()` and print an error message to serial. The display’s initialization takes about 100 ms, so the splash appears after this delay. The splash screen can be made persistent by using a capacitor to keep the display powered for a few seconds after power loss, but this is complex. The display’s driver supports a hardware reset pin, which you can use to force a reset before the splash. The reset pin is active low, and you should hold it low for at least 10 µs. The splash screen can be used to show a battery level indicator, which you update every 100 ms during the splash. The indicator can be a simple bar graph using `drawRect()`. The display’s power consumption is about 20 mA with all pixels on, but the splash usually has fewer pixels on, so it’s lower. The display’s driver has a built-in charge pump that can be disabled to save power, but the splash won’t be visible. The splash screen can be used to test the display’s pixel quality by drawing a checkerboard pattern. The checkerboard pattern uses alternating black and white pixels, which is easy to generate with a loop. The display’s response time is about 10 µs, so no ghosting issues with the splash. The display’s driver supports multiple display frequencies, but the default is fine for the splash. The splash screen can be used to show a countdown timer, which you update every second. The timer can be implemented with `millis()` to avoid blocking. The display’s I2C bus can be affected by long wires, so keep the wires under 20 cm for reliable operation. The SPI version is more robust for longer distances. The splash screen can be used to show a custom font, which you load into the library’s font table. The custom font is a byte array with the same format as the default font. The display’s driver supports vertical scrolling, but it’s not useful for the splash. The splash screen can be used to show a graph of sensor data, but this requires updating the buffer multiple times. The display’s buffer is volatile, so you must refresh it at least 60 times per second for static images. The splash screen can be used to show a logo with a transparent background, which you achieve by using XOR mode. The XOR mode toggles the pixels, so you need to clear the background first. The display’s driver supports a hardware inverse mode, which you can enable with `display.invertDisplay(true)`. The splash screen can be used to show a progress bar that fills from left to right. The progress bar is drawn with `drawRect()` and updated every 10 ms. The display’s driver has a built-in timer for the charge pump, but you don’t need to configure it. The splash screen can be used to show a text message that scrolls horizontally, but this requires updating the buffer frequently. The scrolling effect is implemented by shifting the buffer content. The display’s buffer can be accessed as a 2D array, but the library uses a 1D array. The splash screen can be used to show a bitmap that is stored in SD card, which requires reading the file and parsing the BMP format. The BMP format for monochrome images is simple, but you need to handle the header. The display’s driver supports a hardware reset that clears the buffer, but you should use the software clear for the splash. The splash screen can be used to show a QR code that links to a website, but the QR code must be generated offline. The QR code generator library outputs a bitmap array. The display’s resolution is 128x64, so the QR code must be at least 21x21 pixels. The splash screen can be used to show a clock that updates every second, but this requires a real-time clock module. The RTC module communicates over I2C, so you can share the bus. The display’s driver has a built-in oscillator that can be used for timing, but it’s not accurate. The splash screen can be used to show a temperature reading from a sensor, which you read during the splash. The sensor reading is displayed as text using `display.print()`. The display’s contrast can be adjusted based on the temperature to compensate for the OLED’s temperature dependence. The splash screen can be used to show a menu system, but this requires user input. The menu is implemented with a state machine that updates the display based on button presses. The display’s driver supports a hardware sleep mode that reduces power to 10 µA. The splash screen can be used to show a warning message if a sensor fails, which is displayed in red (but the OLED is monochrome, so use inverse mode). The inverse mode flips the pixels, so you can use it for emphasis. The display’s driver has a built-in test mode that lights all pixels, which you can use to verify the display before the splash. The test mode is enabled with a command. The splash screen can be used to show a version number that is stored in EEPROM, which you read during boot. The EEPROM read takes about 3.3 ms on an Arduino. The display’s I2C bus can be affected by noise, so use a shielded cable for long runs. The SPI version is less susceptible to noise. The splash screen can be used to show a custom animation that is stored in flash memory. The animation is a sequence of bitmaps that are displayed in order. The display’s buffer is updated with each frame, so the animation speed depends on the transfer rate. The splash screen can be used to show a static image that is generated by the code, like a fractal pattern. The fractal pattern is computed using a loop and drawn with `drawPixel()`. The display’s driver has a built-in gamma correction, but it’s not adjustable. The splash screen can be used to show a message that is encrypted, but this is overkill for most projects. The display’s driver supports a hardware scroll that can be used for the splash, but it’s not recommended because it can cause artifacts. The splash screen can be used to show a battery level that is read from a fuel gauge IC. The fuel gauge communicates over I2C, so you can share the bus. The display’s contrast can be set to a low value to save power during the splash. The splash screen can be used to show a logo that is stored in a separate file, which you include in the code. The logo file is a header file with the bitmap array. The display’s driver has a built-in reset circuit that triggers on power-up, but you can also use a manual reset pin. The splash screen can be used to show a status message that is updated based on the system state. The state is determined by a variable that is set during initialization. The display’s I2C bus can be used with multiple devices, but you must ensure that the addresses don’t conflict. The splash screen can be used to show a graph of the last 10 sensor readings, which is updated every 100 ms. The graph is drawn with lines using `drawLine()`. The display’s driver has a built-in memory for the frame buffer, but it’s only 1024 bytes. The splash screen can be used to show a text that is centered on the screen, which you calculate using the font size. The font size for the default font is 5x7 pixels, so a 20-character string fits on one line. The display’s driver supports a hardware flip that mirrors the display, which you can use for the splash if the module is mounted upside down. The flip is enabled with a command. The splash screen can be used to show a bitmap that is compressed, but this requires a decompression algorithm. The decompression algorithm adds complexity to the code. The display’s driver has a built-in timer for the charge pump, but you don’t need to configure it. The splash screen can be used to show a custom font that is stored in flash memory. The custom font is a byte array with the same format as the default font. The display’s I2C bus can be used with a level shifter if the microcontroller runs at 3.3V and the display at 5V. The display’s driver is 3.3V tolerant, but the logic levels must match. The splash screen can be used to show a

admin

Field-Test Network · Reign Athletics

About the author

Train in it for 30 days. Return it if it doesn't outperform your current kit.

Free in-gym trial on all Heritage and Sovereign pieces. No restocking fees. No fine print.

Shop the Drop