<
পিন ডায়াগ্রামঃ
TFT LCD Display Module 1.8 inch ডিসপ্লের দুইটি পিনে ভোল্টেজ সাপ্লাই দিতে হবে, VCC এবং LED। উভয় পিনে ৩.৩ ভোল্ট সাপ্লাই দ্বারা ড্রাইভার আইসি ST7735 এবং ডিসপ্লে অন হবে। ডাটা পিনগুলোকে NodeMCU এর সাথে সঠিকভাবে কানেকশন সম্পন্ন করতে হবে। অতপর, SSID Name, Password দিয়ে প্রোগ্রাম আপলোড করলেই ইন্টারনেটের সাথে কানেক্ট হতে শুরু করবে।

প্রয়োজনীয় কম্পোনেন্টঃ
কম্পোনেন্টের তালিকা নিচে প্রদান করা হলো।
| ক্রমিক নং | কম্পোনেন্টের নাম | মডেল | পরিমাণ | লিংক |
| ১ | TFT LCD Display Module 1.8 inch | DIS-00058 | ১টি | কম্পোনেন্ট লিংক |
| ২ | ESP8266 NodeMCU V2 Development Board with CP2102 | WIR-00074 | ১টি | কম্পোনেন্ট লিংক |
| ৩ | Micro USB Data Cable | C&C-00259 | ১টি | কম্পোনেন্ট লিংক |
| ৪ | Breadboard (830 Point) | MIS-00002 | ২টি | কম্পোনেন্ট লিংক |
| ৫ | Silicone Jumper Wire (Male to Male) | C&C-00245 | প্রয়োজনমত | কম্পোনেন্ট লিংক |
সার্কিট কানেকশনঃ

লাইব্রেরীঃ
NTPClient.h
TimeLib.h
Adafruit_GFX.h
Adafruit_ST7735.h
প্রোগ্রাম আপলোড দেওয়ার পূর্বে অবশ্যই লাইব্রেরীগুলো ইন্সটল করে নিতে হব। যদি পূর্বে থেকে একই লাইব্রেরী ইন্সটল করা থাকে, তাহলে Update করে নিতে হবে।

Library Manager এ সার্চ করলেই প্রতিটি লাইব্রেরী দেখাতে শুরু করবে। যদি পূর্বে ইন্সটল করা থাকে, তাহলে update দেখাবে। ইন্সটল করা না থাকলে install দেখাবে।

ডেমো কোডঃ
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <NTPClient.h> // include NTPClient library
#include <TimeLib.h> // Include Arduino time library
#include <Adafruit_GFX.h> // include Adafruit graphics library
#include <Adafruit_ST7735.h> // include Adafruit ST7735 TFT library
#define TFT_RST D4 // TFT RST Pin is Connected to NodeMCU Pin D4 (GPIO2)
#define TFT_CS D3 // TFT CS Pin is Connected to NodeMCU Pin D3 (GPIO0)
#define TFT_DC D2 // TFT DC Pin is Connected to NodeMCU Pin D2 (GPIO4)
// SCK ---> NodeMCU Pin D5 (GPIO14)
// SDA ---> NodeMCU Pin D7 (GPIO13)
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
// set WiFi network SSID and password
const char *ssid = "SSID Name";
const char *password = "SSID Password";
WiFiUDP ntpUDP;
// 'bd.pool.ntp.org' is used (default server) with +6 hour offset (21600 seconds) 60 seconds (60000 milliseconds) update interval
NTPClient timeClient(ntpUDP, "bd.pool.ntp.org", 21600, 360000);
unsigned long unix_epoch;
void setup(void)
{
Serial.begin(9600);
tft.initR(INITR_BLACKTAB); // Initialize a ST7735S Chip, black tab
tft.fillScreen(ST7735_BLACK); // Fill screen with black color
tft.drawFastHLine(0, 44, tft.width(), ST7735_GREEN); // draw horizontal Green line at position (0, 44)
tft.setTextColor(ST7735_WHITE, ST7735_BLACK); // Set text color to white and black background
tft.setTextSize(1); // text size = 1
tft.setCursor(19, 10); // Move cursor to position (43, 10) pixel
tft.print("NodeMCU Internet");
tft.setCursor(4, 27); // Move cursor to position (4, 27) pixel
tft.print("Clock using TFT LCD");
WiFi.begin(ssid, password);
Serial.print("Connecting.");
tft.setCursor(0, 54); // Move cursor to position (4, 27) pixel
tft.print("Connecting..");
while ( WiFi.status() != WL_CONNECTED ) {
delay(500);
Serial.print(".");
}
Serial.println("connected");
tft.print("connected");
delay(2000);
tft.fillRect(0, 54, tft.width(), 8, ST7735_BLACK);
tft.drawFastHLine(0, 102, tft.width(), ST7735_GREEN);
tft.setTextSize(2);
tft.setTextColor(ST7735_WHITE, ST7735_BLACK);
tft.setCursor(37, 112);
tft.print("TIME:");
timeClient.begin();
}
void RTC_display()
{
char dow_matrix[7][10] = {"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"};
byte x_pos[7] = {29, 29, 23, 11, 17, 29, 17};
static byte previous_dow = 0;
// print day of the week
if( previous_dow != weekday(unix_epoch) )
{
previous_dow = weekday(unix_epoch);
tft.fillRect(11, 55, 108, 14, ST7735_BLACK); // draw rectangle (erase day from the display)
tft.setCursor(x_pos[previous_dow-1], 55);
tft.setTextColor(ST7735_RED, ST7735_BLACK); // set text color to Red and Black background
tft.print( dow_matrix[previous_dow-1] );
}
// Date
tft.setCursor(4, 79);
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK); // set text color to Yellow and Black background
tft.printf( "%02u-%02u-%04u", day(unix_epoch), month(unix_epoch), year(unix_epoch) );
// Time
tft.setCursor(16, 136);
tft.setTextColor(ST7735_YELLOW, ST7735_BLACK); // set text color to Yellow and Black background
tft.printf( "%02u:%02u:%02u", hour(unix_epoch), minute(unix_epoch), second(unix_epoch) );
}
void loop() // main loop
{
timeClient.update();
unix_epoch = timeClient.getEpochTime(); // get UNIX Epoch time
RTC_display();
delay(200); // wait 200ms
} // end of code.
আউটপুটঃ

সতর্কতাঃ
১। TFT Display এর নির্ধারিত ভোল্টেজের অধিক ভোল্ট সাপ্লাই দেওয়া যাবেনা।
২। Breadboard এর ডিসপ্লে সাবধানে বসাতে হবে যেন, স্ক্রিনে প্রেসার না পরে।
৩। সম্পূর্ণ সংযোগ নিশ্চিত হয়ে, ভোল্টেজ সাপ্লাই দিতে হবে।]]>
