Using Elegoo 2.8 TFT with Elegoo mega2560

I will start by saying I am 100% new to arduino’s. I bought the Elegoo mega2560 starter kit and the Elegoo 2.8 in TFT touchscreen from Amazon specifically to use together and have access to the SD card slot. Everything indicated they were 100% compatible. Got the items and have been working through demos with no issues until i tried to access the sd card. The tft does work with the mega board when installed on the pins - you just cannot access the sd card. I have tried searching everywhere but cannot find anywhere I can find a clear explanation of how to make the two talk AND let me access the sd card. I think I can wire the board to the screen without installing it directly onto the mega board, but that is where my knowledge ends. I need to know where to land the screen pins onto the mega board in order to use the screen AND access the sd card.

I would also appreciate help with what drivers to use. I have been using the Elegoo provided libraries and they seem to work fine. Most sites seem to reference Adafruit libraries or UTFT libraries. I have not been able to get any sample code working with anything other than the Elegoo libraries. I just cannot access the sd card which was the whole reason i bought it.

Any help would be greatly appreciated.

SWFanMan:
I will start by saying I am 100% new to arduino’s. I bought the Elegoo mega2560 starter kit and the Elegoo 2.8 in TFT touchscreen from Amazon specifically to use together and have access to the SD card slot. Everything indicated they were 100% compatible. Got the items and have been working through demos with no issues until i tried to access the sd card. The tft does work with the mega board when installed on the pins - you just cannot access the sd card. I have tried searching everywhere but cannot find anywhere I can find a clear explanation of how to make the two talk AND let me access the sd card. I think I can wire the board to the screen without installing it directly onto the mega board, but that is where my knowledge ends. I need to know where to land the screen pins onto the mega board in order to use the screen AND access the sd card.

I would also appreciate help with what drivers to use. I have been using the Elegoo provided libraries and they seem to work fine. Most sites seem to reference Adafruit libraries or UTFT libraries. I have not been able to get any sample code working with anything other than the Elegoo libraries. I just cannot access the sd card which was the whole reason i bought it.

Any help would be greatly appreciated.

Did you get a CD with tutorials with the TFT ?
If you didn't, you can download it ELEGOO 3D Printers, Arduino Kits & Robots Tutorials Download – ELEGOO Official
There is an example on accessing the SD card.
You will have to use different pins since the Mega and the Uno have different SPI pins.

I do have the PDFs and have the TFT working fine when installed on the mega board. I just cannot access the SD card. I have the pin info as well, but where to properly connect them to the mega board is where I need help. I have found different sites with different pin connections and none of them seem to work. I was hoping someone out there had the same setup or comparable that could share a picture and details as to how they connected the pins to allow access to the SD card and screen.

The sketches tell you which pin to use.
Did you bother reading them?

I did, but as I mentioned- I am a complete novice at this and as such I get timid to go attaching pins differently than was designed (the shield was designed for an Uno board I found out after the fact). That plus the PDF is in broken english and seems to contradict other sources for info. I have stumbled upon a few sites that seem to have information that lines up. Some pins are no brainers - 5v, gnd, and the like all have a place to land. My confusion is the LCD pins and SD card pins. Some locations say use pins 20-29 or so for the lcs and 50-53 for SD card, but then other sources say to land the lcd pins on digital pins 1-10 (or whatever the pins are that line up if you plug the shield in directly). I am not in front of my board right now, but will be experimenting more tonight after i get home. As a newbie, I was just hoping that someone else had already done exactly what i am trying and could easily post a pic or schematic that I could use to verify or debunk what I have pieced together. In addition, I was hoping someone could comment on the libraries- use the vendor provided ones or something else like the UTFT libraries.

I went back after reading your post because I thought perhaps I didn’t ready everything. The problem with the documentation is it shows the pins for the Uno and Mega board but they are shown for use of the TFT without access to the SD card. At the very end it states that to access the SD card when using the mega board the pins are different (It actually just states that “SPI IO is different on mega) with no details as to what pins go where on the mega. So I am back to trying to deduce where the SD card pins should land not he mega board as well as verify where the LCD pins should land in order to use the full capabilities of the board.

It is a regular "Blue 2.8 inch Mcufriend" shield.

It should work with MCUFRIEND_kbv library. (Install with the Library Manager)

MCUFRIEND_kbv has a showBMP_not_Uno example sketch.
Follow the instructions and the microSD will work on your Mega2560. (Yes, you must install and configure the SdFat library)

Yes, these shields are designed for a Uno. But everything will work when plugged into Mega2560, Zero, Due, Nucleo, ...

David.

Thanks for the information, David - I will try this tonight. As a newbie to the whole arduino thing, I was hoping to clarify some terminology. When you say install and configure the SD Fat Library - what exactly do you mean? I think the install part means I need to copy the files into my sketchbook and not really install anything like a traditional program. But configuring the SD Fat library - do you mean to configure it for MEga board vs Uno board? If so, what program do you use for that editing - text editor or something else? Right now I am using a Mac so I need to use something Mac friendly. I do not think I have any type of code program - no XCode or anything. Aside from the configure part, I have the two libraries copied down and will unzip them to the sketchbook folder / library folder tonight. Once I know how to edit the SD Fat library I will work on that and begin to play around per your instructions. Thanks again.

You install a library from the Sketch tab in the IDE. Select Library Manager.
Then choose a candidate. e.g. Adafruit_GFX, MCUFRIEND_kbv, SdFat

The IDE does everything for you.

The library examples should all work out of the box.
However the showBMP_not_Uno example tells you to edit the user_setup file in the SdFat library.

Yes, it is a faff to edit a config file. But this only involves changing a 0 to a 1 or add/remove comment characters (slash)

David.

Thank you Thank you Thank you. It took me some messing around to get the libraries installed right - newbie mistakes compounded by me deleting things and moving things around. Once I doubled back and started fresh following your instructions I got it. I have some adjustments to do to change orientation of the images but it now works displaying images on the screen while installed on the mega board as it should be. I am going to make some more tweaks and mess around more before I post my final code back here for others to benefit from.

Thanks again so much - I had been banging my head against the wall for two days.

I have had a day or so to play around and do some more work. I have the images changing appropriately and I even modified it to add some text with a custom font over each image - all the way I want it. Then I got to thinking. I am familiar with general computer coding - mostly in MatLab. And I am wondering if Arduino follows the same basic processes. For instance, in Matlab, if I wanted to make two different loops - (1) to increment a number from 1 to 10, 1 at a time and then (2) a second loop that increments a number from 100 to 1000 by 100 - i would write the two loops and I could do one of two things.

Approach 1:
Write the first loop with the second loop nested. Using this approach, every iteration would see the first variable increase by 1 and the second loop would then go through all iterations before looping back to the start of loop 1, increase by 1, then start loop 2 all over again.

Approach 2:
Write the two loops independently so that when I run the program, loop 1 goes through all iterations then starts loop 2 that goes through all iterations.

With all these inputs on this mega board, what I am wondering is - can you create two distinct loops in the arduino code that run simultaneously? For instance, can I have my images on a loop as I have right now, then add a second loop that flashes some LED lights at a pre-defined sequence? Or does the arduino code perform like one of the approaches above? Assuming it behaves like other programs (Matlab in my case), my thought is that I can take my delay line right now and replace it with a second loop that runs for the same amount of time, acting like a delay but flashing LED lights instead.

My ultimate question is this - is there a way to use the arduino to run two or more different actions at the same time by using different loop arguments? Or does everything have to be in a single loop argument?

Annoyingly, I have found the information you need on an Amazon review, of all places! Link: Amazon.com: Customer reviews: ELEGOO UNO R3 2.8 Inches TFT Touch Screen with SD Card Socket w/All Technical Data in CD for Arduino UNO R3

And in case it moves or drops off:
"THIS IS SO COOL! I can't believe it was so inexpensive! With the included disc I had all the demos working on my Uno in minutes. Product arrived well packaged and was ready to attach to my Arduino with no soldering required. The disc included six ready-made demos to try along with the required libraries that you'll need to copy into your libraries folder. For the price it's going to be a great way to learn how to integrate a touchscreen into my projects.

UPDATE: I originally tested this touch screen on a Uno, I wanted to try it on a Mega. One of the examples listed what pins to use but wasn't clear (to me at least) in what order I needed to use them. Another example on the CD spelled it out better. Here's the pins I used to get it working, you may need to alter the pin numbers in your sketch so everything matches (pins A0 THRU A9 are hooked to sensors on my Mega so that's why I moved the screen to pins A10-A14):

LCD_CS to pin A13
LCD_RS to pin A12
LCD_WR to pin A11
LCD_RD to pin A10
LCD_RESET to pin A14
D0 to pin 22
D1 to pin 23
D2 to pin 24
D3 to pin 25
D4 to pin 26
D5 to pin 27
D6 to pin 28
D7 to pin 29
SD_SS to pin 53
SD_D1 to pin 51
SD_D0 to pin 50
SD_SCK to pin 52

Hope it helps!"

You might have found another answer in the meantime, in which case sorry I've necro'd an old post, but I'm going down the same path right now!