Oh no! ... not another clock project

Showcase your projects! We love to see what people come up with, so please share your creations here.
Post Reply
Posts: 15
Joined: Mon Nov 21, 2011 9:55 am

Oh no! ... not another clock project

Post by europa » Tue Nov 22, 2011 9:05 am

This article describes an Arduino IDE based Alarm Clock/Thermometer. This clock was inspired by Sparkfun's ClockIt. http://www.sparkfun.com/products/9205 My wife has been known to say to me, "if you like playing with all these Physical Computing toys, why don't you make me something that I can actually use? ... deja vu, anybody?" On reflection, yep, this seems like a fair request. So, initially I took the easy approach and went out and bought a Sparkfun ClockIt kit. The kit was cobbled together successfully and looked pretty good. Shortly after putting the kit together, my wife asks "why does the ClockIt loose time compared to all the other clocks in the house?" The obvious but unconvincing reply, "well they must all be wrong!" Nice try but on investigation, it soon became apparent that the ClockIt was indeed the culprit.

Since I promised my wife a toy that she could actually use, I thought, how hard can it be to design and build an accurate clock, essentially from scratch and throw in a thermometer just for good measure? I had been playing with the I2C DS3231 RTC chip http://pdfserv.maxim-ic.com/en/ds/DS3231.pdf recently and had used it to upgrade the DS1307 RTC in the excellent Adafruit datalogger shield, so it elected itself as the obvious RTC for my clock project. It was decided to use this chip so as not to burden the ATmega328P microcontroller with all the tedious timekeeping workload. Yes, this is a slightly more expensive approach but it ensures that the timekeeping is relatively accurate. The datasheet states =/-2ppm, in real life you should expect something like +/- 20 to 60 seconds a year ... not bad! The DS3231chip incorporates temperature correction for the crystal oscillation as well as two alarms. There is also provision for battery back-up which is in this case provided by a 3V CR1220 Lithium button cell. The PCB uses a 12mm coin cell THM Retainer http://australia.rs-online.com/web/p/pr ... 4E4F4E4526 to secure the Lithium button cell to the board. The chip has provision for either a programmable square wave output or interrupt output. This project uses the interrupt option. When the alarm is set the interrupt line goes low and is used to sink the Piezo current. This chip even has a thermometer built in as well. Hey, this chip sounds fantastic, in fact this chip sounds too good to be true! Well on checking the datasheet the temperature accuracy is stated as +/-3 degrees Celsius. +/-3 degrees! forget using the thermometer. Instead let's use the I2C DS1621 Thermometer/Thermostat chip. http://pdfserv.maxim-ic.com/en/ds/DS1621.pdf The datasheet states an accuracy and precision of 0.5 degrees Celsius but I would suggest that a more real accuracy might be around the 0.5 to 1.5 degrees Celsius mark. Another drawback with the DS3231 chip is that it comes only in a SMD flavour, Yuk! Oh well, c'est la vie! If you shop around you can pick these up for about $6 AUD and if you don't, they could set you back as much as $17 AUD. The big LED display used is a red, common cathode, 0.56 inch high, 4 digit, seven segment display, designated as NFD-5643Ax. http://www.futurlec.com/LED/7FR5643AS.shtml These are an incredibly cheap, $1.50 AUD. A 3V PCB Mount Piezo Buzzer http://www.futurlec.com/Buzzers_PCB_Mount.shtml was used, these little eardrum destroyers will set you back $1.20.The tactile switches http://australia.rs-online.com/web/p/pr ... 4E4F4E4526 used in this project have an extended shaft. These were used because they tend to give more control when timesetting, compared to the shorter shaft switches. Still, just like most digital clocks, patience has to be exercised when setting the hour and minute display. If you are short on patience, might I suggest that if you intend to modify this project this could be a likely candidate. The whole project was mounted on a cheap black bookend with 3mm x 25mm steel bolts and polymer spacers. I bought the bookends from the local "Hot Dollar" store for $3.50 AUD, a pair. A wallwart power transformer was used to provide the regulated 5 Volt DC supply to the project.

It must be stressed that if you intend to attempt to build this project, you will need "good soldering skills". Might I suggest having a good look at the PCB foil pattern first and let your past soldering experience be the judge, as to whether this could be a project for you. Due to the close proximity of tracks on the PCB after I etched the board, I carefully went over the board with a magnifying glass and multimeter to make sure there were no shorts ... better now than later, that's for sure! I must confess, I had to use a small triangular file to separate a few shorted tracks.

The PCB is single-side and thus uses heaps of wires links on the top of the board ... a bitch, yes but it's cheap and you can produce PCBs, literally in your kitchen sink. The Toner Transfer method, using a cheap A4 Laminator produced IMHO, a none too shabby PCB. An etchant of Hydrogen Peroxide (12% v/v) and Hydrochloric Acid (28% v/v), in a ratio of 1:2 was used to strip the copper board. This etchant is strong stuff, so make sure you use it in a well ventilated area, using gloves, safety glasses and adequate clothing.

I suppose a really quick run down on how to operate this clock would be pretty useful. Very simple ...to set the time and alarm time, hold down either the Time Set/Alarm Set button while using Hours and Minutes buttons to set up the appropriate time. On release of the Time Set/Alarm Set buttons the DS3231 seconds register is set to zero. During Time display mode you should notice the full colon on the second LED alternating ON and OFF. When setting up the Alarm Time mode the full colon on the second LED should be OFF and the DP on the fourth LED should be ON. To cancel the alarm, push the Alarm OFF button and you should notice the DP on the fourth LED go OFF. In the temperature display mode pushing the TEMP button should display the temperature in
degrees Centigrade, in 0.5 increments, in the range -55 to 99.5.

I mounted the 2.5mm Power Jack on the back of the PCB by soldering a 20mm length of link wire to each of the three jack legs and then threading this wire through the three drilled PCB holes and then soldering the three extended wires to the PCB. The excess wire was cut off.

A bit of black electrical tape cut in the shape of a small square was placed over the DP LED of the second LED because this particular 4 digit LED doesn't have the ability to switch the DP and the full colon separately. Maybe, a neater approach would be to use a dab of black paint to blackout the second LED DP ... anyway it's your call.

For the Lithium battery top side PCB connection, it is necessary to take a length of link wire and make a coil approximately 5mm in diameter. This is soldered to the top of the PCB and attached by a wire link which is threaded through a drilled hole and soldered to the middle of the Lithium battery square battery pad on the bottom of the PCB. It may be necessary to reduce the coil thickness by filing it thinner.

Good luck to those who attempt this project and please feel free to email me at matthodge@iinet.net.au if you have any queries. I would have liked to include several more attachments, including a few pictures of the completed board but unfortunately it looks like three only is the maximum here. If you want the other nine I had intended attaching, email me. Oh yeah, sorry for the bloody long links!
Alarm Clock j.zip
This is the Eagle schematic file.
(55.52 KiB) Downloaded 244 times
Alarm Clock k.zip
This is the Eagle file for the PCB.
(12.9 KiB) Downloaded 198 times
This is the Arduino IDE .pde file. It's no masterpiece by any stretch of the imagination, so feel free to improve on it.
(2.02 KiB) Downloaded 392 times

Posts: 15
Joined: Mon Nov 21, 2011 9:55 am

Re: Oh no! ... not another clock project

Post by europa » Tue Nov 22, 2011 11:46 am

Thought these photos might be of interest and an obvious way of getting around the three attachment limitation ... so why did it take me so long to think of it?
Alarm Clock i.zip
This is a photo of the PCB mounted on the cheap black bookend ... doesn't look too bad!
(22.44 KiB) Downloaded 258 times
Alarm Clock h.zip
This is a photo of the assembled clock PCB.
(44.3 KiB) Downloaded 284 times
Alarm Clock c.zip
This is a photo of the clock PCB after etching. It's not perfect but then again I've seen a lot worse!
(39.15 KiB) Downloaded 223 times

Post Reply