Arduino Forum

Community => Exhibition / Gallery => Topic started by: petan on Jun 17, 2018, 06:21 pm

Title: Matrix Display Clock
Post by: petan on Jun 17, 2018, 06:21 pm
Do somebody need a simple Matrix Clock? :)

Hi,
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: https://github.com/mylms/Arduino-Matrix-Clock


(https://www.mylms.cz/obrazky/elektronika/arduino-matrix-clock-1.jpg)

(https://www.mylms.cz/obrazky/elektronika/arduino-matrix-clock-6.jpg)

Title: Re: Matrix Display Clock
Post by: Budvar10 on Jun 18, 2018, 08:07 am
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.
Title: Re: Matrix Display Clock
Post by: petan on Jun 20, 2018, 02:25 pm
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?
Title: Re: Matrix Display Clock
Post by: odometer on Jul 18, 2018, 09:24 am
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.
Title: Re: Matrix Display Clock
Post by: odometer on Jul 18, 2018, 09:46 am
You can find more information on my GitHub: https://github.com/mylms/Arduino-Matrix-Clock
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.
Title: Re: Matrix Display Clock
Post by: odometer on Jul 18, 2018, 10:08 am
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.

Code: [Select]

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 = Serial.read(); //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 = Serial.read();
receivedDataTens -= 48; // ASCII code for '0' is 48
     
byte receivedDataOnes;
receivedDataOnes = Serial.read();
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
break;
case 66:
//month 66 = B
month = receivedData;
lc.setLed(3, 7, 1, true); //show setting dot
break;
case 67:
//dayOfMonth 67 = C
dayOfMonth = receivedData;
lc.setLed(3, 7, 2, true); //show setting dot
break;
case 68:
//hour 68 = D
hour = receivedData;
lc.setLed(3, 7, 3, true); //show setting dot
break;
case 69:
//minute 69 = E
minute = receivedData;
lc.setLed(3, 7, 4, true); //show setting dot
break;
case 70:
//second 70 = F
second = receivedData;
lc.setLed(3, 7, 5, true); //show setting dot
break;
case 71:
//dayofWeek 71 = G
dayOfWeek = receivedData;
lc.setLed(3, 7, 6, true); //show setting dot
break;
      default:
        // if we're here, then we got a garbage command
        Serial.flush();
        return;
}
SetRtc(second, minute, hour, dayOfWeek, dayOfMonth, month, year);
}

//spláchnout buffer do hajzlu
Serial.flush();
}
}
Title: Re: Matrix Display Clock
Post by: LC200 on Aug 01, 2018, 09:27 am
Hi

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.