Clock
with LCD and
PIC 18F4620
v. 2.02
Summary characteristics
24h time clock with LCD 4 lines x 20 characters.
Line 1: day, month, and year, Line 2: day of the week (eg Mon for Monday), hours, minutes and seconds, Line 3: if any party or birthday and setup menus are displayed as a description of the various alarm mode. Line 4: the three alarm clocks with setting method or written "Snooze" with the display of the remaining time.
Excellent precision, temperature compensated oscillator guaranteed DS32KHZ.
Supported languages: Italian, English and German editable via button
3 independent alarms can be set: Once, Always, Week Mon-Fri, Week Mon-Sat with independent digital outputs for each clock alar, or only one digital output common to all alarm or buzzer.
10-minute snooze mode infinitely repeatable.
Update daylight savings time / winter time settings automatically
Storage and display up to 255 holidays and / or birthdays up to 3 events per day.
Backlight brightness freely adjustable in 10 steps.
B3V lithium battery backup for clock / calendar DS1306
9V battery backup for the system clock in the absence of the mains voltage, without backlight lcd and 1Hz led flashing at rate of 5 seconds.
Wiring diagram version 2.02 (21/07/2012)
This version
implements the anti black-out
and automatic
daylight saving summer
/ winter.
Some hints on the circuit
anti black-out.
The purpose is to feed the
clock correctly, inform the
micro is in progress
a blackout and have a
backup battery that allows
the clock to operate
alarms in the event of
a blackout.
We came
to this conclusion:
Diodes SB140 Vishay
products are
of the type Schottky,
fast recovery
and insertion loss
of about 0.45 V
~ 0.7 V
compared to 0.6
silicon diode like
the 1N4004.
The recommended battery is
produced by Ansmann and is
250 or 300mA
/ h, since the
battery is connected to the circuit
permanently, we set
the charge current to approximately
10mA.
For
which the value of Rx
is 82
Ohm 1/2W
(Voltage on
negative D4 -
Voltage
drop diode -
Battery voltage) /
Rx (9,7V-0,45V-8,4V)/82 = 0,85/82 = 10mA
Finally, the signal
from the positive
part of
DZ1 from 5.1
V serves to
inform the micro
that we have passed
from the mains
(inexhaustible) on backup battery power
due to a power
outage. To do this
is connected
the input of the
micro RE1
to a 5.1
V zener diode
(and its
resistance to
fall to
220 ohms)
to the negative
of the diode that protects
the power supply
network. The
zener becomes
necessary because
the digital input
does not support
an input voltage
higher than 5V.
During
the blackout all the buttons
are locked except
PL1 and PL5
for the management of alarms
and snooze.
At every second, while the
micro performs other functions,
is also
tested for the presence of
the supply voltage, if
this is not present,
we are in the process of
black-out and
operating in battery is necessary
to limit the consumption, for
which a flag
goes from zero
to one, it disables the
PWM that drives the
LCD backlight and LED
syncro 1Hz
instead of flashing every second,
flashes every 5
seconds to indicate that we are
in the process of blackouts.
Many even in the absence
of the LCD
backlight reflect the characters
so if you are
in daylight or bright room
you can read the time.
The flag above,
if <> 0
means that we are being backed up,
is incremented every second and
is worth 5 when
you turn on the LED
1Hz and
is reset to 1 for
a new cycle.
Prototype
supply anti black-out
as the
external clock is mounted
on the PCB for version
2.0
Particular adapter and 9V
battery ni/mh
Prototype PCB
Render of the prototype
(Do not look at
the initials of the components)
Analysis function daylight saving time
Daylight saving time starts on the last Sunday in March at 2.00am, so when they get the program jumps from 2.00 hours to 3.00 hours that you add one hour going from GMT +1 to GMT +2. (You sleep one hour less)
Daylight saving time ends on the last Sunday in October at 3.00am so when they get 3.00 hours to return at 2:00 am that is repeated time going from GMT +2 GMT +1. (You can sleep an extra hour)
This feature is quite delicate because it involves more issues such as:
If an alarm clock, the last Sunday of March is set as the time in the range between the hours of 2:00 and 2:59 during the time change will never sound.
All European countries have the same time zone? (England GMT = 0 Italy GMT +1)
But ... the last Sunday in October at 3:00 am, will go back by one hour to which the clock is reset to 2.00 after 60 minutes that recur again 3:00 the night ... will return again back an hour?
These and other problems have led to decisions which are as follows, and determine the operation of the automatic change of summer and summer to winter and vice versa.
Operation:
The clock automatically changes the set time regardless of the time zone for daylight saving time does not have direct relation to the time zone.
A function checks whether the current month is March or October, if so, check if the day is the last Sunday of the month with the criterion that the day must be> = 25, if the day is correct, it is verified that both on Sunday, if it is correct if it occurs in March, hours are 2:00, if so, the time is incremented by 1 and goes to 3.00. The same is true for the month of October, making sure they are the hours of 3.00, the first time that the clock shows the hours 3:00 AM to 2:00 sets a flag that indicates the same function that the time has already been changed, so the second once you recur 3:00 there will be no change.
Known issues:
DO NOT set alarms at the turn of the time change, if it were necessary to control the clock and reset it if necessary.
Those who have already made earlier versions for free download the firmware and make the above changes:
HEX file for PIC 18F4620 Italian version 2.02 of 21/07/2012 Clock18F v2.02.rar (15k)
Datasheet battery Ansmann 9V ni/mh Ansmann Batteria 9V.pdf (83k)
Datasheet diode SB140 SB140 Vishay.pdf (78k)
Datasheet buzzer Sonitron Buzzer SMA.pdf (1,7Mb)
Datasheet buttons for pcb Pulsanti.pdf (300k)
Datasheet DS32KHz Dallas DS32kHz.pdf (400k)
Datasheet DS1306 Dallas DS1306.pdf (320k)
Datasheet 25LC640A Microchip 25LC640A.pdf (511k)
Datasheet display LCD white on black LCD 204A Series.pdf (519k)
© Copyright tony@microt.it