Skip to content
Números 800 en México

Can a 1.54 inch 128x64 OLED display show animations?

Por admin Lectura estimada 6 min
Yes, a 1.54 inch 128x64 OLED display can absolutely show animations, but the devil is in the details—how smooth, how complex, and how much memory you’re willing to burn. These displays, typically based on the SSD1306 or SH1106 driver chips, are monochrome (or sometimes yellow-blue dual color) and rely on a pixel grid of 128 columns by 64 rows. That’s 8,192 pixels total. To animate, you need to refresh the entire frame buffer at a rate that feels fluid—usually 24 frames per second (fps) or higher. The SPI version of this display, like the 1.54 inch 128x64 oled display, can handle SPI clock speeds up to 10 MHz on most microcontrollers, which translates to around 1.25 MB per second data throughput. That’s enough to push a full 1 KB frame buffer (128x64 pixels = 1,024 bytes, since each pixel is 1 bit) at over 1,200 fps theoretically. But real-world constraints—like the display’s internal refresh rate, your microcontroller’s processing speed, and the animation complexity—bring that down to a practical 30-60 fps for simple animations. Let’s break down the technical factors. The SSD1306 driver, for instance, has a maximum frame rate of about 100 Hz when using page addressing mode, but in practice, you’re limited by the MCU’s SPI bus and the time it takes to write the buffer. On an Arduino Uno (16 MHz, 8-bit), sending 1 KB of data over SPI at 8 MHz takes roughly 1 millisecond, but you also need to send commands like set column address, set page address, and the display on/off command. That adds overhead. A typical animation loop—clear buffer, draw frame, send buffer—might take 15-20 ms on an Uno, yielding 50-66 fps. But if you’re using a faster MCU like an ESP32 (240 MHz, 32-bit), you can hit 100+ fps with ease, especially if you use DMA (Direct Memory Access) to offload SPI transfers. The display’s own pixel response time is around 15-20 microseconds, which is negligible compared to the MCU bottleneck. Now, what kind of animations can you actually run? The 128x64 resolution is small, so you’re not rendering full-motion video. But you can do sprite-based animations (like a bouncing ball, a walking character, or a loading bar), scrolling text, or even simple particle effects. Each frame is a bitmap, so you’d store the frames in flash memory (or generate them on the fly). For a 1-second animation at 30 fps, you need 30 frames x 1 KB = 30 KB of storage. That’s fine for most microcontrollers: the ESP32 has 4 MB of flash, the Arduino Uno has 32 KB (but you’d need to use an external EEPROM or SD card). If you’re using a Raspberry Pi Pico (264 KB SRAM), you can cache frames in RAM for faster access. The key is to use a frame buffer double-buffering technique: write the next frame to a second buffer while the display is showing the current one, then swap buffers. This eliminates tearing artifacts. Here’s a table summarizing the performance of common microcontrollers with this display: | Microcontroller | Clock Speed | SPI Max Speed | Theoretical Max FPS | Practical FPS (simple animation) | Frame Buffer Size | Flash Storage for 1s animation (30 fps) | |----------------|-------------|---------------|---------------------|----------------------------------|-------------------|------------------------------------------| | Arduino Uno | 16 MHz | 8 MHz | 1,200 | 50-60 | 1 KB | 30 KB (needs external storage) | | ESP32 | 240 MHz | 80 MHz | 12,000 | 100-120 | 1 KB | 30 KB (internal flash) | | Raspberry Pi Pico | 133 MHz | 50 MHz | 7,500 | 80-100 | 1 KB | 30 KB (internal flash) | | STM32F103 (Blue Pill) | 72 MHz | 18 MHz | 2,700 | 70-90 | 1 KB | 30 KB (internal flash) | The practical fps drops because the MCU has to compute the animation—drawing shapes, updating sprites, handling user input. For a simple bouncing ball, the ball’s position is updated each frame, and the background is cleared. That’s trivial. But if you’re doing a scrolling text animation with a custom font, you need to shift the bitmap by 1 pixel per frame, which requires bit-shifting operations. On an 8-bit MCU, that’s slower. You can optimize by using pre-rendered bitmaps for each character and using a pixel-level copy function, but that still takes time. Another factor: the display’s internal architecture. The SSD1306 uses a 128x64 pixel RAM buffer inside the chip. You can write to it in page mode (8 pages of 128x8 pixels) or horizontal mode. The SPI protocol requires sending a command byte followed by data bytes. For each frame, you need to send 0x21 (set column address), 0x00-0x7F (column range), 0x22 (set page address), 0x00-0x07 (page range), then the 1,024 data bytes. That’s 1,032 bytes per frame. At 8 MHz SPI, that’s ~1.03 ms, but the MCU’s SPI hardware adds overhead. On an Uno, the SPI.transfer() function takes about 1.5 microseconds per byte, so 1,032 bytes = 1.55 ms. Add the command setup and you’re at ~2 ms per frame. The rest of the time is spent on animation logic. What about power consumption? The display itself draws about 20 mA when active (all pixels on), but if you’re updating at 60 fps, the MCU’s power draw dominates. An ESP32 at 240 MHz can draw 80-100 mA, while an Uno draws 20-30 mA. For battery-powered projects, you might want to lower the frame rate to 15-20 fps, which is still acceptable for simple animations like a clock’s second hand or a fade-in effect. You can also use the display’s sleep mode (0.1 mA) between animations. Real-world examples: I’ve seen projects where a 1.54 inch 128x64 OLED displays a scrolling weather forecast with icons, a simple game like Snake (30 fps), or a digital clock with a smooth second hand. The animation quality depends on the pixel art. Since it’s monochrome, you rely on dithering and anti-aliasing for smooth edges. The display’s contrast ratio is very high (over 10,000:1), so even small details pop. The viewing angle is 160 degrees, which helps for public displays. One limitation: the display’s refresh rate is tied to the internal oscillator. The SSD1306 has an internal RC oscillator that runs at about 400 kHz, but you can also use an external clock. The frame rate is set by the “Display Start Line” and “Multiplex Ratio” registers. By default, it’s set to 64 multiplex (64 rows), and the frame rate is calculated as: f_frame = f_osc / ( (MUX+1) * (DCLK_divider) ), where DCLK_divider is typically 1. With f_osc = 400 kHz, MUX = 64, you get about 6,250 Hz, but that’s the internal row scanning rate, not the frame rate. The actual frame rate is the number of times you can update the buffer. The display’s internal scanning is continuous, so as long as you update the buffer faster than the scanning, you get smooth animation. If you update slower, you’ll see tearing. To avoid tearing, use double buffering. The display’s buffer is separate from the MCU’s buffer. You write to the MCU’s buffer, then send the entire buffer to the display. If you send partial updates, you might see partial refreshes. The SSD1306 supports “partial display” mode, but it’s tricky. Most libraries (like Adafruit_SSD1306 or U8g2) handle this automatically. Data density: The 128x64 resolution at 1.54 inches gives a pixel density of about 106 PPI (pixels per inch). That’s sharp enough for readable text at 6-8 point font sizes. For animations, you can use 8x8 pixel sprites (16 sprites per row, 8 per column) or 16x16 sprites (8 per row, 4 per column). Each sprite frame is 16 bytes (for 8x8) or 32 bytes (for 16x16). A 30-frame animation of a 16x16 sprite takes 960 bytes, plus the background. You can compress frames using run-length encoding (RLE) if flash is tight. Another angle: the display’s temperature range. These OLEDs work from -40°C to +85°C, so they’re suitable for outdoor animations (like a digital sign). The SPI interface is reliable over short distances (up to 1 meter with proper termination). For longer runs, use I2C (which is slower, max 400 kHz, but uses fewer pins). The SPI version is faster, so it’s preferred for animations. In terms of libraries, the U8g2 library supports the SSD1306 and SH1106 and has built-in animation functions like “nextPage” and “firstPage” for frame-based rendering. It also supports proportional fonts and bitmap images. For complex animations, you’d write your own loop using the library’s drawPixel, drawLine, drawCircle, etc. The library’s buffer is 1 KB, so you can draw directly to it. One practical tip: use a precomputed frame array stored in PROGMEM (flash) on AVR microcontrollers. For example, a 10-frame animation of a spinning gear can be stored as 10 x 1 KB = 10 KB of flash. On an Uno, that’s 30% of the total flash (32 KB), so you’d need to external storage. On an ESP32, it’s trivial. Finally, the display’s lifespan. OLEDs have a limited lifetime: the blue pixels fade faster (about 10,000 hours to half brightness), while yellow/green last longer (20,000 hours). For constant animation, you might see burn-in after a few thousand hours. But for most hobby projects, that’s fine. So, yes, animations are possible, but they require careful planning around memory, speed, and power. The 1.54 inch 128x64 OLED is a capable little screen for simple to moderate animations, especially when paired with a fast MCU and efficient code.

Convierte cada llamada en un lead medible

Renta tu 800 con panel en la nube y activación en menos de 7 minutos.

Probar mi 800 gratis por 7 días