This project demonstrates how to animate a GIF on a NodeMCU ESP‑12E board with a 128x64 SH1106 OLED display.
It combines a Python preprocessing step to extract GIF frames and an Arduino sketch to render them on the OLED.
gif2frames.py→ Python script to convert GIFs into individual frames.EvernightLonelyDance.ino→ Arduino sketch for NodeMCU ESP‑12E.Evernight.h→ Header file containing converted frame bitmaps.evernight-honkai.gif→ Example input GIF.evernight-honkai_frames/→ Output folder containing extracted frames.
- Python 3.x
- Pillow (
pip install pillow)
- NodeMCU ESP‑12E (ESP8266)
- SH1106 OLED display (128x64)
- Adafruit SH110X library
-
Install Pillow
pip install pillow
-
Convert GIF to frames
python gif2frames.py
This saves all frames from
evernight-honkai.gifinto./evernight-honkai_frames/. -
Convert frames to C arrays
- Upload the PNG frames to Image2CPP.
- Resize frames to fit the OLED (128x64).
- Export as a header file (
gifname.h).
-
Include the header in Arduino sketch
- Place the generated
gifname.hin your Arduino project. - The sketch
EvernightLonelyDance.inoreferences this header.
- Place the generated
-
Upload to ESP8266
- Connect your NodeMCU ESP‑12E.
- Upload the sketch via Arduino IDE.
- Frame delay (
delay(10)) can be adjusted for smoother or faster playback. - Ensure all frames are resized to 128x64 before converting to C arrays.
- Large GIFs may exceed flash memory limits; optimize by reducing frame count or resolution.
