1.54英寸240x240 IPS TFT LCD顯示模塊:高分辨率與低功耗的完美結(jié)合
在電子設(shè)計(jì)領(lǐng)域,顯示模塊的性能對于產(chǎn)品的整體表現(xiàn)至關(guān)重要。今天要給大家介紹一款極具特色的1.54英寸240x240 IPS TFT LCD顯示模塊,它以高分辨率、低功耗等優(yōu)勢,在眾多顯示應(yīng)用場景中脫穎而出。
文件下載:DFR0649.pdf
一、模塊特性
1. 高分辨率與小尺寸
該模塊采用1.54英寸的IPS顯示屏,具備240×240的分辨率,能夠提供清晰、細(xì)膩的顯示效果。小尺寸的設(shè)計(jì)使其在空間有限的應(yīng)用場景中也能完美適配,如電子禮品盒、電子天氣裝飾品等。
2. 低功耗設(shè)計(jì)
模塊可在3.3V - 5V的電壓下工作,最大功耗僅為24mA,全屏功耗約為17mA(3.3V和5V時(shí)典型值)。這種低功耗特性使得它在對功耗要求較高的設(shè)備中表現(xiàn)出色,能夠有效延長設(shè)備的續(xù)航時(shí)間。
3. 寬視角與易接線
IPS顯示屏提供80/80/80/80的視角,無論從哪個(gè)角度觀看,都能獲得清晰、準(zhǔn)確的顯示效果。同時(shí),模塊采用SPI和GDI接口,與帶有GDI端口的主控制器配合使用,大大降低了接線的復(fù)雜度。
二、規(guī)格參數(shù)
| 參數(shù) | 詳情 |
|---|---|
| 工作電壓 | 3.3V - 5V |
| IPS視角 | 80/80/80/80 |
| 顏色深度 | 16位(RGB565) |
| 像素 | 240 × 240 |
| 連接端口 | SPI |
| 驅(qū)動芯片 | ST7789 |
| 亮度 | 250(Typ)cd/m2 |
| SKU | DFR0649 |
| 工作溫度 | -30℃ - +70℃ |
| 顯示區(qū)域 | 27.72×27.72mm |
| 安裝孔直徑 | 2mm |
| 尺寸 | 44.00x39.00mm |
三、引腳說明
| 編號 | 標(biāo)簽 | 說明 |
|---|---|---|
| 1 | VCC | 電源正極 |
| 2 | GND | 電源負(fù)極 |
| 3 | SCLK | 時(shí)鐘信號 |
| 4 | MOSI | 數(shù)據(jù)(主發(fā)送;從接收) |
| 5 | MISO | 數(shù)據(jù)(主接收;從發(fā)送) |
| 6 | CS | 屏幕芯片選擇 |
| 7 | RES | 復(fù)位 |
| 8 | DC | 數(shù)據(jù)/命令 |
| 9 | BL | 背光燈(已設(shè)置默認(rèn)值,可不連接;連接時(shí),高電平開啟最大亮度,低電平關(guān)閉) |
| 10 | SDCS | SD卡芯片選擇 |
四、使用教程
1. 硬件要求
- DFRduino UNO R3(或類似)x 1
- 1.54" 240x240 LCD模塊 x 1
- M - M/F - M/F - F跳線線
- 電線
2. 軟件要求
- Arduino IDE
- 下載并安裝DFRobot_GDL庫
3. 注意事項(xiàng)
- GDI接口只能與帶有GDI的主控制器配合使用。
- 建議使用Arduino 1.8.10及以上版本。
- 如果SD卡接觸不良,可能會導(dǎo)致初始化失敗,此時(shí)可嘗試重新插拔。
五、示例代碼
1. 基本繪圖示例
此示例展示了如何在模塊上繪制點(diǎn)、圓、線和矩形等圖形。通過設(shè)置不同的顏色和參數(shù),可以實(shí)現(xiàn)各種圖形的繪制效果。
#include "DFRobot_GDL.h"
// 根據(jù)不同主板設(shè)置引腳
#if defined ARDUINO_SAM_ZERO
#define TFT_DC 7
#define TFT_CS 5
#define TFT_RST 6
#elif defined(ESP32) || defined(ESP8266)
#define TFT_DC D3
#define TFT_CS D4
#define TFT_RST D5
#else
#define TFT_DC 2
#define TFT_CS 3
#define TFT_RST 4
#endif
DFRobot_ST7789_240x240_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);
void setup() {
Serial.begin(115200);
screen.begin();
}
void loop() {
testDrawPixel();
testLine();
testFastLines(COLOR_RGB565_PURPLE, COLOR_RGB565_YELLOW);
testRects(COLOR_RGB565_BLACK, COLOR_RGB565_WHITE);
testRoundRects();
testCircles(24, COLOR_RGB565_BLUE);
testTriangles(COLOR_RGB565_YELLOW);
testPrint();
}
// 測試?yán)L制像素點(diǎn)
void testDrawPixel() {
screen.fillScreen(COLOR_RGB565_BLACK);
int x = 0;
int y = screen.height();
for(int i = 0; i <= screen.width()/2; i += 10) {
for (x = screen.width() - i; x >= i; x -= 10) {
screen.drawPixel(x, y, COLOR_RGB565_ORANGE);
delay(10);
}
for (y = screen.height() - i; y >= i; y -= 10) {
screen.drawPixel(x, y, COLOR_RGB565_ORANGE);
delay(10);
}
for (x = i; x <= screen.width() - i + 1; x += 10) {
screen.drawPixel(x, y, COLOR_RGB565_ORANGE);
delay(10);
}
for (y = i; y <= screen.height() - i + 1; y += 10) {
screen.drawPixel(x, y, COLOR_RGB565_ORANGE);
delay(10);
}
}
}
// 測試?yán)L制直線
void testLine() {
uint16_t color = 0x00FF;
screen.fillScreen(COLOR_RGB565_BLACK);
for (int16_t x = 0; x < screen.width(); x += 6) {
screen.drawLine(screen.width()/2, screen.height()/2, x, 0, color);
}
for (int16_t y = 0; y < screen.height(); y += 6) {
screen.drawLine(screen.width()/2, screen.height()/2, screen.width(), y, color += 0x0700);
}
for (int16_t x = screen.width(); x >= 0; x -= 6) {
screen.drawLine(screen.width()/2, screen.height()/2, x, screen.height(), color += 0x0700);
}
for (int16_t y = screen.height(); y >= 0; y -= 6) {
screen.drawLine(screen.width()/2, screen.height()/2, 0, y, color += 0x0700);
}
}
// 測試快速繪制直線(僅水平和垂直線)
void testFastLines(uint16_t color1, uint16_t color2) {
for (int16_t y = 0; y < screen.height(); y += 4) {
screen.drawFastHLine(0, y, screen.width(), color2);
delay(10);
}
for (int16_t x = 0; x < screen.width(); x += 3) {
screen.drawFastVLine(x, 0, screen.height(), color1);
delay(10);
}
}
// 測試?yán)L制矩形
void testRects(uint16_t color1, uint16_t color2) {
int16_t x = screen.width() - 12;
for (; x > 100; x -= screen.width()/40) {
screen.fillScreen(COLOR_RGB565_BLACK);
screen.drawRect(screen.width()/2 - x/2, screen.height()/2 - x/2, x, x, color2 += 0x0F00);
delay(100);
}
screen.fillRect(screen.width()/2 - x/2, screen.height()/2 - x/2, x, x, color2);
delay(100);
for (; x > 6; x -= screen.width()/40) {
screen.drawRect(screen.width()/2 - x/2, screen.height()/2 - x/2, x, x, color1);
delay(100);
}
}
// 測試?yán)L制圓角矩形
void testRoundRects() {
screen.fillScreen(COLOR_RGB565_BLACK);
int color = 0xF00F;
int i;
int x = 0;
int y = 0;
int w = screen.width() - 3;
int h = screen.height() - 3;
for (i = 0; i <= 16; i += 2) {
screen.drawRoundRect(x, y, w, h, 20, color);
x += 5;
y += 5;
w -= 10;
h -= 10;
color += 0x0100;
delay(50);
}
for (i = 0; i <= 16; i += 2) {
screen.fillRoundRect(x, y, w, h, 10, color);
x += 5;
y += 5;
w -= 10;
h -= 10;
color += 0x0500;
delay(50);
}
}
// 測試?yán)L制圓形
void testCircles(uint8_t radius, uint16_t color) {
screen.fillScreen(COLOR_RGB565_BLACK);
for (int16_t x = radius; x <= screen.width() - radius; x += radius * 2) {
for (int16_t y = radius; y <= screen.height() - radius; y += radius * 2) {
screen.drawCircle(x, y, radius, color);
if (x == y || x == -y || x == y + 2 * radius) {
color += 800;
screen.fillCircle(x, y, radius, color);
}
delay(100);
}
}
}
// 測試?yán)L制三角形
void testTriangles(uint16_t color) {
screen.fillScreen(COLOR_RGB565_BLACK);
for (int16_t i = 0; i <= screen.width(); i += 24) {
screen.drawTriangle(i, 0, 0, screen.height() - i, screen.width() - i, screen.height(), color);
}
for (int16_t i = 0; i < screen.width(); i += 24) {
screen.drawTriangle(screen.width(), i * 4/3, 0, screen.height() - i * 4/3, i, 0, color);
}
for (int16_t i = 0; i < screen.width(); i += 24) {
screen.drawTriangle(screen.width(), i * 4/3, i, 0, screen.width() - i, screen.height(), color);
}
color = COLOR_RGB565_RED;
for (int16_t i = 0; i <= screen.width(); i += 24) {
screen.fillTriangle(i, 0, 0, screen.height() - i, screen.width() - i, screen.height(), color);
}
for (int16_t i = 0; i < screen.width(); i += 24) {
screen.fillTriangle(screen.width(), i * 4/3, 0, screen.height() - i * 4/3, i, 0, color += 100);
}
for (int16_t i = 0; i < screen.width(); i += 24) {
screen.fillTriangle(screen.width(), i * 4/3, i, 0, screen.width() - i, screen.height(), color += 100);
}
}
// 測試打印文本
void testPrint() {
int16_t color = 0x00FF;
screen.setTextWrap(false);
screen.fillScreen(COLOR_RGB565_BLACK);
screen.setCursor(0, 50);
screen.setTextColor(color += 0x3000);
screen.setTextSize(0);
screen.println("Hello World!");
screen.setTextColor(color += 0x3000);
screen.setTextSize(1);
screen.println("Hello World!");
screen.setTextColor(color += 0x3000);
screen.setTextSize(2);
screen.println("Hello World!");
screen.setTextColor(color += 0x3000);
screen.setTextSize(3);
screen.println("Hello World!");
screen.setTextColor(color += 0x3000);
screen.setTextSize(4);
screen.println("Hello!");
screen.setTextSize(5);
screen.print("Hello!");
delay(2000);
screen.setCursor(0, 0);
screen.fillScreen(COLOR_RGB565_BLACK);
screen.setTextSize(2);
screen.setTextColor(color += 0x3000);
screen.print("a = ");
screen.setTextColor(color += 0x3000);
int a = 1234;
screen.println(a, 1);
screen.setTextColor(color += 0x3000);
screen.print(8675309, HEX);
screen.println("this is HEX!");
screen.println("");
screen.setTextColor(color += 0x0F00);
screen.println("running for: ");
screen.setTextColor(color += 0x0F00);
screen.print(millis());
screen.setTextColor(color += 0x0F00);
screen.println("/1000 seconds.");
char *text = "Hi DFRobot!";
screen.setTextColor(color += 0x0F00);
screen.setTextWrap(true);
screen.setTextSize(3);
screen.println(text);
delay(2000);
}
2. 圖標(biāo)顯示示例
此示例展示了如何在屏幕上顯示一些常用圖標(biāo)。首先需要使用GIMP2將圖標(biāo)轉(zhuǎn)換為代碼,然后通過代碼在屏幕上顯示這些圖標(biāo)。
#include "DFRobot_GDL.h"
#include "Icon.h"
// 根據(jù)不同主板設(shè)置引腳
#if defined ARDUINO_SAM_ZERO
#define TFT_DC 7
#define TFT_CS 5
#define TFT_RST 6
#elif defined(ESP32) || defined(ESP8266)
#define TFT_DC D3
#define TFT_CS D4
#define TFT_RST D5
#else
#define TFT_DC 2
#define TFT_CS 3
#define TFT_RST 4
#endif
DFRobot_ST7789_240x240_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);
void setup() {
Serial.begin(115200);
screen.begin();
}
void loop() {
int w = screen.width();
int h = screen.height();
int a = millis()/1000;
uint16_t color = 0x00FF;
screen.fillScreen(COLOR_RGB565_WHITE);
while (1) {
for (int i = 0; i < 12; i++) {
screen.fillRect(16, 16, w - 16 * 2, 35, COLOR_RGB565_WHITE);
screen.setTextWrap(false);
screen.setTextColor(0x30FF);
screen.setTextSize(3);
screen.setCursor(30, 30);
screen.println("Time:");
screen.setTextColor(0x00FF);
screen.setTextSize(3);
screen.setCursor(120, 30);
a = millis()/1000;
screen.println(a, 1);
screen.fillRoundRect(w/2 - 48 - 12, h/2 - 16 - 8, 32 * 3 + 12 * 2, 32 + 8 * 2, 20, 0x0000);
for (int x = 0; x < 16; x++) {
screen.drawFastVLine(x, 0, h, color);
}
screen.drawFastHLine(16, 0, w - 16 * 2, color);
for (int y = 0; y < 16; y++) {
screen.drawFastHLine(16, y, w - 16 * 2, color); -
低功耗
+關(guān)注
關(guān)注
12文章
4099瀏覽量
106896 -
顯示模塊
+關(guān)注
關(guān)注
1文章
61瀏覽量
23991
發(fā)布評論請先 登錄
1.54英寸240x240 IPS TFT LCD顯示模塊:高分辨率與低功耗的完美結(jié)合
評論