[Project] Dot Matrix Clock Part 1

Led Dot Matrix Clock

Some time ago i bought a DS3231 module with EEPROM, a BluePill dev board and 5 led dot matrix modules with MAX7219 from aliexpress. Now i decided to build a bedside table clock with temperature reading and automatic brightness adjustment.

DS3231 Module with EEPROM from Aliexpress


BluePill board with STM32F103C8
Led Dot Matrix module with MAX7219







The first part is about the electronic components for the project and how to connect them.

1. Parts List:

  • Power will be supplied from a 5V phone charger. For the 3V3 part i will use a LDO(the one on the BluePill board).
  • The brain of the project is the BluePill (STM32F103C8, i know, overkill but i’m used to it). It is an ARM Cortex M3 RISC 32bit micro controller running at a maximum of 72MHz. The STM32F103C8 has 2xSPIs, 2xI2Cs, 3xUSARTs, 1xUSB and 1xCAN peripheral module. For more information about the uC please read the datasheet.
    A very useful image for the BluePill is the one bellow. There you can see the pin-out and all the alternative signals on each pin.

    BluePill pinout with alternative connections
  • The red led matrix is a “1088AS” with a Vf of 2.5V and a If of 20mA. The Vf value seems a bit high for a red colored led, for future calculations i will use a value of 2V.
  • For driving the led matrix a MAX7219 (datasheet) is used (came with the module). This chip is a serial input/output common-cathode display driver that is normally used to interface 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs. It uses a SPI interface to communicate with the micro controller, at a maximum frequency of 10MHz. Maximum recommended operating voltage is 5.5V and a maximum segment drive current of 45mA. To set the maximum segment current the chip uses an external resistor. The current per segment is approximately 100 time the current through the resistor. The module came with a initial resistor of 10k but i changed it to 39k to increase the dimming feature. On page 11 of the datasheet you can find in the top right corner Table 11, here a Vf=2V and Rset of 39k generates a current of ~15-17mA per segment.
  • Keeping time is done with the MAXIM DS3231N. (datasheet)  This chip is a extremely accurate real-time clock (RTC) with an integrated temperature compensated crystal oscillator. It features a battery input pin for time keeping if main power supply is lost. Communication is done over I2C at 400kHz. The RTC is able to maintain seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted. Additionally it features two alarms and a square wave output pin. Supply voltage is maxed out at 5.5V, but it will be used only on 3V3.
  • The clock module came with a AT24C32 chip on it. The AT24C32 is a 32kbit I2C EEPROM. Maximum voltage is 5.5V and I2C speed is 100kHz at 3.3V. I do not know now if it will be used in this project.
  • A photoresistor is used for getting the light value.
  • 2 simple push buttons are used for mode and +.

2. Electrical connections

Connecting the components together is easy and straight forward. I started with gluing the dot matrix modules together and soldering the fires to their position.

Led Module PCB glued together
Led Modules glued together
Led Modules soldered together
Led Module PCB glued together zoom







Next step is to glue the bluepill in place and solder the wires needed for SPI2(MOSI-PB15, SCK-PB13, CS-PB12)

Bluepill soldered and glued in place

For the following step i had to modify the DS3231 module. I had to remove the power led and the resistor for it, and the diode and the limiting resistor for it. The role of the diode was to charge a 3V lithium rechargeable battery from VCC. In my case i do not use this. The module is powered from the 3V3 rail of the blue pill and the battery is only used for back-up power for the RTC during main power loss. After removing those parts i went and glued the module to the backside of the matrix display and soldered the needed wires for communication, power and square wave output signal for wakeup. Following connections need to be done: I2C1(SCL-PB6, SDA-PB7), SQW-PB5

DS3231 soldered and glued to assembly
DS3231 removed components







Now it is time so glue and solder the photoresistor.

Connections to photoresistor
Heatshrink over connections
Glued Light sensor






The wires were soldered according to the connections.

Last step is to solder the two buttons. They will be later mounted on the backside of the case. They are soldered to PB0 and PB1. Images will be shown in the part where mechanics will be discussed.


The working clock.

Working Clock







In the next part i will go over the software used to drive the clock. I can say it is written in C and the ide is Atollic TrueStudio. If you have questions please leave them in the comment section bellow.

Add a Comment

Your email address will not be published. Required fields are marked *