I had some time today to experiment with using the SPI FLASH FILING SYSTEM (SPIFFS) of the NodeMCU to store images and to retrieve and render on the TFT.
The memory used by SPIFFS is already on the NodeMCU and provides up to 3Mbytes of storage. This is sufficient to hold about 18 full screen, full colour 16 bit images. These image files are 150kbytes each ( calculated from screen pixels count and 2 bytes per pixel).
Performance is surprisingly good considering both the FLASH memory and TFT are SPI serial devices. The sketch generates some statistics for performance evaluation and copes with 2 different raw image (16 bit colour) formats with different byte orders.
The “best” performance is with 40MHz SPI clock to the TFT, in that case a full screen image of 320x240 pixels is copied from FLASH to TFT in 118ms. Most of this time is taken up by the SPIFFS pulling the image off the FLASH memory.
The typical setup for a NodeMCU1.0 (ESP-12 Module) is :
Display SDO/MISO to NodeMCU pin D6 <<<<<< This is not used by the library Display LED to NodeMCU pin 5V or 3.3V Display SCK to NodeMCU pin D5 Display SDI/MOSI to NodeMCU pin D7 Display DC/RS (or AO) to NodeMCU pin D3 Display RESET to NodeMCU pin D4 Display CS to NodeMCU pin D8 Display GND to NodeMCU pin GND (0V) Display VCC to NodeMCU pin 5V or 3.3V
See the header and comments in the sketch for more information on how to get it running.
I also have a sketch that renders JPEG compressed images from SPIFFS to the screen if anyone is interested. Many more full screen images (100 maybe?) can be stored but there is a performance penalty in the decompression as that involves a whole stack of maths, the performance may be acceptable though at 250-350ms per full screen image.
I’ve tested most features of the sketch but if you find a bug then post it here.
Update 23rd March 2019. A new example “ESP8266_draw_565_image3” suitable for the TFT_eSPI library is attached.
ESP8266_TFT_SPIFFS.zip (305 KB)
ESP8266_draw_565_image3.zip (314 KB)