The Adafruit TFT 2.8 inch 320x240 Touchscreen with microSD is a versatile and high-quality display module that features a 2.8-inch TFT LCD with a resolution of 320x240 pixels. This display is equipped with a resistive touch panel, allowing for user input and interaction, and a microSD card slot for additional storage capabilities. It is commonly used in embedded systems, DIY electronics projects, and interactive applications such as digital interfaces, gaming devices, and portable instruments.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V) |
2 | GND | Ground |
3 | CS | Chip Select for the TFT display |
4 | RESET | Reset pin for the TFT |
5 | D/C | Data/Command control pin |
6 | MOSI | SPI Master Out Slave In |
7 | SCK | SPI Clock |
8 | MISO | SPI Master In Slave Out |
9 | T_CS | Touchscreen Chip Select |
10 | SD_CS | microSD Card Chip Select |
Before using the display, you need to install the Adafruit GFX and ST7735 libraries. You can install these through the Arduino Library Manager.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
// Pin definitions
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8
#define TFT_MOSI 11 // Data out
#define TFT_SCLK 13 // Clock out
// Initialize Adafruit ST7735 TFT library
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
void setup() {
Serial.begin(9600);
tft.initR(INITR_BLACKTAB); // Initialize display
tft.fillScreen(ST7735_BLACK); // Clear the screen to black
}
void loop() {
// Example: Draw a red filled rectangle
tft.fillRect(10, 10, 50, 50, ST7735_RED);
delay(500);
// Example: Draw a green filled circle
tft.fillCircle(90, 60, 30, ST7735_GREEN);
delay(500);
}
Q: Can I use this display with other microcontrollers besides Arduino?
A: Yes, the display can be used with any microcontroller that supports SPI communication, provided that the logic levels are compatible.
Q: Is the touch panel multitouch?
A: No, the resistive touch panel is single-touch.
Q: How do I store images on the microSD card to display them on the screen?
A: Images can be stored on the microSD card in a compatible format (e.g., BMP). Libraries such as Adafruit_ImageReader can be used to load and display images from the card.
Q: Can I power the display with 3.3V?
A: Yes, the display can be powered with 3.3V, but ensure that the logic levels match the power supply to avoid damaging the display.