Dot Matrix LED Display Digital Clock - Part 1 Hardware
In this project/tutorial, we are going to discuss how we can build a simple yet very helpful device in managing our lives, a digital clock. While there are digital clocks nowadays that you can set by just connecting to the internet, I decided to use a real-time clock (RTC) because: (1) Obviously, it operates even without internet connection. (2) It is inexpensive. (3) It consumes very little amount of power. (4) and so that we can see how it works. This is going to be a very long tutorial so we are going to split this into three parts. In this part, we will discuss the hardware, in the second part the software, and in the last part we will test the digital clock. So now, let’s check first the components that we need to create a digital clock.
1. ATmega328P-PU, 28-pin IC Socket, 2pcs. 0.1uF Ceramic Capacitors, 16MHz Crystal, 2pcs. 22pF Ceramic Capacitors, 10kΩ Resistor (Minimal/Standalone Arduino Uno)
2. DS3231 Precision Real-Time Clock (RTC) Module
3. 2pcs. 4-in-1 MAX7219 Dot Matrix LED Display Module (Female-to-Female Jumper Wires included)
4. 5pcs. 12mm Tactile Switches
5. 2N3904 BJT & 1kΩ Resistor
6. 2pcs. 470uF Electrolytic Capacitors
7. Male and Female Headers
8. microUSB Breakout Board (Optional)
So the main components for this digital clock are the minimal Arduino Uno (standalone Arduino Uno), DS3231 RTC module, and the MAX7219 dot matrix LED display modules. With these three components, we can already display the time and date. However, we won’t be able to set the clock’s time and date unless we reprogram the microcontroller (MCU) again. So I’ve added tactile switches so that we can set the time and date without reprogramming the MCU and other components to make the digital clock stable. Now, let’s check the hardware connections.
As you can see in the schematic diagram above, we have the minimal Arduino Uno which is composed of the ATmega328P-PU MCU and other passive components (C1, C2, C3, C4, R1, and X1). The DS3231 RTC module is connected to the MCU through the I2C lines (SDA and SCL).
The DS3231 is an I2C RTC device that maintains accurate timekeeping even when main power is interrupted by incorporating a backup battery. It maintains seconds, minutes, hours, day, date, month, and year information as long as the backup battery is in good condition. If the backup battery is removed when main power is not present, the time and date will be reset to its default values so you will need to set it again.
So this is the DS3231 RTC module that I used. It’s very common and you can easily purchase it online. The bigger IC in the image is the DS3231 and the smaller IC below it is the AT24C32 which is an EEPROM in case you need to store some values. Good thing about this module is that you don’t need to use external pull-up resistors anymore as it already has on-board 4.7kΩ pull-up resistors connected to the I2C lines. Also, the module includes a 2032 battery holder. As you can see in the image, we have a CR2032 battery there.
However, one thing that I wish they didn’t include in this board is the crappy battery charging circuit. The battery that comes with this module is not even rechargeable. But even if it comes with a rechargeable battery, I wouldn’t charge the battery with a charging circuit like this:
So in order not to damage the battery, I would rather disable the battery charging circuit by removing the 200Ω resistor. As you can see in the image below, I have desoldered the resistor to disconnect VCC from the battery. In this case, even when using a rechargeable 2032 battery, the battery won’t be charged anymore. You just need to monitor if the battery level is still in good condition. But, since the DS3231 device only consumes a very little amount of power, I’m sure the battery will last for a long time.
Now, for the MAX7219 dot matrix LED display module, its driver, MAX7219, has a 3-wire serial interface input which can be connected to the SPI port of the MCU. The MAX7219 device is a common-cathode display driver that interfaces common MCUs to 7-segment displays (up to 8 digits), bar-graph displays, or 64 individual LEDs. The 64 individual LEDs in this case is the 8x8 dot matrix LED display.
You can add more 8x8 dot matrix LED displays by using more MAX7219 devices and connecting them in a cascaded arrangement. The 4-in-1 display module that we are using has four 8x8 dot matrix LED displays which means that there are four MAX7219 on it cascaded and since we are using two 4-in-1 display modules, there are a total of 8 MAX7219 devices connected in cascaded arrangement. As you can see in the schematic diagram, we connected the output of the first 4-in-1 display module to the input of the second 4-in-1 display module.
As mentioned earlier, we can already display the date and time with just the minimal Arduino Uno, the DS3231 RTC module, and the MAX7219 dot matrix LED display modules. However, we won’t be able to set the RTC except if we program the MCU again (later we will see in the code how the RTC is set). So I added four tactile switches so that we can set the time and date without reprogramming the MCU. The 5th switch is for the MCU manual reset. Later in the software/code and demo/testing, we will see how each of these switches work.
I have also added two 470uF-16V electrolytic capacitors, C5 and C6. Since we have eight 8x8 dot matrix LED displays (512 LEDs), we can’t avoid inrush current each time we turn on the digital clock. These two capacitors will help us prevent damage to any of the digital clock’s main components or instability in the digital clock’s operation caused by the inrush current. To make the digital clock more stable, I’ve also added the 2N3904 transistor and R2. Later, we will see their function but based on the schematic diagram, I think you can already guess their purpose. The ICSP and the UART headers will be used for programming and debugging. So I think that all for the hardware. In the second part, we will check the software or the code and see how the digital clock’s operation was programmed.
- 175 Tutorials
- 6 Textbooks
- 12 Study Guides
- 31 Tools
- 81 EE FAQs
- 295 Equations Library
- 184 Reference Materials
- 91 Glossary of Terms
Friends of CircuitBread
10% Student Discount for Components
Free YouTube Product Training Guides
Product Samples Upon Request
Get the latest tools and tutorials, fresh from the toaster.