Introduction: New Earth Time (NET) Digital Clock in Recycled Retro-modern Case
Ever get confused by GMT, or just wish you had a cooler way to keep track of time? Build a New Earth Time clock! Using a PIC microcontroller, some code, and a couple discrete parts, you too can have a unique timekeeping device to keep on your desk.
New Earth Time (NET) is an idea for a global time standard. Like Greenwich Mean Time (GMT), it is the same "New Earth Time" everywhere on the globe at any instant. Unlike GMT, NET counts time in Degrees and Minutes so as to not be confused with your local time (which is still counted the same way you're used to). You can read all about how New Earth Time works at their website, newearthtime.net .
It seems like a cool idea to me, and what better way to support the idea than to build a clock and start using New Earth Time!
Step 1: Parts
You can see my prototype NET clock in the picture to get an idea of what's involved.
1x - PIC16F627A Microcontroller
1x - 32.768kHz Crystal (Mouser 815-AB26T-32.768KHZ or equivalent)
2x - 22pF Ceramic Capacitor (or 1x 22pF and 1x 0-56pF Variable capacitor for tuning)
4x - 10k Resistor
7x - 100 Ohm Resistor
1x - 4.7k Resistor
5x - 1k Resistor
5x - 2n3904 Transistor
5x - Common Cathode 7-segment Display (Mouser 512-MAN6980 or equivalent)
2x - SPST Momentary pushbutton switch
1x - Round LED, modified as described in Step 2 (Making the degrees LED)
5V Power source (Wall adapter, or 9V battery regulated down with an LM7805 Regulator)
Case (My case came from an old electric blanket thermostat. I love the cool retro-modern look about it)
Breadboard or Perfboard to construct the circuitry
A little bit of Heatshrink (the size of your LED) and a Sharpie Marker.
Step 2: Making the Degrees LED
Because NET counts in Degrees, it is only appropriate to add a Degrees symbol after the Degrees display.
To make your own Degrees indicator, press a piece of un-shrunk heatshrink tubing onto the LED, so that the end of the tubing is about even with the top of the LED lens. Don't shrink the tubing! Leave it just like it is.
Next, take a sharpie marker and color in the center of the LED lens. It usually works best to do this with the LED on, so you can see where you need more ink. It may take several coats of ink to get it dark enough that it blocks light. I find that a "dabbing" motion of the sharpie deposits the ink better that a "dragging" or writing motion.
When you're done, you'll have an LED that only lets light out from the edges - just like a Degrees symbol!
Step 3: Electronic Schematic
The schematic diagram (see picture) and electronic assembly are fairly straightforward since most of the "magic" happens in the microcontroller code.
Just like any digital clock, the microcontroller uses time-division multiplexing to control five 7-segment displays from only 12 I/O pins. You can look up this scheme on the internet, but the basic idea is that only one display is on at any given time but our eye perceives all displays to be on simultaneously due to persistence of vision. The displays are driven by 2N3904 transistors, since the PIC I/O ports can't sink enough current for 7 LEDs.
In addition to the displays, there are two buttons multiplexed into the display outputs for the clock setting functions. One button sets NET Degrees, the other sets NET Minutes.
The 32.768kHz crystal is the main timekeeping device for the clock. You want to make sure you get a high-accuracy crystal, but even then you may need to adjust the value of C1 and C2 to keep time accurately.
I have included a small 5V regulator circuit in the lower corner. If you have a 5V source already, this isn't needed.
Step 4: Microcontroller Code
Here is the source code for the clock in both Assembly (.asm) and Hex (.hex), compiled for the PIC16F627A. The code is fairly well documented, but here is quick explanation of what's going on.
The magic ratio to convert regular time to new earth time is 0.25 NET Minutes per 1 second (or 1 NET Minute for every 4 seconds of elapsed time). This is calculated with the ratios 360 NET Deg per 24Hrs and 60 NET Minutes per NET Degree.
To count NET, the code uses the PIC's built-in Timer1 (TMR1) module with an external 32.768kHz crystal for timekeeping. To achieve the magic ratio of 1 NET Min per 4 seconds, we can use the 16-bit TMR1 register with a 1:2 prescaler. (The 16-bit TMR1 overflows at 65536 counts, crystal runs at 32768 counts per second. 65536/32768 = overflow every 2 seconds. Just add in the 1:2 prescaler and voila! Interrupt every 4 seconds!)
The PIC itself runs on the internal 4MHz oscillator. The five 7-segment LED displays are scanned at a fixed interval controlled by Timer0 (TMR0). Every time TMR0 overflows, the PIC will switch to the next display (for time division multiplexing). The key to time division multiplexing displays is to scan them as fast as possible and at a regular interval. Otherwise, your eye will perceive flickering in the display.
Time setting is performed by two buttons - one button increments NET Degrees, and one NET Minutes. The buttons are continuously monitored by the PIC in the main program loop. To save I/O pins, the buttons are connected to what is normally an output pin. When the PIC checks for button status, it switches that I/O pin to an input and takes a reading.
When a button press is detected, the program goes to a time setting function specific to each button. This function increments the variable keeping track of time, just like the TMR1 interrupt. A single press will increment the clock one step, while holding the button will result in continuous advance. There is a delay function in the code to debounce the initial press and provide the timing for the continuous advance.
Step 5: Mechanical Assembly
Now that you have the circuitry and coding under control, the next step is to put it in a box and make it look nice.
The case for my clock actually came from an old electric blanket thermostat. It worked out perfectly - I was able to pull out the old faceplate (with the temperature setting lever and markings) and slide in a piece of red plastic in the same groove. The colored plastic improves the contrast ratio of the display (makes it look better!) Also, I was able to line up a PCB-mount power jack right where the blanket cords used to come out.
Finding this exact same case is near impossible (I've been looking!), so just pick out something that looks neat, and is about 4"x4"x4" in size, and go to town!
You can also build a box out of wood (see other picture), or just leave it on a big piece of perfboard and hang it on the wall. It's up to you!
Step 6: Conclusion
If you've followed along this far, by now you just might have a fully functioning NET Clock!
There's plenty to do from here - you might want to add in things like a settable audio alarm, or backup battery. Or better yet, write some code so the clock can convert between NET, GMT, and Local time.
Enjoy using NET, and thanks for reading!