This repository is modified based on ESPGIF by shraiwi. It can display GIF for ESP8266 with SSD1306 OLED screen.
I hope everyone who has SSD1306 and struggling of converting GIF and displaying GIF on it will find this repository helpful!
This project is based on ESPGIF by shraiwi.
Now the GIFCovert can be used for any size of GIF and convert into a size that you want.
GIFDisplay in the folder GIFDisplay is being changed based on the use of SSD1306 instead of SSD1351 OLED screen.
GIF.h in the folder ExampleGIF is an example of convertion with the example gif in the ExampleGIF folder.
(The example uses SSD1306 NOT SSD1351 OLED screen)
I used an online GIF editer called EZGIF to adjust my GIF to the resolution I want and the size can be loaded into ESP8266.
(Due to the fact that most ESP8266 development boards have little flash memory)
YOU NEDD TO PUT THE CONVERTED FILE(GIF.h) IN THE SAME FOLDER WITH GIFDisplay.ino or GIFDisplayOld.ino or CHANGE THE CODE DEPENDING ON THE SCREEN YOU HAVE.
The change in each file will be described in detail in the README in each folder.
The wiring of SSD1306 and SSD1351 is very different.
SSD1306 | ESP8266 |
---|---|
GND | G |
VCC | 3V |
SCL | D1 |
SDA | D2 |
Here is a video of the final effect with the example GIF in this repository:
ExampleDisplay.mp4
Sorry for the poor video quality:(
ESPGIF https://github.com/shraiwi/ESPGIF
and its author
shraiwi https://github.com/shraiwi
This repository is licensed the same as the repository this repository is based on - Apache License 2.0
BEARING IN MIND that this NEW repository is suitable for SSD1306 NOT SSD1351!!!
ESPGIF is a project which uses an ESP8266, and an SSD1351 OLED display to display a GIF! This project has the Arduino Code and a tool to convert the GIF into a byte array.
This a quick tutorial on how to use the library.
You will need:
- An ESP8266
- A SSD1351 OLED display
- Python 3.7
- The PILLOW Library
- TKinter (comes preinstalled with newer versions of python)
- Arduino IDE
- I have a repository with the modded Adafruit GFX (Allows for fast SPI transfers)
- The Adafruit_SSD1351 library
- Note: Both of the libraries are bundled in the "libraries" folder.
Make sure you have all of the stuff listed above. If not, download and/or buy the required materials.
Go ahead and download the repo and unzip it.
- Drag the files in the
libraries
folder into the Arduino'slibraries
folder, or just use the library importer.
Drag the GIFDisplay
folder into your Arduino projects folder, and open the GIFDisplay.ino
script.
There are two files:
GIFDisplay.ino
- Contains code to display the data.
GIF.h
- Contains the actual image data
Drag the "GIFConvert" folder wherever you want (I recommend your "Documents" folder)
Now that you've set up the project, let's actually display a GIF!
Here's the wiring diagram:
OLED | ESP8266 |
---|---|
SCLK | GPIO14 |
MOSI | GPIO13 |
DC | GPIO5 |
CS | GPIO15 |
RST | GPIO4 |
Note: The SCLK and MOSI pin mappings are immutable because the library requires hardware SPI for a viewable framerate.
Once you have the pins connected go ahead and upload the sketch. If you did it right, you should see a spinning globe!
So, you wanna display your own GIF?
Don't worry, this is going to be easy!
Remember the GIFConvert folder? Go ahead and open it and find the python script called, GIFConvert.py
. Run it. It'll open a file selector. Choose your desired GIF, and press "Open". It will convert the image into an Arduino-readable format and open a .txt file containing the byte array.
Use Ctrl+A/⌘+A to select all of the text in the open file, and use Ctrl+C/⌘+C to copy it to your clipboard.
Open the GIF.h
file in the GIFDisplay
folder, and use Ctrl+A/⌘+A to select all of the text, and then Ctrl+V/⌘+V to copy over the text.
Upload the code, and you should see the updated GIF!
If there is an error compiling, the GIF is probably too big. Choose a shorter/ lower framerate GIF and repeat this process.