How can I display image data from serial on TFT display without an SD card

Hello, I am pretty new to arduino but I have some programming experience. I've been looking at many guides for displaying images on a TFT LCD display but almost all of them use an SD card to hold image data, since the arduino uno onboard memory is too small.
The problem is, for my application, I need any image to be sent from my computer to the arduino through USB during runtime, so preloading images onto an SD card isnt going to work. My arduino uno will be plugged into my computer 24/7. Surely this is possible but Ive been having lots of trouble with where to start. My goal is to have an image on my computer, process it through a script to turn it into a c string and as close to 240x360 as possible, send that data over usb to my arduino and display it in realtime.

Define "real-time"

Very good question. A display and a (I assume) color 240 x 360 pixel image driven by an Arduino Uno is a pretty sloooow combination.

You will need a TFT display that has the display buffer in internal memory, with a data transmission protocol that allows write access to individual pixels.

Many popular TFT displays use the Arduino memory as the display buffer, but the Uno does not have enough memory for a 240x360 image.

Fair enough, I guess I shouldnt say "real-time" I mean that I can change the display while it is running without having to restart the script. If it takes a few seconds to a minute or two to update should be okay. (Yes it is a 65k color display)

I suppose the images dont have to be the full 240x360 resolution

According to your requirements, it seems to me that it is possible. You might consider sending the data in batches to the Arduino being careful not to overflow the serial buffer and possibly have a confirmation from the Arduino that it received the data successfully.

One thing you are going to have to deal with is stripping the pixel data from your images and saving the data to a binary file.

This article will give you insight.

A Google search for RGB 565 converter should bring up an online tool or lead to program examples you can use to convert your own files. The RGB 565 format is probably what you will use to fill your display, each pixel has a 16 bit value 5 bits of red 6 bits of green and 5 bits of blue, the 16 bits are split into two bytes when written to file. So for example a 240 X 360 display has 86,400 pixels and your image file, for full screen, will have two bytes for each pixel making the file 172,800 bytes. Reducing image size is an option, a 240 X 180 image should theoretically write in half the time as a full screen image but if you are not too concerned about how long an image takes to fully display then full screen won't be any more difficult to achieve than a smaller image.

I think you need to start thinking about the PC software you are going to need to write an image to the display via an arduino, and also think whether your software will do the conversion or if you might use an online converter.

On the arduino side using an online 565 converter to produce an image file of a smaller scale should allow you to write this smaller image into arduino PROGMEM and develop the arduino/display side of things.

The Arduino Uno has around 1K bytes of memory available for a display buffer. That is 500 pixels with 65K color resolution (10x50).

Be realistic and use something like an ESP32 for your project, which is not only cheaper than a genuine Uno, but can handle much larger displays than 240x360.

1 Like

something like, say split the image into four quadrants and send/display each quadrant individually one after the other replacing the previous quadrant data in memory? would that work?

would it be helpful to buy an sd card module for the uno to allow me to display 240x360 color images? Im still a beginner to arduino and microcontrollers and Im not sure I want to learn a whole new microcontroller for this.

No. An SD card, like another computer, is just a place to store image data. You still need to transfer the image data to the display, and the Uno is totally unsuitable for the project, unless you find a display that has an externally addressable image buffer.

This 128x160 display is one such, and there are undoubtedly others.

In fact, many of the projects that you have already looked at, where the image is stored on an SD card, could be modified take the image data from an external computer instead.

On the computer, you can use a program written in Processing to prepare and send the data.

In my opinion you would need to split the screen into much smaller areas instead of just 4 quadrants. Also, even if you use an ESP8266 microcontroller you will have a big advantage because there is much more memory and the communication with the display is much faster.

I also think of Nextion displays, but I have no experience with them - they have a built-in microcontroller, a chip with several MB of memory and a slot for a memory card.

Your project is not one of the simplest and to realize it you will have to learn a lot of new things.

ok thank you for the tips, I'll consider using a different microcontroller since I'm getting a lot of feedback that the arduino uno isnt the best suited for this project. I actually have an ESP32 lying around but Ive never used any projects on it

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.