Setting up the programming environment
The very first step is to install and set up the Arduino IDE. I have described this in detail in another blog post: Lilygo TTGO T-Watch 2020: Getting Started / The Software Framework.
References
While I did not find many great watches, I found plenty of good information and example codes that helped me to understand specific details of the watch. The power management, in particular, is very important, in order to get a watch that does not have to be charged every day. Here I'm listing some references that were valuable and from which I benefited a lot when writing my code.
- The SimpleWatch example that comes with the TTGO T-Watch library
- A series of articles at diyprojects.io (also check the links to their other articles)
- The code for "aGoodWatch" from Alex Goodyear
- The article and code at instructables.com by Dan Geiger
- An interesting "Wordclock" by instructable.com user ArduinoAndy
Requirements
As mentioned above, I wanted this to be a fun watch that can be used in every day life, which means that it needs a very efficient power management. Therefore, in this project I am not using the WiFi and Bluetooth which helps a lot to save power. It allows to reduce the CPU frequency of the watch (from nominal 80MHz out of a max of 240MHz) down to 30MHz. The graphics are all programmed using the TFT_eSPI library. In contrast to many common example codes that have tiny buttons in their settings menus, the Back-to-the-Future watch has large buttons which can easily accessed.
Features
- Full operation with the display on
- After a few seconds of full operation, it turns to light sleep from which it can be quickly awakened. This is done either by a press on the button at the top right - a quick(!) double tap - or by rapidly moving the watch upwards and rotating it towards you.
- To save power (e.g. over night) the watch can be set to deep sleep, by pressing the button for 5 seconds. It takes another (approx. 2 sec) press of this button to wake it up, which takes about 5 seconds.
Watchfaces
The watchfaces, include a fluxing flux capacitor, the time circuits (with the current date/time in the middle row, plus typical movie dates in the top/bottom rows), the speedometer plus the plutonium gauges, the SID spectrometer, and the entrance sign to the Mall (which randomly appears as either "Twin Pines Mall" or "Lone Pine Mall").
Stopwatch
Menu with Settings
- how the watchfaces are diplayed (random, cycle, fixed - as described above)
- the format in which the time is displayed: 12h, 12h plus seconds, or 24h format
- if the stepcounter is shown in the top left corner (on/off)
- if the remaining battery percentage is dislayed in the top right corner (on/off)
- how long the watch stays on: 7 sec, 12 sec, or 20 sec (I prefer 7 sec which is long enough for me to read the time. I used 20 sec to make the video, without the watch turning off all the time. I also use the 20 sec setting if I just enjoy looking at the watch...)
- three levels of brightness (low, med, high)
- if you want the display to dim at night (between 10pm and 7am).
9 comments:
Thanks for posting your complete and working code. I have tried many so called examples and only the simple watch works from a github download. They all require some not included libraries. Again thanks
I'm glad it works for you. Thanks for your nice feedback!
Hi Markus!
You have an example of a source code using sensor Wi-Fi?
Hi Pedro, sorry, no, I have not (yet) tried using WiFi with this watch. At some point, I plan to try it - just to see how it works. But it seems that the WiFi uses much battery, so the watch may hardly be able to operate a whole day without charging.
Hi Markus,
Nice project, thanks.
A couple of comments:
1) the local time in the time circuits is in 12 hour format, but others are 24hr
2) the Stopwatch and Settings screens seem to be reverse of your documentation. Swiping down goes to the Settings Screen and Swiping up to the Stopwatch.
Also you're right about the WiFi etc. using power, I have had a flat battery several times.
Dave
Thank you for your nice comment.
On 1): Yes, all other clocks can be switched (in the settings) between 12h and 24h modes. Since the original Time Circuit is only in 12h mode, I decided that this one can not be changed, to resemble the original.
On 2): I am always unsure how to describe this: By swiping down, you get to the screen that is above the original screen (and vice versa).
Markus,
I may have missed it somewhere, but how do I reset the step counter?
Dave
I don't think that this is possible - except by restarting the watch (power off & on).
Markus,
I've found a bit of code to add to subroutines.ino. I haven't got my head around github yet, so this is my patch.
at Line 286
// dw add code to reset step count the day changes
uint8_t yday = 0; // dw yesterday
and
line 322
// dw reset step counter when day changes
if (dday != yday){
log_i("reset setcounter: %d != %d", dday, yday );
yday = dday; // set yesterday to today as flag that counter was reset
ttgo->bma->resetStepCounter();
}
regards
Dave
Post a Comment