Skip to content

Commit 6473a83

Browse files
Merge pull request #62 from techniccontroller/main
update with fixes from main
2 parents 3b726af + 1c7494f commit 6473a83

File tree

4 files changed

+289
-39
lines changed

4 files changed

+289
-39
lines changed

README.md

Lines changed: 59 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,61 @@
11
# Wordclock 2.0
22
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=main)
33

4-
Wordclock 2.0 with ESP8266 and NTP time.
4+
A modern Wi-Fi Word Clock powered by the ESP8266 and synchronized via NTP (Network Time Protocol).
5+
Displays time in words with support for multiple languages and colorful NeoPixel LED effects.
6+
Additional gaming modes, such as PONG, SNAKE, and TETRIS, can be played via an interactive Web UI.
57

6-
More details on my website: https://techniccontroller.com/word-clock-with-wifi-and-neopixel/
78

9+
**Project Details and Guide:**
810

9-
**Languages**
11+
Full tutorial and build instructions on https://techniccontroller.com/word-clock-with-wifi-and-neopixel/
1012

11-
The Wordclock is available in **German**, **English**, **Italian**, **French** and **Javanese** language. By default the language is German.
12-
To use other languages like English or Italian please replace the file *wordclockfunctions.ino* with *wordclockfunctions.ino_english* or *wordclockfunctions.ino_italian*.
13-
The code compiles only with one file named *wordclockfunctions.ino*. So please rename the file you want to use to *wordclockfunctions.ino* and replace the existing file.
13+
## Features
14+
- 6 modes
15+
- Word Clock
16+
- Digital Clock
17+
- SPIRAL animation
18+
- TETRIS (playable via web interface)
19+
- SNAKE (playable via web interface)
20+
- PONG (playable via web interface)
21+
- Interactive Web-Based Games: Control PONG, TETRIS, and SNAKE directly through the built-in web UI
22+
- Real-time clock synchronized over Wi-Fi using NTP
23+
- Automatic daylight saving time (summer/winter) switching
24+
- Automatic timezone detection
25+
- Easy Wi-Fi setup with WiFiManager
26+
- Configurable color themes
27+
- Customizable night mode (start/end time)
28+
- Adjustable brightness settings
29+
- Automatic mode rotation
30+
- Web interface for configuration and control
31+
- Physical button for quick mode change or night mode toggle
32+
- Intelligent current limiting of LEDs
33+
- Dynamic color shifting mode
34+
35+
## Supported Languages
36+
37+
The WordClock currently supports the following languages:
38+
- **German (default)**
39+
- **English**
40+
- **Italian**
41+
- **French**
42+
- **Swiss German**
43+
- **Javanese**
44+
45+
**How to Change the Language**
46+
47+
To switch to another language:
48+
1. Go to the `wordclockfunctions.ino_<language>` file (e.g., `wordclockfunctions.ino_english`)
49+
2. Rename it to `wordclockfunctions.ino`
50+
3. Replace the existing `wordclockfunctions.ino` file
51+
4. Compile and upload the code to your ESP8266
52+
53+
Only one language file should be named wordclockfunctions.ino at any time for successful compilation.
1454

1555
Thank you to everyone who provided feedback on adding new languages and testing their accuracy — your efforts have been invaluable in making this project truly inclusive and reliable!
1656

17-
**Special Branches**
18-
19-
We've got some interesting branches in this repo inspired by user feedback. These branches explore unique features and experimental ideas. Some will stay updated with the main branch's features.
20-
21-
- [**hour_animation**](https://github.com/techniccontroller/wordclock_esp8266/tree/hour_animation): This branch replaces the spiral animation with some custom pattern animation defined as x/y coordinate pattern including custom color for each letter. Also, this animation is show ones per hour.
22-
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=hour_animation)
23-
- [**mode_seconds**](https://github.com/techniccontroller/wordclock_esp8266/tree/mode_seconds): This branch adds one additional mode to show the seconds as numbers on the clock. Thanks to [@Bram](https://github.com/BramWerbrouck)
24-
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=mode_seconds)
25-
- [**rgbw_leds**](https://github.com/techniccontroller/wordclock_esp8266/tree/rgbw_leds): This branch uses RGBW LEDs instead of RGB LEDs.
26-
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=rgbw_leds)
27-
- [**static_background_pattern**](https://github.com/techniccontroller/wordclock_esp8266/tree/static_background_pattern): This branch allows to light up specific letters always during clock mode. E.G., to display some special words in another color.
28-
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=static_background_pattern)
29-
3057

3158

32-
## Features
33-
- 6 modes (Clock, Digital Clock, SPIRAL animation, TETRIS, SNAKE, PONG)
34-
- time update via NTP server
35-
- automatic summer/wintertime change
36-
- automatic timezone selection
37-
- easy WIFI setup with WifiManager
38-
- configurable color
39-
- configurable night mode (start and end time)
40-
- configurable brightness
41-
- automatic mode change
42-
- webserver interface for configuration and control
43-
- physical button to change mode or enable night mode without webserver
44-
- automatic current limiting of LEDs
45-
- dynamic color shift mode
46-
4759
## Pictures of clock
4860
![modes_images2](https://user-images.githubusercontent.com/36072504/156947689-dd90874d-a887-4254-bede-4947152d85c1.png)
4961

@@ -68,6 +80,19 @@ We've got some interesting branches in this repo inspired by user feedback. Thes
6880

6981
<img src="https://techniccontroller.com/wp-content/uploads/filemanager1-1.png" height="300px" /> <img src="https://techniccontroller.com/wp-content/uploads/filemanager2-1.png" height="300px" /> <img src="https://techniccontroller.com/wp-content/uploads/filemanager3-1.png" height="300px" />
7082

83+
## Special Branches
84+
85+
We've got some interesting branches in this repo inspired by user feedback. These branches explore unique features and experimental ideas. Some will stay updated with the main branch's features.
86+
87+
- [**hour_animation**](https://github.com/techniccontroller/wordclock_esp8266/tree/hour_animation): This branch replaces the spiral animation with some custom pattern animation defined as x/y coordinate pattern including custom color for each letter. Also, this animation is show ones per hour.
88+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=hour_animation)
89+
- [**mode_seconds**](https://github.com/techniccontroller/wordclock_esp8266/tree/mode_seconds): This branch adds one additional mode to show the seconds as numbers on the clock. Thanks to [@Bram](https://github.com/BramWerbrouck)
90+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=mode_seconds)
91+
- [**rgbw_leds**](https://github.com/techniccontroller/wordclock_esp8266/tree/rgbw_leds): This branch uses RGBW LEDs instead of RGB LEDs.
92+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=rgbw_leds)
93+
- [**static_background_pattern**](https://github.com/techniccontroller/wordclock_esp8266/tree/static_background_pattern): This branch allows to light up specific letters always during clock mode. E.G., to display some special words in another color.
94+
![compile esp8266 workflow](https://github.com/techniccontroller/wordclock_esp8266/actions/workflows/compile_esp8266.yml/badge.svg?branch=static_background_pattern)
95+
7196
## Install needed Libraries
7297

7398
Please download all these libraries as ZIP from GitHub, and extract them in the *libraries* folder of your Sketchbook location (see **File -> Preferences**):

wordclock_esp8266.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ void setup() {
252252

253253
// set a custom hostname
254254
wifiManager.setHostname(hostname);
255+
256+
// set timeout of config portal to 10min, continue even if not connected,
257+
// clock will show wrong time, but eventually restart after watchdog counter is 0 (after ~5min)
258+
wifiManager.setConfigPortalTimeout(600);
255259

256260
// fetches ssid and pass from eeprom and tries to connect
257261
// if it does not connect it starts an access point with the specified name

wordclockfunctions.ino_italian

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,7 @@ String timeToString(uint8_t hours,uint8_t minutes){
114114
}
115115

116116
//SONO LE
117-
if(hours == 1 && minutes < 35)
118-
{
119-
message += "= # "; //E' L' -> = is for E' and # is for L'
120-
}
121-
else if (hours == 0 && minutes >= 35)
117+
if(hours == 1)
122118
{
123119
message += "= # "; //E' L' -> = is for E' and # is for L'
124120
}

wordclockfunctions.ino_swiss

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
// Thanks to Sandro for providing this swiss german version
2+
const String clockStringSwiss = "ESPESCHAFUFVIERTUBFZAAZWANZGSIVORABOHWORTUHRHAUBIANESSIEISZWOISDRUVIERIYFUFIOSACHSISEBNIACHTINUNIELZANIERBEUFIZWOUFINAGSI";
3+
4+
/**
5+
* @brief control the four minute indicator LEDs
6+
*
7+
* @param minutes minutes to be displayed [0 ... 59]
8+
* @param color 24bit color value
9+
*/
10+
void drawMinuteIndicator(uint8_t minutes, uint32_t color){
11+
//separate LEDs for minutes in an additional row
12+
{
13+
switch (minutes%5)
14+
{
15+
case 0:
16+
break;
17+
18+
case 1:
19+
ledmatrix.setMinIndicator(0b1000, color);
20+
break;
21+
22+
case 2:
23+
ledmatrix.setMinIndicator(0b1100, color);
24+
break;
25+
26+
case 3:
27+
ledmatrix.setMinIndicator(0b1110, color);
28+
break;
29+
30+
case 4:
31+
ledmatrix.setMinIndicator(0b1111, color);
32+
break;
33+
}
34+
}
35+
}
36+
37+
/**
38+
* @brief Draw the given sentence to the word clock
39+
*
40+
* @param message sentence to be displayed
41+
* @param color 24bit color value
42+
* @return int: 0 if successful, -1 if sentence not possible to display
43+
*/
44+
int showStringOnClock(String message, uint32_t color){
45+
String word = "";
46+
int lastLetterClock = 0;
47+
int positionOfWord = 0;
48+
int index = 0;
49+
50+
// add space on the end of message for splitting
51+
message = message + " ";
52+
53+
// empty the targetgrid
54+
ledmatrix.gridFlush();
55+
56+
while(true){
57+
// extract next word from message
58+
word = split(message, ' ', index);
59+
index++;
60+
61+
if(word.length() > 0){
62+
// find word in clock string
63+
positionOfWord = clockStringSwiss.indexOf(word, lastLetterClock);
64+
65+
if(positionOfWord >= 0){
66+
// word found on clock -> enable leds in targetgrid
67+
for(unsigned int i = 0; i < word.length(); i++){
68+
int x = (positionOfWord + i)%WIDTH;
69+
int y = (positionOfWord + i)/WIDTH;
70+
ledmatrix.gridAddPixel(x, y, color);
71+
}
72+
// remember end of the word on clock
73+
lastLetterClock = positionOfWord + word.length();
74+
}
75+
else{
76+
// word is not possible to show on clock
77+
logger.logString("word is not possible to show on clock: " + String(word));
78+
return -1;
79+
}
80+
}else{
81+
// end - no more word in message
82+
break;
83+
}
84+
}
85+
// return success
86+
return 0;
87+
}
88+
89+
/**
90+
* @brief Converts the given time as sentence (String)
91+
*
92+
* @param hours hours of the time value
93+
* @param minutes minutes of the time value
94+
* @return String time as sentence
95+
*/
96+
String timeToString(uint8_t hours, uint8_t minutes, bool puristModeActive){
97+
98+
//ES IST
99+
String message = "";
100+
101+
if(puristModeActive){
102+
message = "";
103+
if(minutes < 5 || (minutes >=30 && minutes < 35)){
104+
message = "ES ESCH ";
105+
}
106+
}
107+
else{
108+
message = "ES ESCH ";
109+
}
110+
111+
//show minutes
112+
if(minutes >= 5 && minutes < 10)
113+
{
114+
message += "FUF AB ";
115+
}
116+
else if(minutes >= 10 && minutes < 15)
117+
{
118+
message += "ZAA AB ";
119+
}
120+
else if(minutes >= 15 && minutes < 20)
121+
{
122+
message += "VIERTU AB ";
123+
}
124+
else if(minutes >= 20 && minutes < 25)
125+
{
126+
message += "ZWANZG AB "; //Sandro
127+
}
128+
else if(minutes >= 25 && minutes < 30)
129+
{
130+
message += "FUF VOR HAUBI ";
131+
}
132+
else if(minutes >= 30 && minutes < 35)
133+
{
134+
message += "HAUBI ";
135+
}
136+
else if(minutes >= 35 && minutes < 40)
137+
{
138+
message += "FUF AB HAUBI ";
139+
}
140+
else if(minutes >= 40 && minutes < 45)
141+
{
142+
message += "ZWANZG VOR "; //Sandro
143+
}
144+
else if(minutes >= 45 && minutes < 50)
145+
{
146+
message += "VIERTU VOR ";
147+
}
148+
else if(minutes >= 50 && minutes < 55)
149+
{
150+
message += "ZAA VOR ";
151+
}
152+
else if(minutes >= 55 && minutes < 60)
153+
{
154+
message += "FUF VOR ";
155+
}
156+
157+
//convert hours to 12h format
158+
if(hours >= 12)
159+
{
160+
hours -= 12;
161+
}
162+
if(minutes >= 25) //Sandro 20
163+
{
164+
hours++;
165+
}
166+
if(hours == 12)
167+
{
168+
hours = 0;
169+
}
170+
171+
// show hours
172+
switch(hours)
173+
{
174+
case 0:
175+
message += "ZWOUFI ";
176+
break;
177+
case 1:
178+
message += "EIS ";
179+
// //EIN(S)
180+
// if(minutes > 4){ // Sandro
181+
// message += "S";
182+
// }
183+
// message += " ";
184+
break;
185+
case 2:
186+
message += "ZWOI ";
187+
break;
188+
case 3:
189+
message += "DRU ";
190+
break;
191+
case 4:
192+
message += "VIERI ";
193+
break;
194+
case 5:
195+
message += "FUFI ";
196+
break;
197+
case 6:
198+
message += "SACHSI ";
199+
break;
200+
case 7:
201+
message += "SEBNI ";
202+
break;
203+
case 8:
204+
message += "ACHTI ";
205+
break;
206+
case 9:
207+
message += "NUNI ";
208+
break;
209+
case 10:
210+
message += "ZANI ";
211+
break;
212+
case 11:
213+
message += "EUFI ";
214+
break;
215+
}
216+
if(minutes < 5)
217+
{
218+
message += "GSI ";
219+
}
220+
221+
logger.logString("time as String: " + String(message));
222+
223+
return message;
224+
}
225+

0 commit comments

Comments
 (0)