Introduction: Arduino RTC DS3231 Clock

About: Enthusiastic about electronics, RC 3D printing and IT! A devoted maker and DIY fan! Business owner!

For one of my first Arduino projects, I wanted to create a DIY real-time clock. This project would allow me to build on my Arduino programming skills, allow me to work on my 3D modelling skills and circuit design/creation. This project has gotten me excited! I’ve wanted to great a digital clock that I can use in the dark for some time, it would make a great addition to my room.

Step 1: Project Planning

For this project, I’m going to set a small budget of £5, which should be enough for the components as I have most of them already on hands, and the casing can be 3D printed. I don’t have a set deadline for this project so I can take my time to ensure it’s perfect. I will need to program this project, to do this I will sue the Arduino IDE software.

Step 2: Specification

LCD display with BacklightControllable via buttonsReal-time, driven by RTC module4x AA Battery PoweredLow power option to save battery lifeEasy access to batteriesRounded corners on casingSmall and compact designArduino Nano Driven

Step 3: Design - Dimensions

1602 I2C LCD Dimensions:

  • LCD = X – 71mm Z – 25MM Y – 4MM
  • Board + LCD= = X – 80MM Z – 35MM Y – 20MM

  • RTC Module = X – 27MM Z – 27MM Y – 10MM

  • Button = X – 6MM Z – 6MM Y – 5mm

  • Button PUSH CIRCLE – 3MM Diameter

Step 4: Design - Circuit Schematic

I wanted to create an easy to follow circuit schematic for this project. To do this I used the free online EasyEDA circuit designer tool. This tool had a wide library of components that I could use in my schematics and is easy to use.

This diagram will allow me to easily create a prototyping breadboard and transfer my final circuit, once tested, to perf board for the final project.

Step 5: Design - Programming Arduino

Code can be found here:

Step 6: Design - Casing

I also needed to create a sketch of how I wanted the casing to look. I drew this basic design during my lunch break, It is simple but will make the block easy to use, small and compact and the LCD will be easy to read. This will make it perfect and it will suit the specification perfectly.

Step 7: Design - 3D Modeling

Now that I had a basic design on paper, I used CAD to design a 3D model that I could 3D print. I used TinkerCAD to do this because I’m familiar with the interface and tools available. I created a main housing for the components, with holes for the buttons and LCD screen, I also added a removable screw on back that will be used to change batteries and work on the internal components. I then modelled a little button that will allow the navigations on the from face of the model to be easily pressed. You can see my 3D model below:

As per my specification, I rounded the top corners of the model. I didn’t round the bottom corners because that may have made the model rock from side to side when I forcefully press buttons half asleep during the night, this should ensure that the clock stays still.

Step 8: Design - 3D Printing

After designing my 3D model, I began to 3D print my casing. This is just the first draft of what the final casing will look like. This print allowed me to better see what needed changing and where I could make improvements.

Step 9: The Build - Making the Circuit

To connect all the components together, I thought it would be a better idea to make a simple PCB out of perf board and DuPont pins. This is a lot better than my previous ‘bunch of wires’ solution, and it will help keep the components togeather while making it easier to attach inside of the casing. I’ve connected everything underneath with some wiring. I’ve used female pin headers to hold the Arduino nano. This makes it so that I won’t need to destroy the Arduino’s pins, so I can use it again if I need to.

Step 10: FInished!

Overall, this project was a great success, I learned a lot about Arduino programming from this project and I have made a half decent PCB. To improve the design, I could add an easier to implement, more reliable method for toggling the LCD’s LED light. I could also work on the battery life, the Lipo from Poundland seems to run out after a few hours, I guess that’s Poundland for you…

3D Model Improvements
The clock is coming along well, I have made a revision to the code. I had it previously set up where if the hour was ’00’ then to change the day. But because the clock would stay at ’00’ for a whole hour, the day kept changing every second until 1:00… XD. So, I changed the code to make the day change only when its ’00:00:00′, which works great! To better improve battery life, I have desoldered the Arduino Nano, the I2C LCD module and the charging circuit’s SMD Power LEDs.