Elegoo 2.8 tft arduino data graph

Hello dear Arduino Friends!!

I have an Elegoo 2.8 TFT screen and an Arduino UNO.

I know that in Arduino you can easily plot data, i.e from sensor on a graph.

I want to do the same with the Elegoo 2.8 TFT. Getting data from an analog sensor and plot them on a data graph. Is there anything you can propose?

Search for ILI9341 and you will find some examples.

Read the data, calculate the X and Y coordinates on the screen to write to and turn on the pixel at that point

Where are you stuck ?

I will try that!

Example from the video:

#include <Adafruit_TFTLCD.h> 
#include <Adafruit_GFX.h>    

#define LCD_CS A3 
#define LCD_CD A2 
#define LCD_WR A1 
#define LCD_RD A0 
#define LCD_RESET A4 

#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

float volt = 0;
int adcRaw = 0;
int x = 1;

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

void setup() {
  tft.reset();
  tft.begin(0x9325);
  tft.setRotation(1);
  tft.fillScreen(BLACK);
  
  tft.setCursor(70,30);
  tft.setTextColor(WHITE);
  tft.setTextSize(4);
  tft.print("Electgpl");
  
  tft.setCursor(70,100);
  tft.setTextColor(BLUE);
  tft.setTextSize(4);
  tft.print("ADC PLOT");
  
  tft.fillRect(40,160,240,60,RED);
  tft.drawRect(40,160,240,60,WHITE);
  tft.setCursor(55,175);
  tft.setTextColor(WHITE);
  tft.setTextSize(4);
  tft.print("SUSCRIBE!");
  
  delay(3000);
  tft.fillScreen(BLACK);
}

void loop(){
   tft.fillRect(10,10,115,35,BLACK);
   tft.setCursor(10,10);
   tft.setTextColor(CYAN);
   tft.setTextSize(5);
   adcRaw = analogRead(A5);
   volt = adcRaw * 5.0 / 1023.0;
   tft.print(volt);
   
   tft.setCursor(140,10);
   tft.setTextColor(WHITE);
   tft.setTextSize(5);
   tft.print("V");
   
   tft.drawRect(0,80,319,130,MAGENTA);
   tft.drawCircle(x, map(adcRaw, 0, 1023, 200, 100), 2, GREEN);
   x=x+3;
   if(x>318){
      x=1;
      tft.fillRect(1,90,318,110,BLACK);
   }
   
   delay(200);  
}

Thanks

I am reviewing it. I have a PH meter reading analog data so I want to see how it will plot them!

With some experience you can take a look in this piece of code.

So you could get something like this:

The side button should be removed since your TFT is smaller.

The TFT in the picture is 400 x 240.

I'm using this library that also is compatible with ILI9341.

can anyone solve my error i cant able to display anything using my display just display the white

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 95 95 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 3F 3F 3F 3F 3F Status Register
reg(0x000A) 00 00 Get Power Mode
reg(0x000C) 01 01 Get Pixel Format
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 00 Panel Himax HX8347-A
reg(0x00A1) 00 00 00 00 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 00 Inversion Control
reg(0x00B6) 00 00 00 00 00 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 00 00 00 Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 00 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 00 00 NVM Read
reg(0x00D3) 00 00 00 00 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek ID
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 GAMMA-P
reg(0x00E1) 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 GAMMA-N
reg(0x00EF) 14 14 14 14 14 14 ILI9327
reg(0x00F2) 08 08 08 08 08 08 08 08 08 08 08 08 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

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