Forum Rule: Always post complete source code & details to reproduce any issue!
Doomsday Atomic "Alpha Clock Five" Project using the Teensy 3
Doomsday Atomic "Alpha Clock Five" Project using the Teensy 3
I wanted a clock that would display precision time and date in "all" worst case scenarios.
If this clock does not show the precise time then its time to gather up food, water, ammunition,
and the family and head for the underground bunker!
This could happen - imagine this scenario ....
The World Wide Web (Internet) goes down.
All the US Military global positioning satellites (GPS) stops working.
The 60Khz WWVB pulse radio towers (Atomic clock) at Fort Collins, Colorado cease operation.
The electrical power grid cease to function.
All cellphone towers are in-operational.
All POS telephone land lines stop functioning.
All TV and cable systems are in-operational.
It's the end of civilization ... Doomsday! Do you have the precision time and date?
I may be dead and long gone but my Doomsday Atomic Alpha Clock Five would be still functional, working and indicating the precision time!
In this project, we used a GPS, a WiFi Electric IMP (network time), a custom built WWVB Atomic radio receiver, two precision TXCO real time clocks (+- 2 PPM SPI DS3234 and I2C DS3232) and two micro controllers - (Teensy 3 ARM stamp & Arduino 328P clone). We then use the three precision clock sources (UNIX seconds) to drive or sync to the Evil Mad Scientist huge, very bright, "Alpha Clock Five" 2.5" clock display.
Note: Three clock sources we refused to even consider but can be easily added later:
The AC mains 120 VAC 60 Hz power. <---- No accurate enough for this Atomic clock project.
The POTS - plain old telephone service (land line) (using Caller-ID). <-- Serial caller-id boxes are very hard to find.
The Cell Phone / GSM. <---- Very costly.
A bit of humor ... Our Doomsday Atomic Alpha Clock Five is driven by two vendor's who's name or logo is the devil. The Electric IMP Wifi SD card shows the devil on it and the Arduino pre-processor compatible "red board" Arduino 328P clone (Evil Mad Scientist) is named Diavolino or "little devil". If the end of the world or Doomsday ever does comes, our clock would probably not work because we have little two devils installed in it!
Alpha Clock Five "KIT" Features
Standard Features of Alpha Clock Five:
•Extremely wide display brightness range. All the way from surprisingly dim (for dark bedrooms) all the way up to surprisingly bright (for brightly-lit offices).
•Huge 2.3" (5.8 cm) tall digits are easy to see, even if you normally wear glasses
•Alarm on-off indicator
•Six standard alarm tones
•12-hour (AM/PM) and 24-hour clock modes
•Rear-panel white LED nightlight; can be turned on or off from the options menu
•Built-in calendar. Month and day display can be interleaved with time display
•Beautiful, sturdy acrylic case features subtle, laser-engraved button labels
•Transparent rear panel lets you show off your handiwork
•Comes complete with plug-in power supply and backup battery
•Micro controller comes pre-programmed with Alpha Clock Five firmware v. 2.0; no programming is required
•Open source hardware design-- easy to hack!
•Open source software design-- easy to reprogram (if you want to)!
•Based on the ATmega644A micro controller with 64 kB of flash, with plenty of room to grow.
•Comes pre-flashed with Sanguino bootloader; can be programmed through Arduino IDE (with extensions).
•6-pin TTL-serial connector, can be used to display data or time sent from computer
•Unused I/O pins are broken out from the micro controller, including one ADC and 5+ GPIO
•Open-frame case design gives easy access to serial connector and reset button
Alpha Clock Five "kit" comes complete with a Chronodot real-time clock module. It provides your clock kit with (1) a higher accuracy quartz crystal oscillator, (2) a backup battery, and (3) extra geek cred for
having a TCXO-based RTC. The included battery is estimated to last for 7 years.
Alpha Clock Five includes a "TTL serial" port that can be used for communication between your computer and the clock. This serial port can be used to sync the clock's time to the time on your PC.
Note: We use this TTL port to sync to our micro controller precision clock sources.
The Alpha Clock Five is a fine standalone precision clock which will display the time and date and has numerous other functions. We added the Arduino compatible Teensy 3 ARM stamp to enhance this clock with "Atomic" precision by using a custom built Atomic 60Khz radio receiver, a GPS and Wifi (network time - Electric IMP). Also, we added algorithms that will automatically set the clock for ten years during DST. (Daylight savings time) (For hands free operation)
DoomsDay Atomic precision clock driver features
using the Teensy 3 ARM stamp
•Two precision temperature controlled (TXCO) real time clocks (+-2 PPM SPI RTC DS3234 & I2C RTC DS3232). These TXCO RTC clocks can be removed from ambient temperature surroundings
and would still have minimal drift. +- 2 PPM = 0.17 seconds/day = 1.05 minutes/year
•High-quality "Ultimate" GPS module that can track up to 22 satellites on 66 channels and has an excellent high-sensitivity receiver (-165 dB tracking!) - Used for a precision time / date clock source.
It can do up to 10 location updates a second for high speed, high sensitivity logging or tracking.
On the GPS module there is a link status LED that cycles every 15 seconds to indicate a satellite fix is found. An optional "active" external antenna was used to help boost the GPS signal reception inside the housing structure.
•Wifi "Electric IMP" SD card for network time. A yellow status LED indicates wifi link connection and operation on this custom built breakout board. This yellow status LED toggles on/off every second for network time updates.
•A 32 bit ARM processor stamp (Teensy 3) used for the main "Atomic" clock driver operation. This resource heavy ARM micro controller has plenty of GPIO, hardware serial ports, flash, RAM, CPU MHz and peripherals to process all the time clock sources in a timely fashion.
•A 4 pin 2 mm. JST, modular, solid, organized, connection system for the Teensy 3 ARM stamp module. This Mini T3 Baseboard, provides power, ground and GPIO signal separation needed
in connecting all the numerous wired clock sources up easily to the Teensy 3.
•An "Atomic" WWVB 60 KHz time radio "clone" receiver with an Arduino compatible pre-processor with status color bargraph. This cool LED bargraph indicates Atomic radio reception, decode status and processing.
The "Atomic Clock" WWVB 60KHz RF source is from Fort Collins, Colorado USA. This Atomic clock source is also known as a cesium oscillator. Cesium beam atomic clocks are stable to 1 x 10-13 (8.64ns/day 8 billionths of a second!) or 259ns (259e-9 seconds) a month (ppm is 0.0000001ppm !). Note: For practical purposes, our Doomsday Atomic Alpha Clock Five main I2C RTC is only updated once on the second.
Note: For Europeans, the DFC77 Atomic clock source is available.
• A "high side" I2C T3 system current and voltage monitor module for advanced system diagnostics and troubleshooting.
• A LED Bar 10 position multi-color light bars with serial driver IC which was used to upgrade the Atomic WWVB radio time signal decode status LEDs.
• Three extremely cool LED circular hex bars which shows the absolute time differences between the "main I2C RTC" and the "GPS time", "WiFi network time" (Electric IMP), "WWVB Atomic Time" (in Unix seconds). A 3 wire 595 shifter(s) (three of them) were used to display the results on the circular hex 21 LED bars.
• A color changing, RGB, 4x20 char, back-lit, I2C LCD with 5 tact switches that operates with only 2 wires (I2C) to save Teensy 3 GPIO resources. This RGB LCD "shield" module provides a menu system for all the Atomic clock system variables. Note: The 5 tact switches were replaced by a mini, external tact switch joystick for easy menu LCD navigation.
• A four stage novelty GEEK "Doomsday" switch sequence, (two toggle switches, one key-switch and one Doomsday red push-button) when activated in sequence, will enable the 4x20 RGB LCD display and tact joystick.
• Other than providing precision clock source generation for the Alpha Clock Five, latitude, longitude, local sunrise time, local sunset time, UNIX GMT, DST time, time zone and a host of other
variables can be inspected by using the bright, back-lit, RGB, LCD and joystick.
• Built-in fail-safe operation. If any clock source fails, the precision clock driver subsystem will still generate a precision time clock sync signal. If the precision clock driver subsystem fails,
the Alpha Clock Five will still run with precision time with the built-in TCXO ChronoDot real time clock (I2C DS3231). If both subsystems fail, with seven clocks, head for the bunker.
• Automatic DST (Daylight Savings Time) time adjustment. Most clock sources like GPS, WWVB and Wifi only generate Greenwich Mean Time (Unix seconds) and don't indicate time zone and DST. This clock driver has special built-in algorithms which computes and adjust the "local time" due to "spring forward" and "fall back" DST time changes mandated by the US government. The Alpha Clock Five, at daylight savings time, will be adjusted properly with this calculated DST time change. This means, the Alpha Clock Five needs no human intervention whatsoever, except for changing the lithium RTC back-up batteries after 7 years!
• Built-in visual clock status displays. The LCD shows all the driver clock sources using the panel mount joystick. There are two status LEDs that indicate GPS "Fix" (reception) and the Wifi
network time update 1 sec intervals. There are 3 circular hex difference displays that indicate, in seconds, how far each clock source is from the main built-in I2C main RTC. The red LED in the center of the
display indicates minus for the difference display. Also, there is a 10 position color bar graph that indicates the WWVB reception and frame processing status. All ten positions were used for easy
user WWVB Atomic diagnostics. At night time, the display/LED light show is awesome!
Libraries used in the Doomsday Atomic Alpha Clock Five Project
#include <DS1307new.h> // For precision DS3232 I2C RTC (uses wire.h)
#include <Wire.h> // For Adafruit code for RGB shield uses uses the wire.h
#include <Adafruit_MCP23017.h> // Adafruit I2C 16 bit I/O expander
#include <Adafruit_RGBLCDShield.h> // Liquid crystal library "Adafruit modified" to work with the
I/O expander (above)
#include <TimeLord.h> // For general time date calculations and for sunrise sunset time
#include <EEPROM.h> // Uses first EEPROM byte to prevent RTC sync adjustment.
#include <TinyGPS.h> // Uses serial port 1 hardware UART for NEMA decode.
#include <Shifter.h> // For difference hex LED displays - Uses 74HCT595 shifter
#include <Adafruit_INA219.h> // Adafruit system current and voltage monitor
Project info and vendors link references:
Disclaimer and acknowledgments ... we do not work for or have any interest in the following vendors.
Closer examination of the vendors reveals that Adafruit provided most of the high tech electronics for this project and without Adafruit this project could not be completed!
Thanks to Paul Stoffregen of www.pjrc.com for designing the Arduino compatible K20 Teensy 3 ARM stamp for our project.
Especial thanks to "Captain Tagon" which spent nearly his whole life span coming up with a complex Atomic WWVB RF frame time decode sequence sketch used “only” on the Arduino 328P. (For Europeans, use the DFC77 module)
US Atomic reciever info http://duinolab.blogspot.com/2009/05...-receiver.html
US Atomic receiver info http://tf.nist.gov/stations/wwvtimecode.htm
US Atomic receiver info http://www.joejaworski.com/wwvb/
US Atomic receiver -- the one and only ? vendor left (UK) http://www.pvelectronics.co.uk/index...products_id=82
US Atomic receiver forum discussion http://arduino.cc/forum/index.php/topic,14946.0.html
Precision RTC info http://www.maximintegrated.com/desig...design/rtc.cfm
LCD I2C shield with 5 tact switches replaced by tact joystick (hacked or modified) http://adafruit.com/products/715
RGB backlight negative LCD 20x4 (modified to fit 2x16 LCD shield) https://www.adafruit.com/products/498
Ultimate GPS (modified-remote mounted fix LED) http://adafruit.com/products/746
+5 VDC to 3 VDC low cost level converter(s) (for I2C LCD, WWVB and ALpha Clockn Five) http://adafruit.com/products/757
INA219 High Side DC Current Sensor Breakout http://adafruit.com/products/904
Electrc IMP SD WiFi card (modified for network time and status) http://adafruit.com/products/1129
Tact joystick (modified for LCD display) https://www.adafruit.com/products/504
CR2032 battery holder(s) (Standardize battery holder for all lithium backups) https://www.adafruit.com/products/653
Spring loaded terminal blocks for 5 V bus bar https://www.adafruit.com/products/1074
Protoboard for 5 V bus bar https://www.adafruit.com/products/589
Panel mount power connector 2.1 mm https://www.adafruit.com/products/610
Teensy 3 ARM Stamp http://www.pjrc.com/teensy/ OR http://adafruit.com/products/1044
Arduino 328P clone for atomic receiver http://www.evilmadscientist.com/2010/diavolino/
Alpha Clock Five kit http://shop.evilmadscientist.com/pro...inykitlist/447 OR https://www.adafruit.com/products/620
DS3232 precision RTC mini board with mounting holes http://www.futurlec.com/Mini_DS3232.shtml
Shift register 74HC595 breakout (3 needed for 3 hex diff. displays LED7R) https://www.sparkfun.com/products/10680?
DS3234 SPI RTC used is the Atomic receiver module https://www.sparkfun.com/products/10160
Special hex circular LED display LED7R - http://www.mouser.com/ProductDetail/.../eSO5mtobO074D
Special LED color bargraph for Atomic receiver module http://www.seeedstudio.com/depot/-p-...?cPath=156_157
Enclosure(s) for clock source electronics and remote atomic receiver module http://www.polycase.com/
Number of "clocks" used in project
Number of clocks used in this project
1. Atomic WWVB remote module software clock (Note: Arduino 328P RAM is volatile on loss of power) which operates after receiving the first frame time decode WWVB Atomic time signal.
2. Atomic WWVB remote module precision (+- 2 PPM) DS3234 SPI clock with lithium battery backup which also holds the Atomic WWVB time decode during long noisy periods.
3. GPS with internal RTC and lithium battery backup.
4. Electric IMP Wifi (network time)
5. DS3232 TXCO I2C RTC with lithium battery backup - main clock attached to the Teensy 3.
6. "Optional" precision TCXO (DS3231) ChronoDot installed on the "Alpha Clock Five" (installed in this application)
7. Default "software clock" on the "Alpha Clock Five" (not suitable in this application)
You only need one real time clock to keep "normal time" BUT to keep "precision Atomic time" you need 7!
Of course, on the Doomsday Atomic Alpha Clock Five, you can have more than four clock source failures and still keep accurate and precision time!
Operation is very simple. Turn it on, for precision time, and never ever touch it for seven years!
Attached better photos
BTW ... cover your eyes when viewing photo #3. Imagine how the wiring would look like without the mini T3 baseboard.
Most of the wiring was for the 595 shifting wiring harness going to the 21 LED circular diff. displays. In fact, none of the wiring going to the
front panel is necessary which would eliminate at least 50%.
Last edited by t3andy; 01-30-2013 at 01:13 PM.
... This post could use a 'Like' button
Wow, loving what you did here!
I think they will cancel each other out, or amplify each other...
If the end of the world or Doomsday ever does comes, our clock would probably not work because we have little two devils installed in it!
Not sure what either means yet :x
(also, I was kind of expecting a simultaneous double key rotation switch to prevent any 1 man to enable/disable it, like you see in movies for nuclear launch panels)
Last edited by ZTiK.nl; 01-29-2013 at 11:59 PM.
The keyswitch, we got from Sparkfun, was total junk due to nut cross threading so we decided not to use another one. We will install a "skull and crossbone" push button flip cover for sequence #4 fire pushbutton switch. Also, professional decals are being made for the enclosure. (inkjet decals)
also, I was kind of expecting a simultaneous double key rotation switch to prevent any 1 man to enable/disable it, like you see in movies for nuclear launch panels
haha, well you are miles ahead of me (as usual), can't wait for the next update :)
due to nut cross threading so we decided not to use another one
There are none.
can't wait for the next update
Last edited by t3andy; 01-30-2013 at 12:18 PM.
I meant a picture when the decals and such are applied/installed, or is that something we just have to imagine ?
Wouldn't be a problem though, I've got a good imagination ;)
On a sidenote, how portable/mobile is the entire device? (for instance, can it be used in a car, time/GPS)
The GPS has an active, long, remote antenna so using the clock in a vehicle is not a problem.
how portable/mobile is the entire device?
The WWVB Atomic time code receiver is the most noise sensitive module and it would not work in an automobile.
BTW ... This novelty clock is really meant for home use only. Can you imagine, if this clock was transported
through airport security at Portland or Amsterdam? They would incarcerate you for life.
Last edited by t3andy; 01-30-2013 at 12:54 PM.
For decals ... obtain clipart from the internet, then size the clipart with PC paint, then
haha, well you are miles ahead of me (as usual), can't wait for the next update
print it out on white decal paper, spray it with acrylic spray two or three
times for a shiney gloss and last cut the decals and place on double back
thin foam tape.
Building the WWVB Atomic Clock Module.
The construction and design of the Doomsday Atomic Alpha Clock Five, using the Ultimate GPS and Electric IMP, was like a walk in the park. Building the WWVB Atomic clock receiver module was not. If a fly crossed in the path of the WWVB 60KHz signal, which takes one minute to decode, the WWVB 60KHz pulse RF signal could be blocked or become noisy! This is an extreme exaggeration but it shows how sensitive the WWVB signal is when decoding this 60Khz pulse signal.
The best conditions for proper WWVB RF decode are around sunrise and after sunset if you are lucky. All other times, of the day, the signal is just plain noise or garbage. You would be lucky to receive one or two RF fixes per day. Holding this decoded time data in a "software clock" using the micro controller crystal was not precision to us so we used a +- 2 PPM holding SPI TCXO DS3234 RTC to hold the decoded WWVB time signal for long periods of noisy time.
The antenna, for proper reception, needs to be pointing perpendicular horizontally "longwise" towards Fort Collins, Colorado and away from any noise sources like fluorescent lights, routers, WiFi, weed eaters, you name it.
East coast persons will need to obtain a special 100 mm. (70 mm. is the default) antenna for best WWVB reception.
Special VCC/ground filters (high and low bypass caps) was needed to be installed directly across the WWVB receiver module power input.
The main manufacturer C-Max, of the US WWVB radio receiver, no longer sells the WWVB receiver module in the US. we found ours in the UK and this clone module output needed signal inversion. Every day goes by, this WWVB receiver module is becoming more scarce to obtain. Since "Atomic" was in the name of our project, we had to make this precision clock source module work at all cost. Having one of last few WWVB receiver modules, in existence, makes our Doomsday "Atomic" Alpha Clock Project so unique.
We remote mounted the WWVVB module using a "special" shielded RFI/EMI enclosure and the ferrite antenna was externally mounted on the enclosure. (Hammond RFI/EMI enclosures). We also attached to this enclosure with a special RJ45 shielded Ethernet cable which had to properly grounded to earth ground. Then we photo/opto isolated the Arduino clone serial TTL Tx signal from the WWVB receiver to reduce the noise on the Teensy 3 ground and to protect the expensive main electronics from destruction and from ground loops. (Sparkfun photo-isolator BOB-09118) The WWVB signal wiring also had to be shielded and grounded to prevent noise on the pulse signal going to the Arduino clone for pre-processing.
We purchased a special "medical grade" power supply to reduce the noise further and we were able to get much better reception more than twice a day. What we found out is not all external wall-warts are built the same and many were so noisy and could not be used in our application. Also, several Arduino clones, that we used, were also incapable of pre-processing the WWVB signal noise free.
Hope this helps …
Atomic clock module pics will be available for inspection.
Last edited by t3andy; 02-18-2013 at 09:14 PM.
Missed this post in the 'Whats new' list, sry for the late reaction.
Originally Posted by t3andy
It's looking awesome!
Thank you for the how-to tips too :)
For those who don't have a Doomsday Atomic Alpha Clock Five, please don't forget to change or set your clocks 1 hour ahead (spring forward) at 02:00 Sunday morning.
My Teensy 3 assisted Doomsday clock computes the daylight savings time changeover and is automatic for 10 years!
Up until I read your post, I always thought DST was on the same date worldwide...
Another 3 weeks to go here in the Netherlands
Each country's government mandate DST mainly for safety and energy savings.
Up until I read your post, I always thought DST was on the same date worldwide...
In the US, its the second Sunday at 02:00 in March and the first Sunday in November at 02:00.
Our "top secret" algorithm looks at the RTC date and checks this date against a "projected fixed table of DST dates" obtained from the Internet. When the DST date arrives, the main RTC is advanced by one hour (spring forward - March) or subtracted by one hour (fall back - November). We also employed a digital status flag which locks out any further RTC updating for a period of 3 hours after DST. (To prevent multiple DST updates)
Last edited by t3andy; 03-10-2013 at 10:39 PM.
I have to compliment you on your thoroughness!
You truly have thought of everything ;)
If we had to re-design this clock again, we would only use the Ultimate GPS as the main clock source. This module from Adafruit proved to be the most reliable and cost effective for a precision clock source. Since the military provides the satellites for free GPS time keeping then the probability of having this precision clock source disappear is zero.
I am currently (actively) using the Ultimage GPS breakout from Ada, and I can definately recommend it for such uses!
I do not have an external antenna connected, and have a connection with at least 7 satelites at any given time within 2 minutes from powerup (indoors!).
We had to use the active antenna module with the GPS because our homes were made with chicken wire plaster which stops any RF signal dead in its tracks.
The words 'Faraday cage' come to mind
I really don't want to give the impression that there was only one of us doing this project. It was a team effort between neighbors. We separated the tasks between family members so each member did a task that he was not familar with but was guided by others who were highly skilled in his chosen task. That way each member learned a new skill. Skills like programming, printed circuit design, enclosure packaging, bill of materials / parts procurement, documentation and electronic module/soldering/wiring. My highly skilled task or job was to obtain the "liquid refreshments" for the other highly skilled team members.
I have to compliment you on your thoroughness!
You truly have thought of everything
That is a very nice way to run a project!
Did you choose your 'highly skilled task or job' or was it chosen for you ?
I grudgingly accepted that job