The Reminder Clock
Have you missed your wife's birthday? What about the mother-in-law, or son/daughter? Build this project and there will be no more missed events.
This project details the construction and programming of a clock project that will alert you several days in advance of an important event.
The Reminder Clock
Introduction:
How do you remember birthdays and anniversaries? Do you keep a paper record? Do you annotate the new calendar every year? Have you ever thought there must be a better way? Well the answer is a resounding yes!! Build and program the Reminder Clock. The idea for this project came to me a few years back. This project has been in service in various forms since then and has served me well. I can now be the thoughtful dad/son/brother and buy gifts or phone birthday/anniversary wishes “on time”.
Design Criteria:
Current time must be presented in a large format; readable from across the room. This would rule out the common character LCD.
Reminders can be shown in a smaller format.
Project appearance must be pleasing; something you would be proud to have hanging on your kitchen or living room wall.
Component Selection:
Many controllers would be more than adequate for this task. I chose an NXP part mostly because I’m familiar with the ‘9S12 parts and have the necessary development tools. The part selected was the MC9S12C32 which has more than adequate memory and all the usual peripherals.
The LED driver chosen was a MAX7221 mainly because I have used a through-hole version of this part in the past and it proved to be a solid choice. Large LEDs are not as common now, but are still available. The LEDs chosen were LTS-3403G; they have a pleasant green color, just to get away from the classic red LED. Another reason for this choice was the left and right hand decimal point; they can be used to make a horizontal colon between the hours and minutes.
Since the LED driver has an SPI interface I wanted to keep the rest of the parts on the SPI bus as well. There are not that many LCDs that use an SPI interface, but the NHD-0216K3Z-FS(RGB)-FBW-V3 has proven to be a good choice. Incidentally it has a jumper selectable RGB backlight. Since the large LEDs are green the green display backlight was chosen.
The clock chip selected was the M41T83; it has a built in crystal which is nice. A super cap was used for power back-up. It has proven adequate because although where I live we do get power outages, typically they are short.
All the parts are 5V compatible which helps simplify circuitry.
Since many parts are only available in SM format much of this project uses SM. However at the time this project was done I still freely used through-hole parts. Were I to do this project again SM would be the dominant choice and the PCB could be somewhat smaller.
PCB Design:
Design Spark was used for schematic capture and for PCB layout. It’s hard to believe that these tools are available free. The size of the PCB was somewhat influenced by the price breakpoint of my Chinese board house. The resulting board could not be much smaller and still have room for the large items.
See Reminder Schematic.sch and Reminder PCB.pcb for the circuitry and circuit board. A PDF version of the schematic is also included in case you are not using Design Spark: see Reminder Schematic PDF.pdf. In Reminder Photo 1.jpg you can see the assembled clock with the display removed. Of course my PCB layout wasn’t perfect the first time. If you look carefully you can see a green jumper wire from U2 to U1 to add a missing track. There were other minor errors that are repaired on the bottom side of the board. These errors have been corrected in the PCB artwork file included here. The finished project is shown in Reminder Photo 2.jpg (which is the project photo on the banner) on its walnut plaque ready to be hung in the living room.
Firmware Overall Design:
The clock portion is typical in that the RTC interrupts the 9S12 once per second.
The reminder portion uses structures to store birthday/anniversary data (Events) and make it easy to search. Five days before an Event, a reminder is shown to indicate what the upcoming event is and when it is. In Photo 2 you can see an Event is being shown and it’s 5 days before the actual birthday.
With the 3 buttons setting the time is quick and easy. Using the buttons you can also scroll through the Event list to check when Uncle Jim’s birthday is, even when it’s months away.
Some Firmware Details:
The main loop spends the majority if it’s time checking to see if a button has been pressed. When any button is pressed the main menu is presented. Much of the menu is devoted to time setting tasks, but viewing the Event list is also an option. Setting of the time variables is pretty standard in that the Up Button increases the variable and the Down button decreases it; the Enter button confirms the final value. The buttons allow you to scroll Up and Down if you have chosen to examine the Event list. Except here, the Enter button allows you to escape from the Event list display.
The RTC interrupts the processor once every second. Various activities are carried out each second as well as checking to see if a new minute has also arrived. If it is a new minute, the RTC is read completely and an Event search is executed. When an Event is found it is shown. Otherwise the funny message is shown for 10 sec each new minute. Even with a small number of Events, there is often some overlap. My solution to this is to have Events time share the display. So, if 2 Events overlap, each is shown on the LCD second line for 30 sec each minute. If there are 3 Events that overlap, then each Event is shown for 20 sec each minute. Currently only 3 overlapping Events can be accommodated.
Although this project is similar to other micro projects in many ways, what makes it a little different is the use of a “structure” to hold a year’s worth of Events. Actually, in order to provide a ‘reminder’ of an Event 5 days in advance, a collection of 5 structures is used. Some discussion of the Event structures will show how they are set up and used. Below are portions of the first 2 of the 5 Event structures. The rationale for their construction is explained below.
The display is 16 characters wide so the first structure component holds the Event text string to be displayed, along with a null terminator. The second and third components contain the Month and Day of the Event. So the second entry in sList1[22] indicates that there is an Event in Feb (month 2), on day 6. Looking at sList2[22], the second entry, shows an Event adjacent the same text string, in the same month, but on a day earlier. In sList3[22], the same entry has the Event a day earlier and so on through to sList5[22]. So when the 5 structures are scanned, an Event that has a day and month that match the current day and month will be displayed. So with 5 structures constructed this way, an Event announcement will happen 5 days before the “real” Event. And, will be shown on the display for all 5 days prior to the real Event.
The first component of each structure is included as a message to whoever might be examining the Event list that the Enter button will get you out of the Event display. That message appears in all the structures just to keep the structure size the same for all 5. Note that this entry needs to have a month and day to go with it, so 0xFF is a
const struct event_rec { char name[17]; unsigned char month; unsigned char day;};
const struct event_rec sList1[22]=
{ { " ENTER to exit " , 0xFF, 0 },
{ "Marlene BD Feb 6" , 0x02, 0x06 },
. . .
. . .
{ "End spec events " , 0 , 0 } };
const struct event_rec sList2[22]=
{ { " ENTER to exit " , 0xFF, 0 },
{ "Marlene BD Feb 6" , 0x02, 0x05 },
. . .
. . .
{ "End spec events " , 0 , 0 } };
month that will never appear, and 0x00 is a day that will never appear.
Assembling these 5 structures is somewhat tedious, but only needs to be done once. Subsequently Events may be added (or removed) with little effort. My list of Events is only 22 components long, hence sList1[22]; yours will likely be different.
When the Reminder Clock has no Event to announce, I have it output a humorous (?) message for 10 sec each new minute on the lower line of the display. You could insert your own message here, or eliminate the message if you wished.
Construction Notes:
Although I did the soldering of the SM parts in a reflow oven, they can all be done by hand. U1 will be a bit of a challenge, but certainly possible if you have some SM soldering skill.
I probably fussed too much mounting the 16x2 display. It sits on 4 aluminum 4/40 standoffs that were originally 0.5” long. I shortened them by about 0.1”; they can’t be much shorter than that or a tab of the display will touch C12 the super cap. I used nylon insulating washers on the standoff mounting screws on the bottom side of the PCB, but these could be omitted. The solder mask may provide sufficient insulation. The concern here is that the standoffs are over tracks on the bottom of the display, so making sure the standoffs are insulated from the bottom of the clock PCB is prudent.
Shortening the standoffs meant there is less length for screw penetration. With the insulation on the bottom screws there was room for a ¼” screw to be used on top and bottom of the standoffs.
The connector from the display to the main clock board comes right down to the board surface with the shortened standoffs. This means there is no room for the normal plastic carrier used with SIP headers on the top side of the clock PCB. I used long wire wrap header strips inserted from the bottom of the clock board with the display fastened in place. After they were soldered, the pins could be flush cut and the remainder of the header strip removed. The result is a row of short square pins perfectly mated to the display connector.
There is room to install the BDM connector at J2 when the display is installed so programming or re-programming can be done without any dis-assembly.
If you decide to mount your Reminder clock on a plaque as I did, the machine screws on the bottom of the PCB will displace the PCB above the plaque surface. This requires some sort of spacer (or relief); or carefully tightening the mounting screws so as to not distort the PCB. I put a keyhole in the back of the plaque so it could be slipped over a screw in the wall without ever slipping off, but there are other ways to hang it.
Suppose you don’t like the plaque mounting idea? Twenty four pin wire wrap sockets could be used to mount the large LEDs. That way the large LEDs could be elevated to the same plane as the 16x2 display; now the clock could be mounted in an enclosure of your choice. This would allow the clock to be used on a desk or a wall.
The Code:
My code for this project is provided in Reminder Code Zipped.zip which is a Code Warrior project. Although I don’t see many folks using Hungarian notation in their code, I have used it. I suspect most will not care much. It has advantages however; try it you might find it helpful.
Links to the data sheets for the major components have been included below. See Reminder BOM.xls for the complete list of parts.
M41T93:
http://www.st.com/content/ccc/resource/technical/document/datasheet/group2/40/3f/91/e4/91/a1/47/7c/CD00129012/files/CD00129012.pdf/jcr:content/translations/en.CD00129012.pdf
Max7221:
http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
MC9S12C32:
http://www.nxp.com/assets/documents/data/en/data-sheets/MC9S12C128V1.pdf
NHD-0216K3Z-FS(RGB)-FBW-V3:
http://www.newhavendisplay.com/specs/NHD-0216K3Z-FSRGB-FBW-V3.pdf
LTS-3403LG:
http://optoelectronics.liteon.com/upload/download/DS-30-97-296/S_110_S3403lg.pdf
The Reminder Clock
Introduction:
How do you remember birthdays and anniversaries? Do you keep a paper record? Do you annotate the new calendar every year? Have you ever thought there must be a better way? Well the answer is a resounding yes!! Build and program the Reminder Clock. The idea for this project came to me a few years back. This project has been in service in various forms since then and has served me well. I can now be the thoughtful dad/son/brother and buy gifts or phone birthday/anniversary wishes “on time”.
Design Criteria:
Current time must be presented in a large format; readable from across the room. This would rule out the common character LCD.
Reminders can be shown in a smaller format.
Project appearance must be pleasing; something you would be proud to have hanging on your kitchen or living room wall.
Component Selection:
Many controllers would be more than adequate for this task. I chose an NXP part mostly because I’m familiar with the ‘9S12 parts and have the necessary development tools. The part selected was the MC9S12C32 which has more than adequate memory and all the usual peripherals.
The LED driver chosen was a MAX7221 mainly because I have used a through-hole version of this part in the past and it proved to be a solid choice. Large LEDs are not as common now, but are still available. The LEDs chosen were LTS-3403G; they have a pleasant green color, just to get away from the classic red LED. Another reason for this choice was the left and right hand decimal point; they can be used to make a horizontal colon between the hours and minutes.
Since the LED driver has an SPI interface I wanted to keep the rest of the parts on the SPI bus as well. There are not that many LCDs that use an SPI interface, but the NHD-0216K3Z-FS(RGB)-FBW-V3 has proven to be a good choice. Incidentally it has a jumper selectable RGB backlight. Since the large LEDs are green the green display backlight was chosen.
The clock chip selected was the M41T83; it has a built in crystal which is nice. A super cap was used for power back-up. It has proven adequate because although where I live we do get power outages, typically they are short.
All the parts are 5V compatible which helps simplify circuitry.
Since many parts are only available in SM format much of this project uses SM. However at the time this project was done I still freely used through-hole parts. Were I to do this project again SM would be the dominant choice and the PCB could be somewhat smaller.
PCB Design:
Design Spark was used for schematic capture and for PCB layout. It’s hard to believe that these tools are available free. The size of the PCB was somewhat influenced by the price breakpoint of my Chinese board house. The resulting board could not be much smaller and still have room for the large items.
See Reminder Schematic.sch and Reminder PCB.pcb for the circuitry and circuit board. A PDF version of the schematic is also included in case you are not using Design Spark: see Reminder Schematic PDF.pdf. In Reminder Photo 1.jpg you can see the assembled clock with the display removed. Of course my PCB layout wasn’t perfect the first time. If you look carefully you can see a green jumper wire from U2 to U1 to add a missing track. There were other minor errors that are repaired on the bottom side of the board. These errors have been corrected in the PCB artwork file included here. The finished project is shown in Reminder Photo 2.jpg (which is the project photo on the banner) on its walnut plaque ready to be hung in the living room.
Firmware Overall Design:
The clock portion is typical in that the RTC interrupts the 9S12 once per second.
The reminder portion uses structures to store birthday/anniversary data (Events) and make it easy to search. Five days before an Event, a reminder is shown to indicate what the upcoming event is and when it is. In Photo 2 you can see an Event is being shown and it’s 5 days before the actual birthday.
With the 3 buttons setting the time is quick and easy. Using the buttons you can also scroll through the Event list to check when Uncle Jim’s birthday is, even when it’s months away.
Some Firmware Details:
The main loop spends the majority if it’s time checking to see if a button has been pressed. When any button is pressed the main menu is presented. Much of the menu is devoted to time setting tasks, but viewing the Event list is also an option. Setting of the time variables is pretty standard in that the Up Button increases the variable and the Down button decreases it; the Enter button confirms the final value. The buttons allow you to scroll Up and Down if you have chosen to examine the Event list. Except here, the Enter button allows you to escape from the Event list display.
The RTC interrupts the processor once every second. Various activities are carried out each second as well as checking to see if a new minute has also arrived. If it is a new minute, the RTC is read completely and an Event search is executed. When an Event is found it is shown. Otherwise the funny message is shown for 10 sec each new minute. Even with a small number of Events, there is often some overlap. My solution to this is to have Events time share the display. So, if 2 Events overlap, each is shown on the LCD second line for 30 sec each minute. If there are 3 Events that overlap, then each Event is shown for 20 sec each minute. Currently only 3 overlapping Events can be accommodated.
Although this project is similar to other micro projects in many ways, what makes it a little different is the use of a “structure” to hold a year’s worth of Events. Actually, in order to provide a ‘reminder’ of an Event 5 days in advance, a collection of 5 structures is used. Some discussion of the Event structures will show how they are set up and used. Below are portions of the first 2 of the 5 Event structures. The rationale for their construction is explained below.
The display is 16 characters wide so the first structure component holds the Event text string to be displayed, along with a null terminator. The second and third components contain the Month and Day of the Event. So the second entry in sList1[22] indicates that there is an Event in Feb (month 2), on day 6. Looking at sList2[22], the second entry, shows an Event adjacent the same text string, in the same month, but on a day earlier. In sList3[22], the same entry has the Event a day earlier and so on through to sList5[22]. So when the 5 structures are scanned, an Event that has a day and month that match the current day and month will be displayed. So with 5 structures constructed this way, an Event announcement will happen 5 days before the “real” Event. And, will be shown on the display for all 5 days prior to the real Event.
The first component of each structure is included as a message to whoever might be examining the Event list that the Enter button will get you out of the Event display. That message appears in all the structures just to keep the structure size the same for all 5. Note that this entry needs to have a month and day to go with it, so 0xFF is a
const struct event_rec { char name[17]; unsigned char month; unsigned char day;};
const struct event_rec sList1[22]=
{ { " ENTER to exit " , 0xFF, 0 },
{ "Marlene BD Feb 6" , 0x02, 0x06 },
. . .
. . .
{ "End spec events " , 0 , 0 } };
const struct event_rec sList2[22]=
{ { " ENTER to exit " , 0xFF, 0 },
{ "Marlene BD Feb 6" , 0x02, 0x05 },
. . .
. . .
{ "End spec events " , 0 , 0 } };
month that will never appear, and 0x00 is a day that will never appear.
Assembling these 5 structures is somewhat tedious, but only needs to be done once. Subsequently Events may be added (or removed) with little effort. My list of Events is only 22 components long, hence sList1[22]; yours will likely be different.
When the Reminder Clock has no Event to announce, I have it output a humorous (?) message for 10 sec each new minute on the lower line of the display. You could insert your own message here, or eliminate the message if you wished.
Construction Notes:
Although I did the soldering of the SM parts in a reflow oven, they can all be done by hand. U1 will be a bit of a challenge, but certainly possible if you have some SM soldering skill.
I probably fussed too much mounting the 16x2 display. It sits on 4 aluminum 4/40 standoffs that were originally 0.5” long. I shortened them by about 0.1”; they can’t be much shorter than that or a tab of the display will touch C12 the super cap. I used nylon insulating washers on the standoff mounting screws on the bottom side of the PCB, but these could be omitted. The solder mask may provide sufficient insulation. The concern here is that the standoffs are over tracks on the bottom of the display, so making sure the standoffs are insulated from the bottom of the clock PCB is prudent.
Shortening the standoffs meant there is less length for screw penetration. With the insulation on the bottom screws there was room for a ¼” screw to be used on top and bottom of the standoffs.
The connector from the display to the main clock board comes right down to the board surface with the shortened standoffs. This means there is no room for the normal plastic carrier used with SIP headers on the top side of the clock PCB. I used long wire wrap header strips inserted from the bottom of the clock board with the display fastened in place. After they were soldered, the pins could be flush cut and the remainder of the header strip removed. The result is a row of short square pins perfectly mated to the display connector.
There is room to install the BDM connector at J2 when the display is installed so programming or re-programming can be done without any dis-assembly.
If you decide to mount your Reminder clock on a plaque as I did, the machine screws on the bottom of the PCB will displace the PCB above the plaque surface. This requires some sort of spacer (or relief); or carefully tightening the mounting screws so as to not distort the PCB. I put a keyhole in the back of the plaque so it could be slipped over a screw in the wall without ever slipping off, but there are other ways to hang it.
Suppose you don’t like the plaque mounting idea? Twenty four pin wire wrap sockets could be used to mount the large LEDs. That way the large LEDs could be elevated to the same plane as the 16x2 display; now the clock could be mounted in an enclosure of your choice. This would allow the clock to be used on a desk or a wall.
The Code:
My code for this project is provided in Reminder Code Zipped.zip which is a Code Warrior project. Although I don’t see many folks using Hungarian notation in their code, I have used it. I suspect most will not care much. It has advantages however; try it you might find it helpful.
Links to the data sheets for the major components have been included below. See Reminder BOM.xls for the complete list of parts.
M41T93:
http://www.st.com/content/ccc/resource/technical/document/datasheet/group2/40/3f/91/e4/91/a1/47/7c/CD00129012/files/CD00129012.pdf/jcr:content/translations/en.CD00129012.pdf
Max7221:
http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
MC9S12C32:
http://www.nxp.com/assets/documents/data/en/data-sheets/MC9S12C128V1.pdf
NHD-0216K3Z-FS(RGB)-FBW-V3:
http://www.newhavendisplay.com/specs/NHD-0216K3Z-FSRGB-FBW-V3.pdf
LTS-3403LG:
http://optoelectronics.liteon.com/upload/download/DS-30-97-296/S_110_S3403lg.pdf
Updates vom Autor