USB powered LCD table clock using a DS12887 RTC and AT89S52
In pursuit of my embedded endeavors, I ended up making many ‘gifts’ for my friends. One day I decided it was high time I made something for myself for a change.
So I had this DS12887 RTC chip and a DS1820 temperature sensor lying around. Heck, I even had the code for my first major project, the AT89S52 powered digital clock/thermometer which I could re-use for this.
So at once I went to work and after a few hours’ soldering session, I was able to come up with the hardware for my clock. One difference from my original clock is that, I have used a 1-line LCD in this clock. So what that means is that the date and the time won’t appear together. So I had to give an extra button which when pressed, would show the date. Hmm! This meant some more code changes. The temperature sensor would of course, remain as it was. And yes, I did not take pains to implement the alarm functionality here as I did with my first clock.
After a hacking session, even the code was ready. But it took some time to adapt the existing code for my clock. Also due to the fact the DS1820 now was connected to a different set of IO pins of the AT89S52. So the code for the clock did not work out-of-the-box. However, the modifications were minor and I was soon done with it.
To power it, I decided to use USB (yeah! USB again!). This would be a good idea since, I planned to keep the clock on my office desk and my office desk computer is never turned off
(And even if it is, the DS12887 RTC would continue to maintain the time).
So here are some pictures of it:
Alas! I do not have a YouTube video of it this time
But do post in your comments nonetheless. This clock now adorns my office desk!




Great to see u r still rocking the embedded world.
Will watch this space regularly now.
Thanks, Buddy ! Yeah, some things that I did in my free time over the last 1 year or so.
Do check out my other posts. I have some more stuff, will post them shortly.
Hey! I have this RTC chip as well but I don’t know how to interface. Could you please share your code and some information on how to connect it to a microcontroller?
I have a PIC microcontroller by the way. And please share the code, I am very interested in this RTC chip.
@solarwind:
Read the data sheet. It has all necessary info to interface the DS12887 chip. And code is very simple: I just used MOVX instructions for 8051. Reason is, the 8051 sees the DS12887 as an external RAM chip. I am not sure how it would work with the PIC though.
Alas! I do not have the source code as my HDD crashed a weeks ago.