Depicting a datalogging .csv file on TFT 2.2 Inch Display

I have a .csv file with 2 columns. The first keeps timestamps and the second keeps temperature. I need to make a graph on this display https://forum.arduino.cc/t/qvga-2-2-inch-tft-spi-240x320-ili9341-is-not-working-solved/454914, https://www.instructables.com/Cheap-TFT-22-inch-Display-on-Arduino-ILI9340C-or-I/ where on y -axis it will depict the temperature.. on real-time (ok 5 sec - 10 sec delay is ok). I use Arduino MEGA 2560 R3. Any ideas?

  • How does the CSV file get into the Mega: serial input, SD card?
  • Will you perform any analysis on the data-set: average, high, low?

There are a number of options:
https://www.google.com/search?q=arduino+csv+to+array
which may be applied depending on your ultimate data requirement.

Any display generally works with characters for display; thus a number would be converted to ASCII and the characters displayed beginning at some (X, Y) which is most often user specified along with the format desired (integer, floating.) Character strings are displayed at (X, Y) for some length (specified or free-form.)

For graphics, Adafruit has a good PDF:
https://cdn-learn.adafruit.com/downloads/pdf/adafruit-gfx-graphics-library.pdf

Remember, the ILI9341 display is a graphic display and text is displayed by converting the character to a group of graphic pixels.

1 Like

I find it beneficial to make notes for each project to help with on-screen positioning of display variables.

From an old project:

/* 
Pin connections:
    #define TFT_DC 12
    #define TFT_CS 13
    #define TFT_RST 14
    the rest of the pins (MISO,MOSI,SCK) are the standard SPI pins of your mini.



  ILI9341 TFT GLCD display connections for hardware SPI:
  Signal           Maple Mini           Leonardo      LCD Display    UNO pins
  ===============  ===========          ========      ===========    ========
  #define _sclk         6         //         15       J2 pin 7          13
  #define _miso         5 NC      //         14          pin 9          12
  #define _mosi         4         //         16          pin 6          11
  #define TFT_CS       13         //         10          pin 3          10
  #define TFT_DC       12         //          9          pin 5           9
  #define TFT_RST      14         //          8          pin 4           8


 Color definitions for TFT SPI 2.2" Display
    ILI9341_BLACK   0x0000
    ILI9341_BLUE    0x001F
    ILI9341_RED     0xF800
    ILI9341_GREEN   0x07E0
    ILI9341_CYAN    0x07FF
    ILI9341_MAGENTA 0xF81F
    ILI9341_YELLOW  0xFFE0  
    ILI9341_WHITE   0xFFFF


**************************** ILI9341 320x240 DISPLAY LAYOUT ****************************
0,0
----------------------------------------------------------------------------> 319
| nnnT                                                                 DOW
|              lcd.fillRect( 0,  0, 319, 59, 0);     // blank top
|
|
|<- 059 
|
|              lcd.fillRect( 0, 60, 319, 114, 0);     // blank middle
|                              HH:MM:SS A
|
|
|
|<- 174
|              lcd.fillRect( 0, 175, 319, 64, 0);     // blank lower
|
| MON DD YYYY
|
|<- 239
*/

1 Like