Network Time Protocol On The ESP32

Network Time Protocol (NTP) is one of the best ways to keep networked computers synchronized to the same time. It’s simple, lightweight, and not only allows computers to maintain a time standard together, but it also allows some computer manufacturers to save some money on hardware costs. The Raspberry Pi is perhaps the most well-known example of a low-cost computer without the extra expense of a real-time clock (RTC). While the Pi sets up NTP essentially automatically, other microcontrollers like the ESP32 don’t, but it is possible to configure them to use this time standard with some work.

For this project the MicroPython implementation for the ESP32 is required. MicroPython is a way of running Python code on microcontrollers or other embedded systems without all of the overhead that Python would normally require. Luckily enough, the NTP libraries are built right in so once MicroPython is running on the ESP32 it’s nearly as easy as calling the library. Of course you will have to make sure there is an internet connection, and then grab the time, sync it to the machine, and then set the timezone.

For a bonus exercise, the project’s creator [Bhavesh] suggests attempting to configure Daylight Savings Time, although this can be a surprisingly difficult problem to solve. In the meantime, there are a few other ways of installing a clock on a microcontroller like this one. An RTC module is an obvious choice, but you can also get incredibly accurate time by using a GPS module as well.

NTP Server Gets Time From Space

Cheap GPS units are readily available nowadays, which is great if you have something that needs to be very precisely located. Finding the position of things is one of many uses for GPS, though. There are plenty of ways to take advantage of some of the ancillary tools that the GPS uses to determine location. In this case it’s using the precise timekeeping abilities of the satellites to build a microsecond-accurate network time protocol (NTP) server.

GPS works by triangulating position between a receiver and a number of satellites, but since the satellites are constantly moving an incredibly precise timing signal is needed in order to accurately determine location from all of these variables. This build simply teases out that time information from the satellite network and ignores the location data. There are only two parts to this build, a cheap GPS receiver and a Raspberry Pi, but [Austin] goes into great detail about how to set up the software side as well including installing PPS, GPSd, and then setting up the actual NTP server on the Pi.

While this is an excellent way to self-host your own NTP server if you don’t have Internet access (or just want to do it yourself), [Austin] does note that this is probably overkill on timekeeping as far as accuracy goes. On the other hand, the Raspberry Pi has no built-in real time clock of its own, so this might actually be a cost-competitive way of timekeeping even when compared to something more traditional like a DS3231 RTC module.

Continue reading “NTP Server Gets Time From Space”

an image of maketime showing the current time

Unique Clock Doubles As A Development Board

Most clocks these days have ditched the round face and instead prefer to tell time through the medium of 7-segment displays. [mihai.cuciuc] is bringing the round face to digital clocks with his time-keeping piece, MakeTime.

MakeTime's custom PCBMakeTime serves two purposes, the first and most obvious one is as a clock. Rather than displaying the time with digits, MakeTime harkens back to round dial clocks by illuminating RGB LEDs along its perimeter to show the position of the minute and hour “hands”. By using 24 LEDs, MakeTime achieves a timing granularity of 2.5 minutes.

The second purpose is as a development platform. [mihai.cuciuc] designed the clock with hacking in mind, opting to build it with components that many are already familiar with, such as a DS3231 RTC and WS2812 LEDs. To make the entire thing Arduino compatible, the microcontroller is an AtMega 328P, that can be connected to through the micro-USB port and CH340 USB-UART IC. If MakeTime outlives its time as a clock, all of the unused GPIO of the 328P are broken out to a single pin header, allowing it to be repurposed in other projects for years to come.

It seems like everyone is making their own unique timekeeping device these days. Check out the clock made out of ammeters we covered last week.

A Perfect Clock For Any Hacker’s Ohm

The vast majority of us are satisfied with a standard, base ten display for representing time. Fewer of us like to be a bit old-fashioned and use a dial with a couple of hands that indicate the time, modulo twelve. And an even smaller minority, with a true love for the esoteric, are a fan of binary readouts. Well, there’s a new time-telling game in town, and as far as we’re concerned it’s one of the best ones yet: resistor color codes.

The Ohm Clock is, as you may have guessed, a giant model of a resistor that uses its color bands to represent time.  Each of the four bands represents a digit in the standard HH:MM representation of time, and for anybody well-versed in resistor codes this is sure to be a breeze to read. The clock itself was designed by [John Bradnam]. It’s body is 3D printed, with RGB LEDs to brightly illuminate each segment. The whole thing is controlled by an old favorite – an ATtiny, supported by a Real Time Clock (RTC) chip for accurate timekeeping.

You can set the time in the traditional fashion using buttons, or — and here’s the brilliant part — you can use a resistor. Yup, that’s right. Connecting a 220 Ohm resistor across two terminals on the clock will set the time to 2:20. Genius.

When you come across an art as old as timekeeping, it’s easy to assume that everything’s already been done. We have sundials, hourglasses, analog clocks, digital watches, those cool clocks that use words instead of numbers, the list goes on. That’s why it’s so exciting to see a new (and fun!) idea like this one emerge.

This DIY Split-Flap Display Does Both Time And Weather

With little more than four economical stepper motors, a Raspberry Pi Zero, and a 3D printer, [Thomas Barlow] made himself an awfully slick Smart Flip Clock that can display not only the time, but also weather data as well. This is done by adding a few extra graphics to some of the split-flaps, so numbers can also be used to indicate temperature and weather conditions succinctly. Displaying the time has to do without a colon (so 5:18 displays as 518), but being able to show temperature and weather conditions more than makes up for it.

32 degrees and a mix of sun and cloud

According to the project’s GitHub repository, it looks as though each split-flap has thirteen unique positions. The first ten are for numerals 0 through 9, and the rest are either blank, or used to make up a few different weather icons with different combinations. A Python script runs on the Raspberry Pi and retrieves weather data from OpenWeather, and the GPIO header drives the display via four geared stepper motors and driver boards. The rest of the hardware is 3D printed, and [Thomas] helpfully provides CAD models in STEP format alongside the STL files.

The basic design of a split-flap display is really quite versatile, and enterprising hackers have been putting delightful new twists on them for years. There has been a split-flap display used as a kind of flip-book animation, and we’ve also had the pleasure of seeing an entire Tarot deck used for esoteric, automated readings.

Reliable Frequency Reference From GPS

GPS technology is a marvel of the modern world. Not only can we reliably locate positions on the planet with remarkable accuracy and relatively inexpensive hardware, but plenty of non-location-based features of the technology are available for other uses as well. GPS can be used for things like time servers, since the satellites require precise timing in order to triangulate a position, and as a result they can also be used for things like this incredibly accurate frequency reference.

This project is what’s known as a GPSDO, or GPS-disciplined oscillator. Typically they use a normal oscillator, like a crystal, and improve its accuracy by pairing it with the timing signal from a GPS satellite. This one is a standalone model built by [Szabolcs Szigeti] who based the build around an STM32 board. The goal of the project was purely educational, as GPSDOs of various types are widely available, but [Szabolcs] was able to build exactly what he wanted into this one including a custom power supply, simple standalone UI, and no distribution amplifier.

The build goes into a good bit of detail on the design and operation of the device, and all of the PCB schematics and source code are available on the projects GitHub page if you want to build your own. There are plenty of other projects out there that make use of GPS-based time for its high accuracy, too, like this one which ties a GPS time standard directly to a Raspberry Pi.

This Classy But Chaotic Gear Clock Keeps You Guessing

There are a lot of ways to tell time, but pretty much all of them involve some sort of sequential scale — the hands sweeping across the face of an analog clock comes to mind, as does the incremental changes of a digital clock. Clocks are predictable by their very nature, and therefore somewhat boring.

This nonsequential gear clock aims to break that predictability and make for a timepiece that’s just a little bit different. It’s the work of [Tony Goacher], who clearly put a lot of work into it and pulled out nearly every tool in the shop while doing it. He started with a laser-cut plywood prototype to get the basics worked out — a pair of nested rings with internal gear teeth, each hanging on a stepper-driven pinion. The inner ring represents hours and the outer minutes, with the numbers on each randomly distributed — more or less, since no two sequential numbers are positioned more than five seconds of rotation apart.

The finished version of the clock is rendered in brass, acrylic, hardwood, and a smattering of aluminum, with a case reminiscent of the cathedral radios of yore. There are some really nice touches, like custom-made brass screws, a CNC-engraved brass faceplate with traditional clock art, and a Latin inscription on the drive cog for the hours ring that translates roughly to “Time rules all.” When we looked that up we found that “tempus rerum imperator” is the motto of the Worshipful Company of Clockmakers, the very existence of which we find pleasing in the extreme.

The clock runs through its initialization routine in the brief video below. We’re not sure we’d want this on our nightstand, but it’s certainly a unique and enjoyable way to show the passage of time. It sort of reminds us of this three-ringed perpetual calendar, but just a bit more stochastic.

Continue reading “This Classy But Chaotic Gear Clock Keeps You Guessing”