diff --git a/doc/alarm-clock.dox b/doc/alarm-clock.dox index 451484ed..ddcfd92d 100644 --- a/doc/alarm-clock.dox +++ b/doc/alarm-clock.dox @@ -22,7 +22,74 @@ /** \file alarm-clock.dox -\page alarm_clock Wind-Up Alarm Clock +\page alarm_clock Alarm Clock + +\section clock_features Features + +The alarm clock described on this page is a large example application that +uses many of the classes in the provided libraries: FreetronicsLCD, Form, +Field, SoftI2C, DS1307RTC, Melody and \ref power_save "PowerSave". +The clock has the following features: + +\li Displays both the time and date. +\li 12 hour and 24 hour time display modes. +\li Up to 4 configurable alarm times, plus a snooze alarm. +\li Three alarm sounds to choose from. +\li Configurable alarm timeout between 2 and 10 seconds. +\li Single button to activate the back light and/or stop the alarm. +\li Up, down, left, and right buttons to change clock settings. + +\section clock_main_circuit Main circuit + +The main clock circuit consists of an Arduino Uno compatible board, a 16x2 +LCD module, a realtime clock chip, and a piezo buzzer for the alarm: + +\image html alarm_circuit.png + +Some of the components can be purchased ready-made as the +Freetronics +16x2 LCD Shield and the SparkFun +Realtime Clock Module. I used the ready-made realtime clock module, +but made my own equivalent to the LCD shield from parts to aid in spacing +out the LCD and pushbuttons on the exterior of the box. The value of the 33R +resistor may need to be adjusted for different types of back light LED's. + +The whole circuit is built on a prototyping shield, with ribbon cables +connecting to the LCD. The Stop Alarm button and piezo buzzer are not +shown in this picture and some of the components are soldered to the bottom +of the shield: + +\image html clock_shield.jpg + +The clock module is based on the DS1307 chip and has an on-board coin battery +to keep the time and date ticking over even if the main circuit loses power. +The chip is I2C-based and has an auxillary SQW output that can be configured +to provide a 1 Hz squarewave signal. This signal is used by the software +running on the Arduino to detect when a new time or date is available for +display on the LCD. The DS1307RTC class takes care of the details of +talking to the chip via I2C. + +\section clock_arduino_board Arduino board + +To keep power consumption low, say for being powered by batteries, we don't +need a full Arduino Uno or similar board. The USB interface is unnecessary, +as is the on-board power supply if there is an external source of 5 volt power. +We also don't want the power and D13 status LED's to be draining power. +Therefore, a cut-down version of the Arduino is recommended. We used the +KitTen +kit from Freetronics, and didn't +solder up anything that wasn't strictly necessary. A +5v FTDI USB-to-Serial cable +is necessary for programming. Similar minimalistic built-it-yourself +Arduino designs should also work. + +\image html kitten_minimal.jpg + +*/ + +/* +NOTE: The following has been commented out for now. More work is needed +on the wind-up power supply. \section clock_power Power supply @@ -74,46 +141,4 @@ the battery voltage and display the current status to the user (after adding 0.7 to account for the voltage drop on D2). If you don't have 1N4001 diodes to hand, then 1N4004 will work just as well. - -\section clock_arduino_board Arduino board - -Because we want to keep power consumption low, we actually don't want a full -Arduino Uno or similar board. The USB interface is unnecessary, as is the -on-board power supply. We also don't want the power and D13 status LED's -to be draining power. Therefore, a cut-down version of the Arduino is -recommended. We used the KitTen -kit from Freetronics, and didn't -solder up anything that wasn't strictly necessary. A -5v FTDI USB-to-Serial cable -is necessary for programming. Similar minimalistic built-it-yourself -Arduino designs should also work. - -\section clock_main_circuit Main circuit - -The main clock circuit consists of an Arduino Uno compatible board, a 16x2 -LCD module, a realtime clock chip, and a piezo buzzer for the alarm: - -\image html alarm_circuit.png - -Some of the components can be purchased ready-made as the -Freetronics -16x2 LCD Shield and the SparkFun -Realtime Clock Module. I used the ready-made realtime clock module, -but made my own equivalent to the LCD shield from parts to aid in spacing -out the LCD and pushbuttons on the exterior of the box. The value of the 33R -resistor may need to be adjusted for different types of back light LED's. - -The clock module is based on the DS1307 chip and has an on-board coin battery -to keep the time and date ticking over even if the main circuit loses power. -The chip is I2C-based and has an auxillary SQW output that can be configured -to provide a 1 Hz squarewave signal. This signal is used by the software -running on the Arduino to detect when a new time or date is available for -display on the LCD. The DS1307RTC class takes care of the details of -talking to the chip via I2C. - -Note: the above circuit works just as well for a non-wind-up clock powered -from batteries or mains power. The only difference will be the "Sense -Battery Status" input on A1. Either remove the battery monitoring logic -from the source code or tie A1 to 5V via a 10K resistor. - */ diff --git a/doc/mainpage.dox b/doc/mainpage.dox index d3d759e1..f781490d 100644 --- a/doc/mainpage.dox +++ b/doc/mainpage.dox @@ -66,9 +66,8 @@ including support for configuring alarms and storing clock settings. The default implementation simulates the time and date based on the value of millis(). \li DS1307RTC class that talks to the DS1307 realtime clock chip via I2C. -\li \ref alarm_clock "Wind-Up Alarm Clock" example that uses the DS1307 -realtime clock and the FreetronicsLCD library to implement an alarm clock -where the internal battery is charged by hand-cranking a dynamo. +\li \ref alarm_clock "Alarm Clock" example that uses the DS1307 +realtime clock and the FreetronicsLCD library to implement an alarm clock. \section main_other Other diff --git a/libraries/RTC/examples/AlarmClock/alarm_circuit.fig b/libraries/RTC/examples/AlarmClock/alarm_circuit.fig index ac27acc0..9a36eff1 100644 --- a/libraries/RTC/examples/AlarmClock/alarm_circuit.fig +++ b/libraries/RTC/examples/AlarmClock/alarm_circuit.fig @@ -494,9 +494,6 @@ Single 3375 3690 4500 3690 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 3375 4050 4500 4050 -2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 8 1 1.00 60.00 120.00 - 5175 5400 5175 6075 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 4500 1665 3150 1665 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 @@ -555,10 +552,6 @@ Single 4 0 0 50 -1 0 12 0.0000 4 135 240 4545 3420 A3\001 4 0 0 50 -1 0 12 0.0000 4 165 1410 4545 3735 A5 (I2C CLOCK)\001 4 0 0 50 -1 0 12 0.0000 4 165 1275 4545 4095 A4 (I2C DATA)\001 -4 0 0 50 -1 0 12 0.0000 4 135 240 5040 5265 A1\001 -4 0 0 50 -1 0 12 0.0000 4 135 465 4995 6300 Sense\001 -4 0 0 50 -1 0 12 0.0000 4 180 600 4950 6525 Battery\001 -4 0 0 50 -1 0 12 0.0000 4 135 495 4995 6750 Status\001 4 0 0 50 -1 0 12 0.0000 4 135 345 6570 5310 D12\001 4 0 0 50 -1 0 12 0.0000 4 135 2370 10440 7290 Freetronics 16x2 LCD Shield\001 4 0 0 50 -1 0 12 0.0000 4 135 450 6975 5805 Piezo\001 diff --git a/libraries/RTC/examples/AlarmClock/alarm_circuit.pdf b/libraries/RTC/examples/AlarmClock/alarm_circuit.pdf index 6b6892cf..2f156893 100644 Binary files a/libraries/RTC/examples/AlarmClock/alarm_circuit.pdf and b/libraries/RTC/examples/AlarmClock/alarm_circuit.pdf differ diff --git a/libraries/RTC/examples/AlarmClock/alarm_circuit.png b/libraries/RTC/examples/AlarmClock/alarm_circuit.png index 83ddb9d0..2607c93d 100644 Binary files a/libraries/RTC/examples/AlarmClock/alarm_circuit.png and b/libraries/RTC/examples/AlarmClock/alarm_circuit.png differ diff --git a/libraries/RTC/examples/AlarmClock/clock_shield.jpg b/libraries/RTC/examples/AlarmClock/clock_shield.jpg new file mode 100644 index 00000000..0d4673d4 Binary files /dev/null and b/libraries/RTC/examples/AlarmClock/clock_shield.jpg differ diff --git a/libraries/RTC/examples/AlarmClock/kitten_minimal.jpg b/libraries/RTC/examples/AlarmClock/kitten_minimal.jpg new file mode 100644 index 00000000..1c3fff74 Binary files /dev/null and b/libraries/RTC/examples/AlarmClock/kitten_minimal.jpg differ