Frequent use of animated GIF files dates back to Netscape Navigator in the 1990's (remember twirling "under construction" signs for web sites?). These days, animated GIF files are most often used for meme display or in short video clips where a video file might not be playable.
The resources needed to play animated GIFs are lower than videos, but have often been more than what a microcontroller could provide.
Playing animated GIF image files using a microcontroller is a tough proposition. Here are the factors which need to be considered for a good experience:
- Microcontroller speed
- Microcontroller memory available
- A speedy interface between microcontroller memory and a display
- Animated GIF file size
Some more modern microcontrollers with a larger amount of memory and fast access to a local display can meet the requirements for animated GIF playback, as long as the file size and frame rate (the time between frames in the changing image) is not too small.
This guide will demonstrate displaying animated GIF files on two microcontroller boards with integrated displays. The Espressif ESP32-S2 and Microchip SAMD51 are modern processors capable of displaying GIF files at reasonable rates.
The CircuitPython gifio
module is an addition to CircuitPython 8.1.0 and later versions providing GIF playback capability.
Parts
This guide will use an Adafruit ESP32-S2 TFT Feather and an Adafruit PyPortal to demonstrate animated GIF playback. Only one of the boards is needed to try this process. The USB cable shown works with both USB micro B and USB C. Be sure you use a known good data+power cable.
You can choose another board - note the code may be slightly different from the code for these two boards in this guide. And also, if the other board does not have a modern, capable processor, GIF playback will be impaired or unacceptable.
Text editor powered by tinymce.