The Adafruit 2.8 inch Captouch TFT is a vibrant, colorful touch screen display module that offers a compact and interactive interface for your projects. With a 2.8-inch diagonal, it features a 320x240 pixel resolution and capacitive touch sensing, which can detect finger presses with high accuracy. This module is ideal for building user interfaces for microcontroller-based projects, such as DIY electronics, home automation systems, and handheld instruments.
Pin Number | Name | Description |
---|---|---|
1 | VIN | Power supply (3.3V to 5V) |
2 | GND | Ground connection |
3 | CS | Chip Select for SPI |
4 | RESET | Reset pin |
5 | D/C | Data/Command control pin |
6 | MOSI | SPI Master Out Slave In |
7 | SCLK | SPI Clock |
8 | MISO | SPI Master In Slave Out (not used) |
9 | STMPE_CS | Chip Select for touch controller |
10 | LITE | Backlight control pin |
Power Connections: Connect the VIN pin to a 3.3V or 5V power supply, and the GND pin to the ground.
SPI Connections: Connect the SCLK, MOSI, and CS pins to the corresponding SPI pins on your microcontroller. The MISO pin is not used for this display.
Control Pins: Connect the RESET and D/C pins to any available digital I/O pins on your microcontroller.
Touch Controller: Connect the STMPE_CS pin to another digital I/O pin for the capacitive touch controller.
Backlight Control: The LITE pin can be connected to a PWM-capable pin for backlight brightness control or to a digital I/O pin for on/off control.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h> // Touch library
#define LCD_CS A3 // Chip Select
#define LCD_CD A2 // Command/Data
#define LCD_WR A1 // LCD Write
#define LCD_RD A0 // LCD Read
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
// Initialize Adafruit TFTLCD library with the hardware-specific configuration:
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
void setup() {
Serial.begin(9600);
tft.reset();
uint16_t identifier = tft.readID();
tft.begin(identifier);
tft.fillScreen(BLACK);
tft.setCursor(0, 0);
tft.setTextColor(WHITE);
tft.setTextSize(1);
tft.println("Hello, world!");
}
void loop() {
// Main loop - add your code here to interact with the display
}
Q: Can I use this display with a 5V microcontroller like an Arduino UNO? A: Yes, the display can be used with a 5V microcontroller, but ensure that the logic levels for the SPI and control pins are shifted down to 3.3V if necessary.
Q: How can I adjust the brightness of the display? A: You can adjust the brightness by applying a PWM signal to the LITE pin.
Q: What should I do if the display is not responding to touch? A: Check the connection to the STMPE_CS pin and ensure that the touch controller is properly initialized in your code. Also, make sure that the screen is clean and free of any debris that might interfere with touch detection.