Another Digital Clock Circuit, Schematic, and Build Log

pic16f690 mcp23s17 ds1305 block diagram of clockI couldn’t take it any longer. I haven’t played in a long time so I decided to start from scratch and design another digital clock. I’m working on the board right now. I had one more display, RTC, and 32.768KHz xtal  left.

I am building my own display driver this time though. The display driver will be an MCP23S17 multiplexer and a PIC16F690 microcontroller. The display driver that I used in the Picaxe clock was about $8. Not counting the amount of time I’ve spent writing the code my display driver should be about $2. Plus, I really don’t want to have to buy a driver and then spend the money on shipping when I have what it takes to make something work. We’ll see how it goes. In theory it seems like it will work.

I’ll explain more in a few weeks. I’m also tackling this project to create a C header file for the DS1305. It might help someone else out who is trying to work with it.

A digital clock of mine gets an upgrade

Check out the new power plug!!!

Check out the new power plug!!!

Have you seen this post from July 1, 2008? How to make a digital clock: Picaxe

Well, the clock hasn’t work for a few months. When I plug it in and then unplug it,  it shows a few random letters. Then it stops doing anything. Well, I figured that the display driver was broke since I noted it acted quirky in the first article  almost two years ago. I was wrong.

It seems that we should always start at the wall and begin troubleshooting from there. Always. This is probably rule number 1. Well, it all boiled down to this: the original wall-wart shorted out and burned up. This leads us to the title.

Check out the new power plug. The original wall wart was a 6 volt output. I am now using a 9 volt output since the 7805 IC would prefer a little more voltage. I also did a current consumption test, and this circuit uses less tham 30mA. Now it can be unplugged and transported much easier.

Check out the new power plug!!!

Check out the new power plug!!!

Using the PIC16F690′s (and others’) Internal Timers to Keep Time

This one is so easy a kid could do it. Actually, once you see how easy it is  to keep a somewhat accurate count with an internal oscillator, you’ll probably wonder why I ever spent $7 on a DS1305. If you just want a simple, somewhat inaccurate timepiece, neglecting to use an RTC can make things really simple. The $7 for a real RTC is worth it :).

The first experiment is to check if our interrupts work. We are using timer 2 to generate an interrupt every millisecond. Inside the interrupt we have a 16-bit variable counting to 1000, and then it increments the seconds variable. Then, when seconds hit ten, it starts the loop back at 0. I then output the seconds byte to port C on the Pickit 2. The LEDs show a binary count of the seconds. Tune in for the next installment. I’ll have a clock with four blue 7-segment LEDs that I’m stealing from my first clock project that kept time right, but nothing else.

#include <16f690.h>
#fuses intrc_io,nowdt,nomclr,noborownout,put
int seconds=0; int16 milliseconds=0;

#INT_TIMER2
void incrementSeconds()
{
milliseconds++;
if (milliseconds==1000)
{milliseconds==0; seconds++}
if (seconds==10) seconds=0;
}

void main(void)
{
enable_interrupts(INT_TIMER2);
enable_interrupts(GLOBAL);
setup_timer_2(timer_2_div_by_1,0×64,10); //1ms interrupt
set_timer2(0);
while (1)
{ output_c(seconds); } //binary count of seconds
}

Digital Clock Archive: Old clock photos

This is an archive of the original digital clock photos. The new clock has many improvements over the last one. It is much simpler to make as well, but does not include the alarms. The program that I had posted for the clocks also had errors that made it function in weird ways. As always, if you have problems, please post a comment to our site, and we will be happy to help.
Continue reading