2

I am new to arduino and I am wondering if it is possible to store image data on my computer and send it to my arduino over the USB cable (which is also used for power) to display on a TFT LCD display I have hooked up. All the tutorials I see involve using an SD card to preload the image data on there beforehand.

Still, my display doesn't have an sd card slot, nor is it practical for my application as the images I want to display will be determined during runtime. I have sent small pieces of data over the COM port to my arduino from my PC but I don't know how I could do it with potentially large image data. The arduino will be plugged into my computer 24/7. If this is possible could I get a little guidance on where to start? Thank you

1
  • 1
    receive the data and display it as it is being received
    – jsotola
    Jun 16 at 5:37

3 Answers 3

3

Since you don't give a clue about the TFT you have in mind, I'll try to describe the process using the following assumptions about the TFT that have to be true for the rest to work:

  • one full frame of pixel data for the TFT used would not fit into the Arduinos RAM, but one line of that frame will,
  • the pixel data can be sent line by line to the TFT without a need to start the next line inside a certain timeframe (i.e. you could, in theory, just tell the TFT to update line 42 out of order, as an example),
  • the TFT has its own way of remembering its display data (i.e. does not need a continuous refresh 60 times per second).

In this scenario, your image processing pipeline looks like this:

  • A program running on your PC decompresses (and possibly resizes) the image file in order to get access to the raw pixel data as it would be displayed on the TFT. This means that this program needs to know the resolution and "data feeding order" of your TFT.
  • This process then takes one line of the raw pixel data and converts it into a data package to be sent over the serial port. You will need to devise a communication protocol here that your Arduino sketch can work with. The easiest, but not most efficient, way would be to convert it into Base64, because libraries for that exist in practically every language and platform and you are then able to use text-based delimiters like a line break to mark the end of a pixel data line. (Sending binary data is more efficient, but harder and more prone to sychronization errors, because you have no in-band signalling of "end of data line".)
  • Your Arduino sketch reads that data package (if Base64-encoded: by using Serial.read until you encounter a line break) and converts it back to raw pixel data, in whatever format your TFT (or library for that TFT) needs the data (it might require the color format in e.g. GRB instead of RGB).
  • This raw pixel data line is then sent to the TFT.

You will have to determine the baud rate you can send over your serial link (determined by maximum baud rates of both PC and Arduino, and sometimes the cable quality in between). Keep in mind that a serial connection is slow; you probably will be able to watch the image rendering on the TFT line by line.

You may be able to make this more efficient by employing something like RLE (Run-Length Encoding) on the pixel data sent over the serial line, but that would be another iteration of your protocol.

3
  • Perhaps I am wrong, but TFT LCD stands for Thin Film Transistor LCD, correct? This description applies to many types of LCDs. The vast majority of them do not work as described in the answer. Specifically, it will be very difficult to impossible for an Arduino Uno to display anything on a vast majority of TFT LCDs.
    – st2000
    Jun 17 at 13:22
  • @st2000 OP insinuated that they already have found a tutorial to display something on their TFT, so I stated in my assumptions what that TFT or library must be able to do in order to support this solution.
    – orithena
    Jun 19 at 16:23
  • Ok. Say so in the answer (something like: I assume you have this or that smart serial port LCD) and I'll upvote it. Recall that the point of stackexchange sites are to help other people with similar problems find clear / concise answers.
    – st2000
    Jun 19 at 19:38
1

You could "stream" the data from the PC to the LCD, which means you wouldn't need to store it (or maybe store a line or so).

Without knowing which Arduino and which LCD it is hard to give more advice than that.

0

There are so many different LCDs that with out specifying a specific LCD only very general answers can be provided that may be of limited value.

  • Just about all Arduinos can handle an Alpha Numeric LCDs. But these have very limited graphics, if any.

enter image description here

enter image description here

  • Most can handle sending geometric shapes and alpha numeric to (smart) Serial Port Color LCDs. Only some Arduinos will be able to handle sending arbitrary images (like a photograph) to (smart) Serial Port Color LCDs.

enter image description here

And few will be able to handle sending data to a common TTL or LVDS Color LCDs.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.