- Thomas' Webjar full of joy -
| Author: | Thomas Langewouters |
|---|---|
| description: | An alarm clock I built with a microcontroller |
This is an alarm clock I built. It was very effective during the sort time I used it, because I programmed it to play a very annoying tune through a speaker. I actually started to wake up before the alarm went of, so other people in the house didn't wake up from the annoying pitches it played.
The JAL source code is available on my download page
| Timekeeping: | Rewritten in assembler. (losing one stack level, previously losing two stack levels, ISR and procedure time...) :Display: Done. Use's Vasile's 4-line lcd routines and tables to store the texts. |
|---|---|
| Bignumbers: | Done. Data stored in tables. |
| Backlight: | The backlight is dimmed using the internal CCP1 module of the PIC in PWM mode. :Input: Four pushbuttons on port D, handled by buttons.jal (function keypress(byte in key) return bit). |
| Alarm sound: | Uses CCP2 in PWM mode, inspired by Vasile! |
| Menu code: | Works. Can set time/alarm. |
| Computer link: | (interface code) Nothing yet. |
Here are some details of the PCB:
A wall wart (adaptor) delivers a voltage between 7.5 and 12V to JP4. Buffer capacitors C9 and C7 ensure the voltage is clean DC (just to be sure), and IC3 lowers the voltage to 5V. C8 is provided to short high frequencies. The microcontroller is used with a 20Mhz crystal (as usual connected to two 22pF cap's), and can be reset by pushing switch S1. To connect the micro to a pc (synchronize with pc's rtc), a MAX232 TTL to rs-232 level converter is necessary. It's connected to two rows of pins, which can be connected to a flatcable with a DB9-M connector and a box connector [1]. The PCB can then be connected to a pc using a nullmodem cable. The backlight of the LCD is dimmed by the PIC's internal PWM1 module and Q2. PWM2 and Q3 drives an 8 Ohm speaker connected to JP2.
| [1] | those are often found in old pc's, where they are used to provide a second serial port on the back of the pc. |
The timekeeping is done by an interrupt service routine that gets called when timer 0 overflows. The clock uses Roman's zero error method, which Roman explains on this webpage, I rewrote the code to better fit in with my own code.
I'll be finding some soon enough! ;-)
The clock geheel.jpg | The clock geheelboven.jpg | The clock geheelschuin.jpg | the main menu menu.jpg | the pcb at first pcb-v1.jpg | the pcb print.jpg |
setting time... settime.jpg | running... tijd.jpg |