Swiss railway clock
A simple Wi-Fi web clock with module ESP8266.
Swiss railway clock is precise digital wifi clock. It's a miniature web server and very good demo for ESP8266 & Lua fanclub.
By mapping ports of your router, you can connect to it from anywhere on the world. This clock uses Lua software and
trendy vector graphics format SVG with animations. The clock is particularly interesting for its graphic design. In terms of program, it using
synchronization the time from an external NTP server.
Thanks to this, clock is quite fast and precision, which was my goal.
- SW2 - switch for RESET
- SW3 - switch for flashing firmware
- C2 + C3 - useful additions
I used reduced Lua firmware
generated from nodemcu-build. Lua specification is as follows:
- NodeMCU custom build by frightanic.com
- branch: master
- commit: 8e48483c825dea9c12b37a4db3d034fccbcba0bf
- SSL: false
- modules: dht,file,gpio,net,node,rtctime,sntp,tmr,wifi
- built on: 2016-09-10 15:55
- powered by Lua 5.1.4 on SDK 22.214.171.124(39cb9a32)
I do flash Lua firmware with this classic flasher :
Settings of flasher for ESP8266-01 / 512kB
Settings of flasher for ESP8266-12 / 4MByte :
Here are the necessary programs :
- Warning - This Lua communicates with speed 115.2kbits/s
- After the flash Lua firmware, format the filesystem - command file.format() (In the case esp8266-12 it takes a very long time, be patient.)
- Set your SSID and password for your router in clock application, eventually your local time zone.
- Upload clock application to module, I used program ESPlorer from GITHUB for it.
- Compile it with command node.compile("FileName.lua")
- Run "FileName.lc" or apply my trick - rename compiled program to init.lua - file.rename("FileName.lc","init.lua") and reset module.
- When starting the server, on a serial terminal can be read ip address of module.
- Warning - The clock will not display with IE8 and its older versions! Browser compatibility test is here.
- When editing source HTML(SVG) file, its length should not exceed 4096 bytes, including http header. This file has length of about 2700 bytes now.
- During normal operation, I strongly recommend to disconnect the USB / RS232 converter. Connected converter with power supply off,
may cause instability of module ESP8266.
Sept / 2016