Like I said in the title, I am using a DS3231 real time clock module and 4 cascaded FC-16 modules(they are basically MAX7219 led matrices based modules). My goal is to display a timetable, a schedule for a classroom on the matrices. The purpose of the DS3231 module is to keep track of time(mainly hours) from 8:00AM to 20:00PM, to display the hour on the matrix and to change the subject when it hits even hours. Eg: when it's 8:00AM we have subject A, when it's 10:00AM we have subject B etc

And after that I have to use a ESP8266 wifi module to change the schedule from distance.

EDIT1: I managed to display the hour on the matrix, but now I really can't figure out how to display the text in 4 rows. I have 4 FC-16 modules and I want to put each of them on top of the other so I can have 4 rows of text. I managed to do this by inserting space between words but this is not optimal. I want this to be automated so the person changing the text in the program doesn't have to do the spacing thing by themselves.

#include "RTClib.h"
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

const uint16_t WAIT_TIME = 1000;

#define MAX_DEVICES 16

#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10


RTC_DS3231 rtc;

//char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);

 if (rtc.lostPower()) {
    Serial.println("RTC lost power, lets set the time!");
//     If the RTC have lost power it will set the RTC to the date & time this sketch was compiled in the following line
   rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));


void loop () {
    DateTime now = rtc.now();

    char buffer[] = "hh:mm";  // hours and minutes
    P.print(now.toString(buffer));  // display

   // Serial.println();
  • Re your edit: you commented-out the rtc.adjust() line. Are you sure your RTC is correctly initialized? If not, the returned DateTime can be invalid, which could result in garbage being printed out. You can also check the value returned by now.isValid(). May 7, 2020 at 13:05

1 Answer 1


how do I display the time from the DS3231 clock module on the FC-16 led matrix modules?

You can use the DateTime::toString() method to convert the current time to a string in the format of your choice, then P.print() to display that string on the LED matrix:

void loop() {
    DateTime now = rtc.now();
    char buffer[] = "hh:mm";  // hours and minutes
    P.print(now.toString(buffer));  // display

how do I use that hour of the day so that the microcontroller knows what text it should display next?

Condition your logic on now.hour().

  • Thank you very much, I will try and I'll come up with an update
    – Rehoboam
    May 7, 2020 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.