Software apps and online services
This script ONLY works with Arduino_GFX_Library version 1.0.6. (aka GFX library for Arduino, under Library Manager).
The current databus Arduino_ESP32SPI of version 1.1.6 is not working at all. Please use 1.1.3 if you need to run the new script. I will post the new script shortly. Meanwhile, please use the attached
LibraryDebugger.ino to determine which "GFX library for Arduino" works for you.
Based on Arduino_GFX and gifdec, espgfxGIF is an Arduino sketch that plays animated GIF on TFT screen of some Arduino Dev modules, mainly esp32 and esp8266.
- Button A - Invert display
- Button B - Adjust Brightness
- Power button - Reboot and play the designated animated GIF, or a random GIF file in the SPIFFS if the GIF_FILENAME is not defined.
- High performance. If the GIF has no delay, most esp32 module is capable to play 70fps for a 135 x 240 animated GIF.
- M5Stack M5Stick-C (esp32 + ST7735)
- TTGO T-Display (esp32 + ST7789)
- D1 mini with 2.4 TFT shield (esp8266 + ILI9341)
TFT_eSPI, which is the most common TFT graphic library, supports BMP file and MJPEG/JPEG files via drawBmp() and drawJpeg(). However, due to the way how GIF handles cmap with custom color palettes, drawGIF is not supported (as what I am aware of). Adafruit_GFX also lack support on animated GIF. Color corruption is the common issue.
Arduino_GFX is a rewritten library from Adafruit_GFX, TFT_eSPI to supporting various displays with various data bus interfaces. Using gifdec to fill the GIF frames into to display data bus, animated GIF can be played on the TFT display.Installations:
(15 minutes setup. 1 minute GIF upload to SPIFFS. 2 minutes to compile and flash)
1. Download esp32fs to your Ardunio IDE from https://github.com/me-no-dev/arduino-esp32fs-plugin
2. Unzip the folder into %USERPROFILE%\Documents\Arduino\tools
3. Restart Arduino IDE.
4. Make sure esp32, esp8266 board info are installed.
5. Make sure M5StickC library is installed.
6. Install "GFX Library for Arduino" (aka Arduino_GFX) from Library Manager. YOU MUST USE version 1.0.6. (I will post the script for 1.1.3 shortly)
7. Download the sketch from my github https://github.com/tommykho/IOT-cookbook
8. Extract and create a folder "espgfxGIF" from the zip file.
9. Put your own animated GIF files on the "espgfxGIF/data" folder. Please note most esp32 DEV module only have 1Mb of SPIFFS. Limit your total file size to 900Kb.
10. Open the "espgfxGIF.ino" with your Arduino IDE.
11. Connect your DEV module to your Arduino IDE. Select the correct COM port.
12. Edit your own settings with the Module and GIF file that you used.
// *** BEGIN editing of your settings ...
//#define GIF_FILENAME "/suatmm_240x135.gif" /* comment out for random GIF */
// *** END editing of your settings ...
13. Select "Tools, ESP32 Sketch Data Upload" to upload the GIF files to the SPIFFS of your DEV Module.14. Click "Upload" to compile and upload the sketch to your DEV Module.
If you are not using m5Stack m5StickC or TTGO T-Display, please add your own configuration to the script after line 52. You need to declare your canvas and data-bus class, MOSI, SCLK, CS, DC, RST, BL pins, as wells as control button pins
in the configuration. If you need help on the configuration, please leave a comment or visit
/* Raspberry Pi Pico with GC9A01 display */
Arduino_G *output_display = new Arduino_GC9A01(bus, TFT_RST, 0 /* rotation */, true /* IPS */);
Arduino_GFX *gfx = new Arduino_Canvas(240 /* width */, 240 /* height */, output_display);
Arduino_DataBus *bus = new Arduino_RPiPicoSPI(27 /* DC */, 17 /* CS */, PIN_SPI0_SCK /* SCK */, PIN_SPI0_MOSI /* MOSI */, PIN_SPI0_MISO /* MISO */, spi0 /* spi */);
- Only play a single GIF file in a loop until the power cycle
- Brightness control is not working with M5Stack-C
- Minor artifact with M5Stack-C
- Multiple devices sync (playing GIF/MPEG in synchronization)
- Gesture control with IMU
- Play multiple GIF files in a loop
- MP3 or Radio playback (see my other projects)
- BLE connection for wireless GIF upload (similar to Wireless Image Transfer with Circuit Playground Bluefruit and TFT Gizmo)
- IFTTT and MQTT integration for remote power cycle or GIF change
- MJPEG support (live webcam or IP CAM)Multiple