Exact timing is always interesting to me. Today, we rely heavily on time delivered through the Internet, GPS satellites, and radio waves from broadcast stations. However, I wanted a watch that kept good time without relying on the outside world. That's certainly better than the time provided by the crystal oscillators used in typical digital clocks and microcontrollers, which can be off by about 1.7 seconds or more per day. About 10 minutes a year.
Of course, you could also buy an atomic clock, one with a built-in rubidium oscillator of the kind found on GPS satellites. (Not the kind sold as “atomic clocks,” but ones that actually rely on radio clock reception.) Rubidium clocks offer incredible accuracy, but cost thousands It's US dollars. He needed something in between, and for historical reasons he always found salvation in the form of an oven-controlled crystal oscillator known as an OCXO. With one of these, you can build your own watch for about $200. You can also build clocks that are approximately 200 times more accurate than typical quartz clocks.
Temperature changes are the biggest source of error in traditional crystal oscillators. They expand or contract the crystal, changing its resonant frequency. One solution is to track temperature and compensate for changes in frequency. However, it is better not to change the frequency in the first place. This is where OCXOs come into play.
Printed board [center] It can be cut into two parts, with timing-related components mounted on the bottom and control and display components mounted on the top.james provost
The OCXO keeps the crystal at a constant temperature. To avoid the complication of having to heat and cool the crystal in response to ambient fluctuations, the crystal is kept heated to around 80 °C, well above the environmental temperatures it might experience. In the past, OCXOs were power-hungry, bulky, and expensive, but in the last few years, smaller versions have emerged that are much cheaper and consume much less power. The Raltron OCXO I chose for my watch costs $58, runs on 3.3 volts, and draws 400 milliamps in steady-state operation.
The OCXO resonates at 10 MHz. In my clock, this signal is input to a 4-bit counter that outputs a pulse every time it counts from 0000 to 1111 in binary, effectively dividing the 10 MHz signal by 16. This 625 kilohertz (kHz) signal is then connected to the Arduino Nano microcontroller's hardware timer. Triggers a program interrupt every tenth of a second to update the clock's time base. (For more information on timing chains and how the software works, see the following posts: IEEE spectrumSee also the website, bill of materials and printed circuit board files. ) You can set the time using a rotary controller connected directly to the Nano.
The Nano tracks the time, going through seconds, minutes, hours, and even drives the display. This display was created using six Adafruit “CharliePlex FeatherWings”. This is a 15 x 7 LED matrix with controllable brightness in different colors. Each is controlled via an addressable I2C serial bus protocol. The problem arises because the CharliePlex is wired to have only one of two possible I2C addresses, making it impossible to address the six clock digits individually on a single bus. It's for a reason. My solution was to use an I2C multiplexer that takes the incoming I2C data and switches it between 6 separate buses.
The timing chain starts with the OCXO oscillator and its 10 MHz signal and ends with a display that updates every second. The timing signal synchronizes the Nano microcontroller's hardware timer and triggers the Nano's software interrupt handler 10 times per second. Therefore, software modifications can make many changes and add new features.james provost
For example, using a microcontroller rather than a separate logic chip simplifies the design and makes it easier to modify and expand. For example, it's easy to tweak the software to replace numbers with your own font design or adjust display brightness. Connector blocks for serial interfaces are available directly on Nano. This means you can use the clock as a timer or trigger for other devices.
For such purposes, the display can be omitted entirely, greatly reducing the size of the clock (although overriding display startup validation requires software changes). The watch's printed circuit board is designed so that it can be cut into two parts, with the bottom third containing the microcontroller, OCXO, and other supporting electronics. The top two-thirds house the display and rotary encoder. By adding four headers and connecting two cables between each piece, the boards can be arranged to form a wide range of physical configurations, giving you freedom in designing your enclosure form factor. clock. In fact, creating the PCB that made this possible was probably the most difficult part of the entire process. But the flexibility of the final design's hardware and software was worth it.
The entire device is powered through the Nano's USB-C port. The clock, OCXO, and display together needed to exceed the 500 mA nominal maximum current of the early USB ports, so USB-C was needed to provide enough current. A battery backup connected to this port is required to prevent resets due to power loss. Using one of the common coin-cell-based real-time backup clocks is pointless due to their relatively low accuracy.
And with the goal of creating a cost-effective and accurate clock, we cross-checked the OCXO output in the circuit with an HP 53150A frequency counter. As a result, the clock lags within 0.00864 seconds per day, or 3.15 seconds per year. In fact, the accuracy would probably be better than that, but it was at the limit of what a frequency counter could measure. Please try making it yourself. Soldering only takes a few hours. I think you will agree that it was a waste of time.