Introduction: Wise Clock 3 - Arduino-based Geeky Alarm Clock
In addition, Wise Clock 3 can show the time in "Pong" mode or "Pacman" mode. It can also display the date, including the day of the week and the temperature.
Another catchy function is to show a personalized message (e.g. "Happy birthday"). Wise Clock 3 can be also used as an alarm clock, as a scoreboard or as a countdown timer. To see the other features, please check out the "User manual", the last step of this instructable.
Updated Sep 5, 2011
Convert Wise Clock 3 to Night and day clock as described here.
The clock is shown in action here:
Some technical details:
- based on ATmega644P microcontroller;
- open source, published, software and hardware;
- user-programmable through a 6-pin FTDI cable (or breakout);
- uses extremely accurate (+/- 2 minutes per year), temperature-compensated, real time clock chip DS3231;
- multi-color (red, green, orange) display with 32x16 LEDs;
- compatible and programmable with the Arduino IDE.
Wise Clock 3 can be purchased as a complete kit, here .
Step 1: The Wise Clock 3 Kit - Parts List
The complete Wise Clock 3 kit includes (as shown in the photo 1):
- a set of electronic components (see list below) and the PCB;
- the 3216 bi-color LED display from Sure Electronics;
- a pair of laser-cut transparent or smoky plexiglass plates;
- a set of hardware parts (standoffs, nuts, screws, washers).
Photo 2 shows the electronic components of the kit. They are:
- ATmega644P controller with Arduino bootloader (also programmed with the latest version of the software);
- DS3231 real-time-clock (pre-soldered to the board);
- SD card socket (pre-soldered to the board);
- 40-pin socket for the controller;
- 16MHz crystal and 2 capacitors 22pF;
- CR1220 backup battery for RTC;
- holder for the coin battery;
- miniB USB connector;
- 3V3 voltage regulator;
- piezoelectric buzzer;
- 9 resistors 10K;
- 3 resistors 4K7;
- resistor 100 ohms (optional);
- blue LED (optional) - power indicator;
- 4 right-angle micro push buttons;
- 6-pin right-angle male header (FTDI connector);
- 2 x 16-pin female headers (display connectors);
- 3 decoupling capacitors 100nF.
Step 2: Hardware - Schematic and Board
Images of the schematic and the board are shown below.
The Eagle files can be downloaded from here: schematic , board .
The Wise Clock 3 board was designed to plug directly into the 3216 bi-color 3mm LED display from Sure Electronics . Therefore, there is no need for cables/wires when connecting the board to the display.
Note: The Wise Clock 3 board can connect and drive more than one display, as shown and explained here .
The PCB has a small prototyping area that can be used to add components for future expansions, like photo resistor for automatic light dimming of the display, infrared receiver to control the clock remotely, tilt switch etc. Of course, all these new sensors will have to be supported in the software as well.
The clock function is performed by the on-board RTC (real-time-clock) chip DS3231. This is far superior to (and more expensive than) DS1307, since it has a deviation of only +/-2 minutes per year, at most. The accurate time is kept even when the clock is not powered, due to the on-board backup battery.
Step 3: Soldering Wise Clock 3 Components
The Wise Clock 3 PCB comes with the SD card socket and the RTC chip already soldered, and looks like in photo 1.
To assemble the board, follow this process:
1. Place and solder the miniB USB connector; actually, since this connector is only used for power, only the two extreme pins (1 and 4) must be soldered; the middle two can be left untouched. Make sure the connector is solidly anchored to the board through the 4 lateral holding pads; there will be lots of mechanical tension when the power cable is plugged/unplugged.
2. Solder the 100 ohm resistor (brown black brown), indicated on the PCB as R14, then the LED, paying attention to its orientation. The shorter pin, the cathode, goes into the left (as you look at the PCB as in photo 2 below) hole. At this point, by plugging in the power cable, the LED should light up (photo 3).
3. Solder resistors R5, R6, and R7, all 4K7 (yellow purple black brown brown), as shown in photo 4.
4. Solder the rest of the resistors, all 10K, as shown in photo 5 below.
Note that there are 9 resistors of 10K value (brown black orange): R1, R2, R3, R4, R9, R10, R11, R12, R13.
5. Solder the 40-pin socket, then the battery holder and the 4 buttons, as shown in photo 6.
6. Solder the 3 decoupling capacitors (100nF, labeled "104"): C3, C5, C8. Then continue with soldering the two smaller ones C1, C2 (both 22pF), as shown in photo 7.
7. Insert the crystal (the small, metallic, oval cylinder, with 2 pins, labelled "16.000" on its top) in its position on the left side of the microcontroller socket, indicated by an oval (see the above image). Orientation is not important for the crystal.
Then insert the 3V3 voltage regulator (black, 3-pinned, semi-cylindric part labeled "L78L33ACZ") as indicated on the silkscreen by the half-cylinder on the right side of the microcontroller socket (its orientation is very important), then solder in place.
Next solder the 6-pin male header, and then the piezoelectric buzzer (its orientation is not important).
Look at the last picture (photo 9) of the final assembled board before soldering, to make sure you have these parts placed correctly.
8. (Photo 8) Insert the two 16-pin female headers on the back of the board (opposite to the parts side) and solder them on the top (parts) side.
To get the best alignment possible on these headers, insert the 16-pin headers into their sockets (in the display), then solder the board on top. (This is similar to the way the male headers are soldered on an Arduino-shield.)
9. It is time to add now the preprogrammed ATmega644P microcontroller. Before inserting it in the socket, slightly bend both sets of its pins on a table, so that they become parallel. Position the chip carefully on top of the socket, paying attention to its orientation: pin 1, marked with an arrow (triangle), must be close to the upper side of the board. Push the chip firmly into the socket.
Next insert the coin battery in the battery holder.
The assembled board should look like in the last picture (photo 9) below.
Step 4: Mechanical Assembly - Attach Display and Enclosure
The Wise Clock 3 PCB was designed to be plugged directly into the 3216 3mm LED display from Sure Electronics. But it can be also used with the 5mm version of the display, by using the provided 16-wire ribbon cable.
To plug the board into the display, gently push the board into the connectors, after you properly aligned them (photo 3).
Next step is to attach the simple enclosure, which is made of a pair of plexiglass plates, either 3mm smoky or 4mm clear, with the dimensions shown in photo 4. The DXF file, used for laser-cutting, is available for download here .
The 2 plates are directly attached to the display, with the standoffs in the four corners. (The board fits snugly between the display and the back plate and does not need any other attachment or screw.) The longer standoffs go in the back of the display, and are screwed into the shorter standoffs placed in the front of the display. Note that the 4 washers provided are to be placed on the back of the display, between the standoffs and the display's board, essentially extending the longer standoffs.
The final assembly looks like in the last picture (photo 5).
Step 5: (Optional) Wise Clock 3 Software - Setup, Compiling, Uploading
The ATmega644P microcontroller coming with the Wise Clock 3 kit is already programmed with the latest release of the Wise Clock 3 software, which is available for download here .
But, sooner or later, you will want to upgrade the software.
This process requires the following prerequisites:
- installation of the Sanguino-related files (since Wise Clock 3 is compatible with Sanguino, a variant of Arduino);
- connection to the board, through the FTDI cable/breakout.
To install the Sanguino files, follow the instructions found here . Basically, you need to do two things:
- add the definition of the Sanguino board to the file arduino22/hardware/arduino/boards.txt;
- create the folder "sanguino" and copy the Sanguino files, as shown in the photo 1.
After these two steps are completed, you should see "Sanguino" listed in the menu "Tools/Board" of Arduino IDE (as shown in photo 2).
To upload the sketch, you will need to connect the board to the PC/Mac with an FTDI cable/breakout. The USB end of this cable gets plugged into the PC/Mac, the FTDI end gets connected to the Wise Clock 3 board as shown in photo 3 below.
With both the software and hardware in place, the upgrade will consist in the following steps:
- download the latest software on the PC;
- launch Arduino IDE and load the sketch;
- compile, using Sanguino as the target board;
- upload to the Wise Clock 3 board.
Unziping the source code (found here ) should result in a directory structure as shown in photo 4 below.
If you get compilation errors related to "tone.cpp" file, like the following,
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp: In function 'void soundAlarm()':
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp:60: error: 'tone' was not declared in this scope
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp: In function 'void beep()':
...\ArduinoIDE\libraries\WiseClock3\Sound.cpp:75: error: 'tone' was not declared in this scope
make sure the file Tone.cpp is present in the "sanguino" folder, as shown in the last screenshot (photo 5).
Step 6: Prepare the SD Card
Wise Clock 3 displays quotations retrieved from a text file stored on the SD card (photo 1). The name of this file is "quotes.txt" and is part of the zip file containing the software (download from here ). It can also be created from scratch, as a ASCII text file, to include one's favorite quotations, in the desired sequence.
The only restriction (in the software) is the length of the line, which should not exceed 180 characters.
Lines are separated with CR/LF (carriage return/line feed, or ASCII codes 13/10).
The SD card must be formatted as FAT (also known as FAT16). This can be done in Windows, by selecting "Format" in File Explorer, which displays the dialog box shown in photo 2.
Note: The maximum capacity that FAT16 can handle is 2GB.
Another important file on the SD card is "time.txt", which can be used for setting up the clock.
"Time.txt" file contains a line like this:
which should to be modified to reflect the current time and date.
When the clock is powered (with the SD card inserted), the time and date read from this line will be set in the real time clock as the current time and date, respectively. After the clock is (automatically) set on power-on, the file "time.txt" is marked as deleted, so that next time the clock is powered the file is not found.
Step 7: Power It Up and Get Wiser :)
Insert the SD card you prepared in the previous step. Then plug in the miniB USB cable, used in this case only for powering the clock (no data is transmitted through the USB between the computer and the clock).
Now power the clock from an USB port, either a computer or an USB power adapter, like the one pictured below (which is an iPod power adapter, available on ebay for about $5). If you buy such a power adapter on ebay, make sure it outputs a maximum 5.3V (measure with a voltmeter). I personally found defective ones, providing way more than the expected 5V. You don't want to fry your brand new Wise Clock 3 with a faulty power source.
Once powered, Wise Clock 3 should start scrolling quotation from the SD card on the top half of the screen, and displaying the time on the bottom half.
If the SD card is defective of cannot be read for any reason, the error message "Failed to read quotes.txt file from the SD card" is shown. In this case, try another SD card, or make sure the one you are already using is formatted as FAT16 and has the right files on it. DO NOT overwrite the files by copying them once again to the SD card. This process adds some complexity to the file allocation table that the SD library I am currently using (SDuFAT) is not able to deal with. If you need to copy the files onto the SD card again, re-format the SD card, THEN copy the files.
Note: Even when the SD card is not present (or defective), the "Pacman" and "Pong" modes should work just fine. The SD card is mainly used in "Quotes" mode.
After powering the clock, the time may be shown as "0:00". In this case, the next step is to set up the time. This is easily done from the buttons (as described in the "User manual" step of this instructable). Same applies to the date and day-of-week.
The quotations from the SD card are displayed as they are sequentially read from the quotes.txt file on the SD card. With the current Wise Clock 3 software, every time you reset (or disconnect and re-connect the power), the quotations will start from the beginning of that file.
Step 8: Wise Clock 3 - User Manual
Wise Clock 3 has 3 buttons, named (in the silkscreen on the board) "Menu", "Set" and "Plus". The "Menu" button is the rightmost one as you face the clock, "Set" is the middle button.
By pressing the "Menu" button, the menu options are shown at the top of the screen, in sequence. A menu option is selected by pressing the "Set" button. Some of the menu options (e.g. "Time", "Date") allow the user to set values, for example the time, the date etc. To increment these values, the user presses button "Plus".
1. Set up the time
- press "Menu" repeatedly until the option "TIME" is shown;
- press "Set": now, one of either hours or minutes will start blinking;
- press "Plus" to increment the blinking value; for hours, next value after 23 is 0; for minutes, next value after 59 is 0;
- to change between setting (blinking) hours and minutes, press "Set";
- after the desired time is set (values for hours and minutes are on display), wait about 4 seconds for the blinking to end; this is the time now stored by the clock.
Note: The value for seconds is always set to 0 every time the value for hours or minutes is incremented.
2. Set up the date
- press "Menu" repeatedly until the option "DATE" is shown;
- press "Set": the top part of the display will show "Y M D", and the bottom part will show the date, in the format "YYMMDD" (year/month/day);
- press "Plus" to increment the blinking value; for years, next value after 50 is 0; for months, next value after 12 is 1; for days, next value after 31 is 1;
- to change between setting (blinking) year, month and day, press "Set";
- after the desired date is set (values for year, month and day are on display), wait about 4 seconds for the blinking to end; this is the date now stored by the clock.
3. Set up the day-of-week
- press "Menu" repeatedly until the option "DAY" is shown;
- press "Set": now the bottom half of the display will show the first three letters of the day of the week (e.g. Mon, Tue etc);
- press "Plus" to increment the day;
- after the desired day is reached (shown on display), wait about 4 seconds and the "DAY" option will be exit automatically; this is the day now stored by the clock.
4. Set display brightness
Every time the "Set" button is pressed in one of the main display modes ("Quotes", "Pong", "Pacman", "Big"), the brightness of the LEDs increases one level (out of 5 levels); next after the highest brightness level is the lowest level.
5. Set quote scrolling speed
To increase the speed of the scrolling, press the "Plus" button when in the mode "Quote". There are 5 speeds. Next after the highest speed comes the slowest.
6. Display modes
Changing the display modes is done by pressing the "Menu" button, then selecting the mode shown by pressing the button "Set".
The main mode is "Quote", which displays scrolling quotations, read from SD card, on the half top of the screen.
Other modes are:
- "Pacman" - Pacman passes by every minute;
- "Pong" - as in the old-days tennis game console; hours and minutes are displayed on both sides of the net, at the top of the screen, and change when a player "loses", every minute, of course;
- "Big" - hours, minutes and seconds are displayed on the whole screen, in may different fonts;
- UTC (universal time), useful for radio amateurs;
- "Score" - allows keeping the game's score between two players, between 0 and 99.
7. Clock settings (options)
Beside the current time, Wise Clock 3 can also display:
- current date, formatted as "Month Day, Year"; this setting is enabled/disabled through the "DT+"/"DT-" menu options.
- temperature, in both Celsius and Fahrenheit; this setting is enabled/disabled through the "TEMP+"/"TEMP-" menu options.
- a personalized, user-editable message, read from SD card (e.g. "Happy Birthday dear John"); this setting is enabled/disabled through the "MESG+"/"MESG-" menu options.
- reminders for special events (anniversaries, Christmas etc), also user-editable on SD card; this setting is enabled/disabled through the "REMI+"/"REMI-" menu options.
- hours as maximum 12 or 24; this setting is enabled/disabled through the "24H+"/"24H-" menu options;
- enable/disable chime (short beep at the bottom of the hour, double beep at the top of the hour), by selecting "CHME+"/"CHME-" respectively.
Note: Menu will no longer show entries which do not make sense, like "DATE+" when the Date is already on.
8. Set up the alarm time
Alarm time can set through the menu option "ALARM". Press "Menu" button until you reach this option, then press "Set". From here on, the process is the same as setting up the time (point 2 above).
When alarm time is set and the alarm is active/enabled, the hours and minutes are separated by a colon, e.g. 15:43. If the alarm is disabled, a dot is used to separate the two, e.g. 15.43.
Another alarm-related feature: 3 hours before the alarm goes off, the time is displayed in orange, 2 hours before the alarm goes off in red; otherwise, time is displayed in green.
9. Enable/disable the alarm
The alarm is activated (will sound) only if the alarm is enabled. Enable/disable the alarm by selecting the "AL+"/"AL-" menu option.
When the alarm goes off, the clock plays "Frere Jacques", followed by a siren. The alarm can be stopped (silenced) by pressing any button.
10. Displaying reminders
At startup and at midnight the "message.txt" file is scanned for any reminder for that new day. An orange dot is displayed at the bottom during this scan. If a reminder is found then it will be displayed, like the quotes, for the next 24 hours.
The message file may also contain the start and end date of the Daylight Saving Time period (DST), this will adjust the clock by 1 hour.
The personal Message is still contained in this message file but must now start with [M1] which will allow for more then 1 Personal Message in a future release.
See message.txt for more details and add your own reminders.
We have a be nice policy.
Please be positive and constructive.