Wordclock With Lilygo-T-Watch 2020
Intro: Wordclock With Lilygo-T-Watch 2020
This instructable show you how to display the time in wordclock style on a Liligo T-watch.
But furthermore I tried to implicate more functions using this typical wordclock style. So it is possible to display the date, setting the time and date, change the color of letters and background, switch between english and german version and setting the power management.
This arduino code uses the "TTGO_TWatch_Library-master"-library. You will find this library on https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library. Please follow the instructions for installing this library first.
STEP 1: Requirements
Hardware
Liliygo® T-Watch 2020
Software
Arduino IDE (https://www.arduino.cc/en/Main/Software)
Libraries
TTGO_TWatch_Library-master (https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Library)
STEP 2: Installation
Please install the Arduini IDE first. Follow the instructions on
https://www.arduino.cc/en/Main/Software.
After installing the Arduino IDE you have to install the TTGO T-watch library from
https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Libr...
You will find a good documentation on this side, too. This library comes with a lot of drivers and also with some good examples for the T-watch.
Connect the T-watch to one of your USB-ports. Please select the port under „tools“ --> „port“.
For first tries you can load some examples coming up with the library. You will find these examples under „file“ --> “examples“ --> „examples for TTGO-T-watch“ (you have to scroll down in the menu)
NOTE: If you have a problem with connecting the T-watch via USB, e.g. you can‘t choose the port in the arduino IDE because it is in gray color, please look here for more informations and help.
https://github.com/espressif/arduino-esp32/issues/...
Thanks to „beegee-tokyo“!
I had this problem. After connecting the watch to one of my USB-Ports I couldn’t choose the port in the arduino IDE. The name of the port was gray colored. After installing the „CP210x USB to UART Bridge VCP Drivers“ everything worked fine.
You will find the driver on
https://www.silabs.com/products/development-tools/...
After installing the Arduino IDE and the library you can download the wordclock-package from GitHub:
https://github.com/Adosis/TTGO_TWatch_WordClock
Please download the zip-file end extract it in an own folder. Load the file „t-watch_wordclock_V1_0.ino“ into the arduino IDE. By double-click on the file name Arduino will start automatically and the file will be loaded.
In the Arduino IDE choose“ file“ --> „open“ (or STRG+o) and select the file to open.
After the file has been loaded you will find 4 tabs at the top oft he Arduino IDE
t-watch_wordclock_V1_0
the main program of the wordclock
calcMatrix.c
an outsourced part of the program
FreeSans12ptWordclock.h
The file with the used font. This font is a variation of the FreeSans12pt7p.h of ardufruit_GFX included in the T-watch-library.
config.h
A file to select the hardware. Please be sure that the line
„#define LILYGO_WATCH_2020_V1 // To use T-Watch2020 , please uncomment this line „ is really uncomment. That means, that the two // at the beginning of the line were deleted.
Now you can upload the code to the watch by clicking „sketch“ --> "upload" or by clicking the symbol with the arrow to the right side
NOTE: Sometimes there’s a problem with the upload. Please switch on the watch by pressing the button on the side of the watch for 2 seconds. Try to upload the sketch again.
After the upload finished you can disconnect the watch from the USB-port. If everything is o.k. the program will start automatically by display a time in a typical wordclock style.
STEP 3: Functions
Starting from the main screen – the typical wordclock - you can call different functions by wiping on the display:
Wiping to the left:
One after the other the date, the month and the year are displayed. At the end, the main screen will be displayed again
Wiping to the right:
The status of the battery is displayed. After a few seconds the main screen will be displayed again
Wiping to the bottom:
The menu is displayed. You can choose the different points of the menu by typing the point on the display. If you don’t type anything the main screen will be displayed after a few seconds
STEP 4: Menu and Settings
Set time
First of all the actual day will be displayed. By wiping up or down you can increase or decrease the day. When you reached the correct day wipe to the left. The setting for the month appeared. Please set the month – and also the year, hour and minute – as same as the day.
After setting the minute you have to wipe to the left once more. Date and time is now saved. The main screen will be displayed.
Change Color
In this menu you can change the color of the matrix and the background color.
The name of the color of the matrix will be displayed. By wiping down you change the background color. By wiping up you will change the color of the matrix. There are 23 different colors for the matrix and fort he background.
After setting the colors you have to wipe to the left for saving the colors. The main screen will be displayed.
Power Management
There are three possibilities for the power management. By touching the display you can choose the method. After touching the screen the choosed method will be saved and the main screen will be displayed.
Switch off completly
When the main screen is displayed for a few seconds and the display wasn’t touched the watch will be powerd off completly. You can wake up the watch by lifting your wrist or double click. After waking up the watch needs a few seconds before displaying the time. This method requires the least battery power.
Only switch off the display
When the main screen is displayed for a few seconds and the display wasn’t touched the display of the watch will shut off. You can wake up the watch by bringing the watch in a position so that you can read the display. The time will be displayed much faster but this method needs much more battery power.
Don’t switch off the watch
The watch won’t be powerd off – until the battery is empty.
Language
At the moment there are two languages: english and german. Choose one language by typing the language on the display. After touching the screen the choosed language will be saved and the main screen will be displayed.
19 Comments
corradoitalo1970 1 year ago
corradoitalo1970 1 year ago
corradoitalo1970 2 years ago
Andreas Klausen 2 years ago
Best regards
Andreas
Translated by deepl.com:
Ciao, grazie per il tuo commento. Puoi dirmi per favore che tipo di problema hai? O hai bisogno di aiuto per collegare l'orologio e caricare il codice? Hai qualche messaggio di errore? Se sì, quali messaggi di errore ricevete?
Molti saluti
Andreas
corradoitalo1970 2 years ago
corradoitalo1970 2 years ago
from C:\Users\seristampa2\Documents\Arduino\libraries\TTGO_TWatch_Library-master\examples\TFT_eSPI\TFT_Clock\TFT_Clock.ino:20:
C:\Users\seristampa2\Documents\Arduino\libraries\TTGO_TWatch_Library-master\src/LilyGoWatch.h:403:2: error: #error "Please define Watch model"
#error "Please define Watch model"
^~~~~
In file included from C:\Users\seristampa2\Documents\Arduino\libraries\TTGO_TWatch_Library-master\src/TTGO.h:100:0,
from C:\Users\seristampa2\Documents\Arduino\libraries\TTGO_TWatch_Library-master\src/LilyGoWatch.h:406,
from C:\Users\seristampa2\Documents\Arduino\libraries\TTGO_TWatch_Library-master\examples\TFT_eSPI\TFT_Clock\config.h:19,
from C:\Users\seristampa2\Documents\Arduino\libraries\TTGO_TWatch_Library-master\examples\TFT_eSPI\TFT_Clock\TFT_Clock.ino:20:
C:\Users\seristampa2\Documents\Arduino\libraries\TTGO_TWatch_Library-master\src/drive/i2c/i2c_bus.h:5:10: fatal error: freertos/FreeRTOS.h: No such file or directory
#include "freertos/FreeRTOS.h"
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Compilation error: exit status 1}
Andreas Klausen 2 years ago
I think, that there is a problem with the new package you have to download from github: https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Libr...
I used an older version which supported only a few models up to the lilygo-TWatch 2020 v1. The new package supported much more versions. So you have to change the config.h (you will find this file under the examples you will get with the package).
This is the new config.h-file:// =>
Hardware select
// #define
LILYGO_WATCH_2019_WITH_TOUCH//
To use T-Watch2019 with touchscreen, please uncomment this line
// #define
LILYGO_WATCH_2019_NO_TOUCH//
To use T-Watch2019 Not touchscreen , please uncomment this line
// #define
LILYGO_WATCH_2020_V1//
To use T-Watch2020 V1, please uncomment this line
// #define
LILYGO_WATCH_2020_V2//
To use T-Watch2020 V2, please uncomment this line
// #define
LILYGO_WATCH_2020_V3//
To use T-Watch2020 V3, please uncomment this line
// #define
LILYGO_LILYPI_V1//LILYPI / TBLOCK requires an external display module
// #define
LILYGO_WATCH_BLOCK//LILYPI / TBLOCK requires an external display module
#if
defined(LILYGO_LILYPI_V1) || defined(LILYGO_WATCH_BLOCK)
// #define
LILYGO_BLOCK_ST7796S_MODULE//Use ST7796S
// #define
LILYGO_BLOCK_ILI9481_MODULE//Use ILI9841
// #define
LILYGO_GC9A01A_MODULE//Use GC9A01A
#endif
#include
<LilyGoWatch.h>
Define the watch model you use by uncomment the line, e.g. your watch is the LILYGO WATCH 2020 V2 you have to uncomment this line:
Change the line
// #define LILYGO_WATCH_2020_V2 // To use T-Watch2020 V2, please uncomment this line
to
#define LILYGO_WATCH_2020_V2 // To use T-Watch2020 V2, please uncomment this line
Hope this will solving your problem. Please let me know if it works.
Best regards
Andreas
Andreas Klausen 2 years ago
Penso che ci sia un problema con il nuovo pacchetto che devi scaricare da github: https://github.com/Xinyuan-LilyGO/TTGO_TWatch_Lib...
Ho usato una vecchia versione che supportava solo alcuni modelli fino a lilygo-TWatch 2020 v1. Il nuovo pacchetto supporta molte più versioni. Quindi devi cambiare il config.h (puoi trovare questo file tra gli esempi che ottieni con il pacchetto).
Questo è il nuovo file config.h:
// => Hardware select
// #define
LILYGO_WATCH_2019_WITH_TOUCH//
To use T-Watch2019 with touchscreen, please uncomment this line
// #define
LILYGO_WATCH_2019_NO_TOUCH//
To use T-Watch2019 Not touchscreen , please uncomment this line
// #define LILYGO_WATCH_2020_V1// To use T-Watch2020 V1,
please uncomment this line
// #define LILYGO_WATCH_2020_V2// To use T-Watch2020 V2, please
uncomment this line
// #define LILYGO_WATCH_2020_V3// To use T-Watch2020 V3,
please uncomment this line
// #define LILYGO_LILYPI_V1//LILYPI / TBLOCK requires
an external display module
// #define LILYGO_WATCH_BLOCK//LILYPI / TBLOCK requires
an external display module
#if defined(LILYGO_LILYPI_V1) ||
defined(LILYGO_WATCH_BLOCK)
// #define
LILYGO_BLOCK_ST7796S_MODULE//Use ST7796S
// #define LILYGO_BLOCK_ILI9481_MODULE//Use ILI9841
// #define
LILYGO_GC9A01A_MODULE//Use GC9A01A
#endif
#include
<LilyGoWatch.h>
Definisci il modello di orologio che stai usando commentando la linea, ad esempio il tuo orologio è il LILYGO WATCH 2020 V2, allora devi commentare questa linea:
Cambia la linea
// #define LILYGO_WATCH_2020_V2 // To use T-Watch2020 V2, please
uncomment this line
a
#define LILYGO_WATCH_2020_V2 // To use T-Watch2020 V2, please
uncomment this line
Spero che questo risolva il vostro problema. Per favore fatemi sapere se funziona.
Cordiali saluti
Andreas
Tradotto con www.DeepL.com/Translator (versione gratuita)
corradoitalo1970 2 years ago
corradoitalo1970 2 years ago
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:96:3: error: 'setColMatrix' was not declared in this scope
setColMatrix = EEPROM.read(0); // get the color of the letters out of the EEPROM
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:103:3: error: 'colMatrix' was not declared in this scope
colMatrix=codeColor(setColMatrix);
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:109:3: error: 'language' was not declared in this scope
language = EEPROM.read(3); // get the used language out of the EEPORM
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void clearMatrix()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:162:31: error: 'letterCol' was not declared in this scope
for (int i=0; i <110; i++) {letterCol[i]=0x10A2;}
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void printMatrix(byte)':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:176:31: error: 'letterCol' was not declared in this scope
ttgo->tft->setTextColor(letterCol[(letterRow*11)+letterCount],colBackground); // set the color of the actual printed letter
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void setTimeDate()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:256:25: error: 'calcMatrix' was not declared in this scope
calcMatrix (3,setDay,0); // calculate and show the matrix for setting the day
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void setColor()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:441:16: error: 'setColMatrix' was not declared in this scope
calcMatrix(8,setColMatrix,0);
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:441:30: error: 'calcMatrix' was not declared in this scope
calcMatrix(8,setColMatrix,0);
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:463:7: error: 'colMatrix' was not declared in this scope
colMatrix=codeColor(setColMatrix); // the matrix was displayed using the new colors and displayd the name of the letter color
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void setPowerMangemant()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:488:31: error: 'calcMatrix' was not declared in this scope
calcMatrix(9,powManagement,1); // display the matrix for seeting the power management, 1 means that all choosable possibilities were displayed
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void setLangMatrix()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:536:7: error: 'language' was not declared in this scope
if (language == 0) // the german matrixes
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:551:7: error: 'language' was not declared in this scope
if (language == 1) // the english matrixes
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void setLanguage()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:573:17: error: 'language' was not declared in this scope
calcMatrix(99,language,1); //display the matrix for seeting the language, 1 means that all choosable possibilities were displayed
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:573:27: error: 'calcMatrix' was not declared in this scope
calcMatrix(99,language,1); //display the matrix for seeting the language, 1 means that all choosable possibilities were displayed
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void printDate()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:611:21: error: 'calcMatrix' was not declared in this scope
calcMatrix(3,day,1);
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void printTime()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:651:9: error: 'language' was not declared in this scope
if (language==0) // for the german version
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:656:9: error: 'language' was not declared in this scope
if (language==1) // for the english
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:664:38: error: 'calcMatrix' was not declared in this scope
calcMatrix(0,minuteView, hourView); // display the WORDCLOCK
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void printBattery()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:684:37: error: 'calcMatrix' was not declared in this scope
calcMatrix(1,battPercView,battLoad); // display the battery charge
^
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino: In function 'void menu()':
C:\Users\iTalo\Downloads\TTGO_TWatch_WordClock-main (1)\TTGO_TWatch_WordClock-main\t-watch_wordclock_V1_0\t-watch_wordclock_V1_0.ino:697:19: error: 'calcMatrix' was not declared in this scope
calcMatrix(2,0,1); //display the matrix for the menu, 1 means all choosable possibilities were displayed
^
Compilation error: exit status 1
corradoitalo1970 1 year ago
corradoitalo1970 1 year ago
ac080663 2 years ago
But how can i adjust the values for "waitWatchMoved", that the watch reacts with a specified movement ? What is "X/Y/Z" and which values are relevant in which range ?
Or how could i set to wake the clock up ONLY with the button ?
Or wake it up with a specified swipe ?
josephchrzempiec 3 years ago
StefanKleist 3 years ago
Now after a little over 24 hours I can say that it is still working. The sleep function is great.
Ruud48 3 years ago
Please remove the "#include <adafruit_gfx.h> line as it stops the compilation and is not needed.
lutzbickhardt 3 years ago
using the Arduino IDE I had to delete the <adafruit_gtx> include and change
plus
using platform.io I had to move the setLangMatrix def to be defined before void setup(), otherwise it would not be compiled,
otherwise very nice!
seamster 3 years ago
Andreas Klausen 3 years ago