Chuẩn bị linh kiện
- Wemos D1 Mini Pro
- 2.8″ TFT Display
Sơ đồ kết nối
Schematic: Here
Kết nối màn hình TFT với Wemos:
TFT Display->Wemos ( ESP8266 )
- VIN -> 3.3V
- GND -> GND
- CS -> D1
- RESET -> RST
- DC -> D2
- SDI -> D7
- SCK – D5
- LED -> D8
- SDO -> D6
- T_CLK -> D5
- T_CS -> D3
- T_DIN -> D7
- T_DO -> D6
- T_IRQ -> D4
Code chương trình
Code: Here
esp8266-weather-station-color.ino
Trong file settings.h bạn cần sửa một số thông tin để lấy thông tin thời tiết tại vị trí của bạn:
// Setup
String WIFI_SSID = “yourssid”;
String WIFI_PASS = “yourpassw0rd”;
Lấy API KEY tại trang OpenWeatherMap, bạn cần đăng ký tài khoản miễn phí : https://docs.thingpulse.com/how-tos/openweathermap-key/
String OPEN_WEATHER_MAP_API_KEY = “”;
Tại https://openweathermap.org/find?q= bạn tìm thành phố của bạn, sau đó bạn sẽ có một URL ví dụ https://openweathermap.org/city/2657896. Sau đó chỉnh sửa cho 2 dòng sau
String OPEN_WEATHER_MAP_LOCATION_ID = “2657896”;
String DISPLAYED_LOCATION_NAME = “Zurich”;
const String OPEN_WEATHER_MAP_LANGUAGE = “en” //Ngôn ngữ là tiếng Anh
Bạn có thể thay đổi ngôn ngữ như sau:
Arabic -> ar, Bulgarian -> bg, Catalan -> ca, Czech -> cz, German -> de, Greek -> el,
English -> en, Persian (Farsi) -> fa, Finnish -> fi, French -> fr, Galician -> gl,
Croatian -> hr, Hungarian -> hu, Italian -> it, Japanese -> ja, Korean -> kr,
Latvian -> la, Lithuanian -> lt, Macedonian -> mk, Dutch -> nl, Polish -> pl,
Portuguese -> pt, Romanian -> ro, Russian -> ru, Swedish -> se, Slovak -> sk,
Slovenian -> sl, Spanish -> es, Turkish -> tr, Ukrainian -> ua, Vietnamese -> vi,
Chinese Simplified -> zh_cn, Chinese Traditional -> zh_tw.
Thư viện:
- Mini Grafx by Daniel Eichhorn
- ESP8266 WeatherStation by Daniel Eichhorn
- Json Streaming Parser by Daniel Eichhorn
- ThingPulse XPT2046 Touch by ThingPulse
Tham khảo: https://www.instructables.com/