Matrix Display Clock

Do somebody need a simple Matrix Clock? :slight_smile:

this is my simple Matrix Display Arduino Clock. It is based od AtMega328 MCU and DS3231 real time clock.

You can find more information on my GitHub:

Nice final product. Have a karma for it.
Anyway, program logic should be better. You are printing the time twice in a second. I'll go to the ISR. You can use periodic signal from the RTC to count up the time an print it just at the change - once per a second.

Yes, you're right.
I'm printing time twice a second together with colon - it's blinking. I can change the programm to write time just once a minute. But I have to make another variables to check the change of time.

Do you thing is it a problem change display twice a second?

You are printing the time twice in a second. I'll go to the ISR. You can use periodic signal from the RTC to count up the time an print it just at the change - once per a second.

An ISR would make the code more complex, and for very little benefit.

You can find more information on my GitHub:

I looked at the code, and it appears that some of the comments are incorrect. For example, "add hour" appears in at least two places where it does not belong.

Also, I noticed that it is not possible to change the brightness without zeroing the seconds.

While I was at it, I modified your SerialComm function to make it easier to use. Now it accepts three characters (one letter followed by two digits). I have not tested it, though, so I cannot guarantee that it works properly, or even works at all.

void SerialComm() {
	// first character  - type of data (ASCII letter 'A' through 'G')
	// second character - tens digit (ASCII digit '0' through '9')
  // third character  - ones digit (ASCII digit '0' through '9')

	if (Serial.available() > 0) {
		byte receivedCommand;
		receivedCommand =;	//read first letter

		if (receivedCommand < 90) {
			//received data is less than 90 (letter Z)
			delay(20);	// wait for two digits
      // maybe we don't need to wait this long?

			byte receivedDataTens;
			receivedDataTens =;
			receivedDataTens -= 48;	// ASCII code for '0' is 48
			byte receivedDataOnes;
			receivedDataOnes =;
			receivedDataOnes -= 48;	// ASCII code for '0' is 48
      byte receivedData;
      receivedData = (receivedDataTens * 10) + receivedDataOnes;

			switch (receivedCommand) {
			case 65:
				//year 65 = A
				year = receivedData;
				lc.setLed(3, 7, 0, true);	//show setting dot
			case 66:
				//month 66 = B
				month = receivedData;
				lc.setLed(3, 7, 1, true);	//show setting dot
			case 67:
				//dayOfMonth 67 = C
				dayOfMonth = receivedData;
				lc.setLed(3, 7, 2, true);	//show setting dot
			case 68:
				//hour 68 = D
				hour = receivedData;
				lc.setLed(3, 7, 3, true);	//show setting dot
			case 69:
				//minute 69 = E
				minute = receivedData;
				lc.setLed(3, 7, 4, true);	//show setting dot
			case 70:
				//second 70 = F
				second = receivedData;
				lc.setLed(3, 7, 5, true);	//show setting dot
			case 71:
				//dayofWeek 71 = G
				dayOfWeek = receivedData;
				lc.setLed(3, 7, 6, true);	//show setting dot
        // if we're here, then we got a garbage command
			SetRtc(second, minute, hour, dayOfWeek, dayOfMonth, month, year);

		//spláchnout buffer do hajzlu


A very nice and neat project circuit, a lot neater than my first prototype attempt which is something similar, I’ve attached a picture.

I’ve used the same components, but added a BMP280 pressure sensor, a ESP8266 for Wi-Fi and an HTU21D for temperature and humidity, which the display cycles around (it sort of grew in scope from a clock to something else as these things do sometimes). The ESP8266 allows for fetching the time via NTP and setting the DS3231 to the exact time. The internet connectivity also allows for fetching other data, yet to be implemented, i.e. a weather forecast could be displayed periodically. These added components make things a bit more messy on the prototype as they require 3.3 volt and logic level shifting which is always fun.

For the case I re-purposed a clock I already had bought from Ebay that looks like it is in a wooden case (search Ebay for wooden LED clock for the sort of thing), took the plastic vinyl wood effect off, removed the 7 segment LEDs and made the opening bigger for the matrix LEDs, then recovered with a wood effect vinyl. See picture, the LEDs are red just the camera has got it wrong. Must be cheaper way of doing this, but I do like the more chunky industrial look of your clock.

I also want to add remote sensors for temperature/humidity in other parts of the house to be shown on the clock, so currently designing a PCB from scratch to use a SAMD21 to work with 3.3 volt sensors, although still need logic level shifting for the LED display, and nRF24 transceivers to send/receive data.

As you can see with mine I used a smaller font to get seconds in as well.

Not far off finished, will add a project here with some details soon.