TimeCop – Arduino Real Time Clock with a DS3231 and 16×2 display

After I finished my last Real Time Clock project, I was relatively happy with the outcome, well, everything except for the accuracy; and what good is a clock without accuracy? I used the DS1302 which I’m sure is a pretty decent RTC(real time clock), if you pair it with a crystal that’s perfectly matched for it. But for some reason, my 32KHz crystal and DS1302 combo didn’t really do the business. It proved to stray significantly over time, perhaps a minute a month. I had been aware of another, much better RTC chip at the time, from the same manufacturer, the DS3231, but my board was one that I etched, and used all through hole components, with only one exception, and the DS3231 was an SMD package.

So, after being fed up with straying time, I decided that it was time to redo the board, and utilize the DS3231. The package is an SOIC-16, and is temperature compensated, and very precise. I can also access the temperature sensor in the chip, so if the output was satisfactory, I could use that for temperature, instead of the DS18b20. I decided I would try to cut down on the total size of the board, and make it the same size as a popular 16×2 display, so it could be mounted to the back of such a display. Because of this, I decided I would use mainly SMD parts, including the QFP version of the Atmega328p.


Using Kicad, I worked from the previous clocks design, substituting the RTC. Additionally, I added a button to toggle the backlight on and off. I also had acquired some micro USB ports from eBay. Because of their small size, I was slightly weary of using them, so I made a footprint and included it in the board layout, but also included a footprint for a mini USB port, one that I had used before, as a backup, in case something went wrong with the micro port.


When I got the boards back from the board house, I was pretty happy with them, they seemed to have turned out nicely. There were just a couple minor issues. I tried to hide the silkscreen part numbers under the parts, but because of size limitations, this proved to be unwise; the silkscreen was basically unreadable in certain locations. The mounting holes were also a bit too small. Having gone with a footprint someone else had created for the display to use as a guideline for board size, I had not checked the mounting hole size. Those could be drilled out, so not a real problem. The micro USB port had turned out perfectly, however, and I was satisfied that I could use this small, robust, and very popular connector in my projects.


The DS3231 proved to be a very accurate RTC, and it strays so little I haven’t been bothered to keep track of the rate; seemingly only a second every month or so, if that. It sits on my desk, and I reference it frequently. I’ve made a stand for it, and the display for my fan controller, and have 3D printed a shroud for the displays.