将沃尔玛3.88美元的模拟时钟改装成基于ESP8266的Wi-Fi时钟。
Converting a $3.88 analog clock from Walmart into a ESP8266-based Wi-Fi clock

原始链接: https://github.com/jim11662418/ESP8266_WiFi_Analog_Clock

该项目详细介绍了使用WEMOS D1 Mini ESP8266和廉价石英钟机芯构建一个自动校时模拟钟的过程。ESP8266连接到网络时间协议(NTP)服务器以获取准确的时间,每秒调整钟的秒针十次以同步。它还考虑了夏令时。 核心挑战在于控制钟机芯——内部线圈断开并连接到ESP8266进行脉冲控制。一个关键特性是断电恢复:钟的指针位置被保存到Microchip 47L04串行EEPROM中。重启后,ESP8266检索此数据,避免了重新校准的需要。 最初,ESP8266提供的简单网页允许用户设置钟的起始位置。一个状态页面,可以选择性地显示图形钟盘(SVG或Canvas),提供运行反馈。Arduino草图中的`PULSETIME`常量可能需要根据所使用的特定钟机芯进行调整。

一篇 Hacker News 帖子详细介绍了一个项目,有人将沃尔玛售价 3.88 美元的模拟时钟改装成了一个支持 Wi-Fi 的时钟,使用了 ESP8266。该项目在 GitHub 上可用 (github.com/jim11662418)。 讨论引发了对 Wi-Fi 必要性的质疑,一位用户建议使用 NFC 与手机同步作为更便宜、更新频率更低的替代方案。 另一位评论者分享了最近购买沃尔玛“原子钟”的经历,发现夏普的“AccuSet”时钟并非真正自动——它们依赖于预设电池和时区滑块,经常出现时间不准确或仍然需要手动设置的情况。这凸显了关于自动设置时钟的欺骗性营销行为。
相关文章

原文

This project uses an WEMOS D1 Mini ESP8266 module and an Arduino sketch to connect to a NTP (Network Time Protocol) server to automatically retrieve and display the local time on a inexpensive analog quartz clock. The ESP8266 reconnects to the NTP server every 15 minutes which keeps the clock accurate. The clock also automatically adjusts for daylight savings time.

WEMOS D1 Mini ESP8266 Module with EERAM IC and Components on a Piece of Perfboard

Schematic

I'm using an analog clock with a quartz movement I found at my local Walmart for $3.88. Whatever analog clock you decide to use, its quartz movement will need to be modified so that it can be controlled by the ESP8266 module. Open up the movement (most of them snap together without any fasteners), disconnect the internal coil of the Lavet stepping motor from its quartz oscillator and then solder a wire to each of the coil's leads to make connections for the ESP8266. If you search around on the web you'll find articles showing how others have done it. Be careful when working with the coil. The coil's wires are typically thinner than a human hair and extremely fragile.

Modified Clock Movement

The sketch: AnalogClock.ino should be (I hope) clear enough, but here, in brief, is a summary of how it operates. Ten times each second the ESP8266 compares the time displayed on the analog clock to the actual time retrieved from an NTP server. If the analog clock lags behind the actual time, the ESP8266 advances the clock's second hand until the clock agrees with the actual time. If the time displayed on the analog clock is ahead of the actual time, the ESP8266 simply waits until the actual time catches up with the analog clock since it can't move the clock's hands backwards.

The ESP8266 advances the analog clock's second hand by generating bipolar pulses, alternately positive and negative to the clock's Lavet motor coil. Because of differences in clock mechanisms, you may need to increase or decrease the "PULSETIME" constant in the sketch by few milliseconds to make your mechanism step reliably. Experimentally, I found that 30 milliseconds works best for my movement.

The biggest problem with using these cheap analog clocks for a project like this is that the clocks don't provide any type of feedback to indicate the position of the clock's hands. Thus if power is interrupted to the ESP8266 controlling the clock, the ESP8266 "forgets" where the clock's hands are positioned. To get around this problem, the positions of the hour, minute and second hands are stored in a Microchip 47L04 Serial EERAM (4Kbit SRAM with EEPROM backup) and updated each second as the clock's hands positions change. If power is interrupted, the ESP8266 can retrieve the last position of the clock's hands from the EERAM when power is reapplied.

The very first time that the sketch is run, the user will be directed to a simple web page (see below) served by the ESP8266 which is used to tell it where the analog clock's hands are initially positioned. From that point on, the ESP8266 will use the data stored in the EERAM to "remember" the positions of the clock's hands.

Analog Clock Setup Page

Arduino Serial Monitor During Analog Clock Startup

Once the ESP8266 finishes its initialization and starts operation, it serves a simple web page showing the clock's status. The status page can optionally show a graphic image representing the clock's Face drawn using Scalable Vector Graphics, or HTML Canvas, or no image at all.

Analog Clock Status Page Using Scalable Vector Graphics to Draw the Clock Face

Analog Clock Status Page Using the HTML Canvas Element to Draw the Clock Face

Analog Clock Status Page Displaying Text Only

联系我们 contact @ memedata.com