Creating Animation on OLED Display with EDU PICO

Creating Animation on OLED Display with EDU PICO

In this tutorial we are using EDU PICO OLED display. You can also using other OLED display to follow up with this tutorial.


Video Tutorial


To create an animation for an OLED display, you'll need a GIF file and Python installed on your system. Follow these steps to convert the GIF file to BMP format and display it on your OLED screen:


1. Obtain a GIF File:

You can create a GIF using various online tools like EZGIF.

If you don't have GIF file, you can download the example code and images from this Github repository.


2. Convert GIF to BMP using Python:

Ensure you have Python installed on your system (not CircuitPython). You can utilize the pre-installed Python from Thonny IDE.


2.1. Installing Python Libraries:

  • Open Thonny IDE and navigate to Tools > Manage Packages...


    • Search and install the following libraries:
      • Pillow-PIL
      • Numpy


    2.2. Convert the GIF image to BMP:

    Create a Python script named and add the following code:


    Inside this code, please change the INPUT_FILENAME to your GIF filename. You may need to adjust the BW_THRESHOLD to adjust the output image visibility. OUTPUT_SIZE is based on the OLED size. Toggle the INVERT_COLOUR if you want the image to be negative.


    Ensure that your GIF file is in the same directory as the Python script. Run the script to convert the GIF to BMP format.


    The output from this script will produce an array of images from the GIF image arranged horizontally, and the output frame. Please keep note of the number of frames because later you will use it in the next code.



    3. Displaying the Animation on OLED:

    Copy the generated BMP file to your CIRCUITPY drive and execute the script. This script will display the animation on your OLED screen.


    Make sure to edit the BMP_FILENAME according to the number of frames you obtained previously.


    By following these steps, you can easily convert a GIF animation to BMP format and display it on an OLED screen using Python.


    Hardware Components