Whether world trotting or just interested in knowing what time it is before making that late night call, a 5 zone world clock fits the bill. Since I got some extra TM1637 7 digit displays in my latest shipment, I decided to put together a clock for all occasions. I decided to use an Arduino Uno for the project, which provided enough GPIO’s for 5 clocks, 5 AM indicators (LEDs) and an overhead light activated with a touch sensor. The only pin I didn't use was D1, which is for serial Tx, which could only lead to trouble. So if you are interested, read on!
Step 1: Parts
To make the clock I used:
- An Arduino Uno (but a Nano or Mega would also work)
- (5) TM1637 displays
- (5) LEDs (to use as AM/PM indicators)
- (5) 220 Ohm resistors
- RTC3231 Clock
- AdaFruit NeoPixel stick or other lighting
- Touch sensor to activate light
- Buck convertor to accommodate power draw
- Frame or case (I 3D printed a case, but be creative)
- 12V power with a barrel receptacle (to allow splitting of the feeds)
- optional - Arduino Uno shield (just to make it a little simpler)
Step 2: Getting Started
I’m still new to the TM1637 so I programmed one first to see what I could do. At first it did nothing, but the Arduino community is amazing and soon had me up and running. On my TM1637 I had to cut the 2 caps on the back to get it working and from there just some trial and error. In the end I still couldn’t get a colon for the clock - it “replaces” the hour digit in position 1, but i’m okay with it, for now.
Next, wire up a breadboard with everything first to make sure all of your connections and programming match - yeah, I’m still a step by step guy. Then decide on the desired locations and setup your target locations by finding the time differences from GMT. Now on to the soldering and positioning.
Step 3: Wiring
Using a barrel power connector for the 12v input, split the power and ground to the 1) buck convertor and 2) the Vin on the Arduino.
Use the buck convertor to make 5v power and ground rows on the shield to run the connections, this will stabilize any power issues.
Each TM1637 has 4 connections (5v, Grd, Data and Clock), with the DIO and CLK going to individual GPIO pins (I used 2-11) and the power to my rows.
For the Meridian indicators (5 LEDs) solder (5) 220 Ohm res to ground and the Anode connections to A0-A3 and D12.
The RTC needs a 5v and Grd along with the SDA and SCL (A4 and A5).
The light stick needs to be grounded twice, once to the row and once to the Uno. Run the 5v to the row and data to a GPIO (D13). The touch sensor runs to 5v and Grd and to GPIO D0.
Step 4: Programming
The programming is fairly straight forward. I used the TM1637display.h library for the displays, assigning each display a unique name - predictably, with the city name. Just change the DIO and CLK pins for each.
Code your first location with the time difference and set the AM/PM perimeters for the LED to be on/off based on the hour. Use it to duplicate for each location.
I assigned the hour to position 0, 2 digits, no leading zero. For the minutes I used ‘minute’ and divided by 10 for digit 1 (pos 2, 1 digit) and modulo (%) for digit 2 (pos 3, 1 digit).
Lighting the NeoPixel with the sensor was just like any other button/LED combo using the Adafruit_NeoPixel library.
Step 5: Assembly
Craft a suitable case that fits the displays and some room behind for the board, power input and buck convertor. Insert, attach wires, power on and it's ready. Okay, there may be more to it than this, but those are the basics regardless of the design.
Enjoy and Happy Tinkering!