MAX7219 RTC DS1307 dht11 led matrix clock Arduino

MAX7219 LED Matrix Display & RTC DS1307 - dht11 - Arduino


VCC→5V
GND→GND
DIN→11
CS →10
CLK→13

Schema


Code

// Program to demonstrate the MD_Parola library
//
// Display the time in one zone and other information scrolling through in
// another zone.
// - Time is shown in a user defined fixed width font
// - Scrolling text uses the default font
// - Temperature display uses user defined characters
// - Optional use of DS1307 module for time and DHT11 sensor for temp and humidity
// - DS1307 library (MD_DS1307) found at https://github.com/MajicDesigns/DS1307
// - DHT11 library (DHT11_lib) found at https://github.com/mathworks/thingspeak-arduino
//
// NOTE: MD_MAX72xx library must be installed and configured for the LED
// matrix type being used. Refer documentation included in the MD_MAX72xx
// library or see this link:
// https://majicdesigns.github.io/MD_MAX72XX/page_hardware.html
//

#define USE_DS1307

// Header file includes
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <Wire.h>
#include <MD_DS1307.h>
#include <SimpleDHT.h>
#include "Font_Data.h"

// DHT config.
int pinDHT11 = 2;
SimpleDHT11 dht11(pinDHT11);

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10

// HARDWARE SPI
//MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// SOFTWARE SPI
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);




volatile boolean buttonA = false;
volatile boolean buttonB = false;
volatile boolean buttonC = false;
int StateOfbuttonA = 0;
int StateOfbuttonB = 0;  
int StateOfbuttonC = 0;        
int NewStateOfbuttonA = 0;        
int NewStateOfbuttonB = 0;        
int NewStateOfbuttonC = 0;  
int Mode = 0;
int contrast = 0;
int SPEED_TIME = 75;

#define PAUSE_TIME  0

#define MAX_MESG  20

// Global variables
char szTime[9];    // hh:mm
char szsecond[4];    // ss
char szMesg[MAX_MESG+1] = "";

uint8_t degC[] = { 6, 3, 3, 56, 68, 68, 68 }; // Deg C

char *mon2str(uint8_t mon, char *psz, uint8_t len)

// Get a label from PROGMEM into a char array
{
  static const __FlashStringHelper* str[] =
  {
    F("Jan"), F("Feb"), F("Mar"), F("Apr"),
    F("May"), F("Jun"), F("Jul"), F("Aug"),
    F("Sep"), F("Oct"), F("Nov"), F("Dec")
  };

  strncpy_P(psz, (const char PROGMEM *)str[mon-1], len);
  psz[len] = '\0';

  return(psz);
}

char *dow2str(uint8_t code, char *psz, uint8_t len)
{
  static const __FlashStringHelper*  str[] =
  {
    F("Sunday"), F("Monday"), F("Tuesday"),F("Wednesday"), 
    F("Thursday"), F("Friday"),
    F("Saturday")
  };

  strncpy_P(psz, (const char PROGMEM *)str[code-1], len);
  psz[len] = '\0';

  return(psz);
}

void getTime(char *psz, bool f = true)
// Code for reading clock time
{
   RTC.readTime();
  sprintf(psz, "%02d%c%02d", RTC.h, (f ? ':' : ' '), RTC.m);
}
void getTim(char *psz, bool f = true)
// Code for reading clock time
{
   RTC.readTime();
  sprintf(psz, "%02d%c%02d", RTC.h, ':', RTC.m);
}

void getDate(char *psz)
// Code for reading clock date
{
  char  szBuf[10];

  RTC.readTime();
  sprintf(psz, "%d %s %04d", RTC.dd, mon2str(RTC.mm, szBuf, sizeof(szBuf)-1), RTC.yyyy);

}
void getTem(char *psz, bool f = true)
// Code for reading clock date
{
  byte temperature = 0;
  byte humidity = 0;
  int err = SimpleDHTErrSuccess;
  if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    delay(100);
    return;
  }
  sprintf(psz, "%02d", (int)temperature);

}
void getHumi(char *psz, bool f = true)
// Code for reading clock date
{
  byte temperature = 0;
  byte humidity = 0;
  int err = SimpleDHTErrSuccess;
  if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    delay(100);
    return;
  }
  sprintf(psz, "%02d", (int)humidity);

}

void getsecond(char *psz)
// Code for reading clock date
{
  char  szBuf[10];

  RTC.readTime();
  sprintf(psz, "%02d", RTC.s);
}


void gethh(char *psz, bool f = true)
// Code for reading clock time
{
   RTC.readTime();
  sprintf(psz, "%c%02d%c%02d", (f ? ':' : ' '), RTC.h, (f ? ':' : ' '), RTC.m);
}


void getmin(char *psz, bool f = true)
// Code for reading clock time
{
   RTC.readTime();
  sprintf(psz, "%02d%c%02d%c", RTC.h, (f ? ':' : ' '), RTC.m, (f ? ':' : ' '));
}

void getsec(char *psz)
// Code for reading clock date
{
  char  szBuf[10];

  RTC.readTime();
  sprintf(psz, "%02d", RTC.s);
}

void getdyy(char *psz)
{
  char  szBuf[10];

  RTC.readTime();
  sprintf(psz, "%02d", RTC.dd);

}

void getmon(char *psz)
// Code for reading clock date
{
  char  szBuf[10];

  RTC.readTime();
  sprintf(psz, "%s", mon2str(RTC.mm, szBuf, sizeof(szBuf)-1));

}

void getyyyy(char *psz)
// Code for reading clock date
{
  char  szBuf[10];

  RTC.readTime();
  sprintf(psz, "%04d", RTC.yyyy);

}





void setup(void)
{
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  P.begin(3);
  P.setInvert(false);
  P.setZone(2, 0, 3);
  P.setZone(1, 1, 3);
  P.setZone(0, 4, 1);
  P.setFont(1, numeric7Se);
  P.setFont(0, numeric7Seg);
  P.displayZoneText(1, szTime, PA_LEFT, SPEED_TIME, PAUSE_TIME, PA_PRINT, PA_NO_EFFECT);
  P.displayZoneText(0, szsecond, PA_LEFT, SPEED_TIME, 0, PA_PRINT, PA_NO_EFFECT);
  P.displayZoneText(2, szMesg, PA_CENTER, SPEED_TIME, 0, PA_PRINT, PA_SCROLL_LEFT);
  P.addChar('$', degC);
  RTC.control(DS1307_CLOCK_HALT, DS1307_OFF);
  RTC.control(DS1307_12H, DS1307_OFF);
  getTime(szTime);
}

void loop(void)
{
  P.setIntensity(contrast);
  NewStateOfbuttonA = digitalRead(3);
  NewStateOfbuttonB = digitalRead(4);
  NewStateOfbuttonC =   digitalRead(5);
  buttonAisPressed();
  buttonBisPressed();
  buttonCisPressed();


      if (buttonA) {
   if (Mode == 0 ) {
    buttonA = false;
    contrast++;
    if (contrast >= 51 ) {
    contrast = 50;
  } 
    }   
  else if (Mode == 1 ) {
    buttonA = false;
      Mode = 0;
  } 
  else if (Mode == 2 ) {
    buttonA = false;
    RTC.h++;
    if (RTC.h >= 24 ) {
    RTC.h = 0;
  }
    RTC.writeTime();
  }
  else if (Mode == 3 ) {
    buttonA = false;
    RTC.m++;
    if (RTC.m >= 60 ) {
    RTC.m = 0;
  }
    RTC.writeTime();
  }
  else if (Mode == 4 ) {
    buttonA = false;
      RTC.s = 0;
    RTC.writeTime();
  }
  else if (Mode == 5 ) {
    buttonA = false;
    RTC.dow++;
    if (RTC.dow >= 8 ) {
    RTC.dow = 1;
  } 
    RTC.writeTime();
    P.displayReset(2);
  }
  else if (Mode == 6 ) {
    buttonA = false;
    RTC.dd++;
    if (RTC.dd >= 32 ) {
    RTC.dd = 1;
  }
    RTC.writeTime();
  }    
  else if (Mode == 7 ) {
    buttonA = false;
    RTC.mm++;
    if (RTC.mm >= 13 ) {
    RTC.mm = 1;
  }
    RTC.writeTime();
  }      
  else if (Mode == 8 ) {
    buttonA = false;
    RTC.yyyy++;
    if (RTC.yyyy >= 2035 ) {
    RTC.yyyy = 2015;
  }  
    RTC.writeTime();
       }
  }

   else if (buttonB) {
    buttonB = false;
      Mode++;
    P.displayReset(2);
      if (Mode >= 9 ) {
      Mode = 0;
  }
    }


    
   if (buttonC) {
   if (Mode == 0 ) {
    buttonC = false;
    contrast--;
    if (contrast <= 0 ) {
    contrast = 0;
  } 
    }   
  else if (Mode == 1 ) {
    buttonC = false;
      Mode = 0;
  } 
  else if (Mode == 2 ) {
    buttonC = false;
    RTC.h--;
    if (RTC.h <= 0 ) {
    RTC.h = 23;
  } 
    RTC.writeTime();
  }
  else if (Mode == 3 ) {
    buttonC = false;
    RTC.m--;
    if (RTC.m <= 0 ) {
    RTC.m = 59;
  } 
    RTC.writeTime();
  }
  else if (Mode == 4 ) {
    buttonC = false;
      RTC.s = 0;
    RTC.writeTime();
  }
  else if (Mode == 5 ) {
    buttonC = false;
    RTC.dow--;
    if (RTC.dow <= 0 ) {
    RTC.dow = 7;
  } 
    RTC.writeTime();
    P.displayReset(2);
  }
  else if (Mode == 6 ) {
    buttonC = false;
    RTC.dd--;
    if (RTC.dd <= 0 ) {
    RTC.dd = 31;
  } 
    RTC.writeTime();
  }    
  else if (Mode == 7 ) {
    buttonC = false;
    RTC.mm--;
    if (RTC.mm <= 0 ) {
    RTC.mm = 12;
  } 
    RTC.writeTime();
  }      
  else if (Mode == 8 ) {
    buttonC = false;
    RTC.yyyy--;
    if (RTC.yyyy <= 2010 ) {
    RTC.yyyy = 2025;
  } 
    RTC.writeTime();
  }  
       }

  if (Mode == 0) 
  { 
  static uint32_t lastTime = 0; // millis() memory
  static bool flasher = false;  // seconds passing flasher
  P.displayAnimate();
  P.setTextEffect(2, PA_PRINT, PA_NO_EFFECT);
  P.getZoneStatus(1);
  P.getZoneStatus(0);
    if (millis() - lastTime >= 1000)
  {
    lastTime = millis();
    getsecond(szsecond);
    getTime(szTime, flasher);
    flasher = !flasher;
    P.displayReset(1);
    P.displayReset(0);
  } 
  }

  if (Mode == 1) 
  {
  static uint8_t  display = 0;  // current display mode
  P.displayAnimate();
  P.getZoneStatus(2);
if (P.getZoneStatus(2))
  {
    switch (display)
    {
      case 0: // Time
        P.setTextEffect(2, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
        display++;
         getTim(szMesg);
        break;

      case 1: // Day
        P.setTextEffect(2, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
        display++;
        dow2str(RTC.dow, szMesg, MAX_MESG);
        break;

      case 2:  // Calendar
        P.setTextEffect(2, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
        display++;
        getDate(szMesg);
        break;
        
      case 3: // Humidity
        P.setTextEffect(2, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
        display++;
         getHumi(szMesg);
          strcat(szMesg, "% RH");
        break;
        
       default: // Temperature deg C
        P.setTextEffect(2, PA_SCROLL_LEFT, PA_SCROLL_LEFT);
        display = 0;
         getTem(szMesg);
          strcat(szMesg, "$");
        break;
    }

    P.displayReset(2);
  } 
  }


    if (Mode == 2) 
  { 
  static uint32_t lastTime = 0; // millis() memory
  static bool flasher = false;  // seconds passing flasher
  P.displayAnimate();
  P.setTextEffect(2, PA_PRINT, PA_NO_EFFECT);
  P.getZoneStatus(1);
  P.getZoneStatus(0);
    if (millis() - lastTime >= 200)
  {
    lastTime = millis();
    getsecond(szsecond);
    gethh(szTime, flasher);
    flasher = !flasher;
    P.displayReset(1);
    P.displayReset(0);
  } 
  }



    if (Mode == 3) 
  { 
  static uint32_t lastTime = 0; // millis() memory
  static bool flasher = false;  // seconds passing flasher
  P.displayAnimate();
  P.setTextEffect(2, PA_PRINT, PA_NO_EFFECT);
  P.getZoneStatus(1);
  P.getZoneStatus(0);
    if (millis() - lastTime >= 200)
  {
    lastTime = millis();
    getsecond(szsecond);
    getmin(szTime, flasher);
    flasher = !flasher;
    P.displayReset(1);
    P.displayReset(0);
  } 
  }


    if (Mode == 4) 
  { 
  static uint32_t lastTime = 0; // millis() memory
  static bool flasher = false;  // seconds passing flasher
  P.displayAnimate();
  P.setTextEffect(2, PA_PRINT, PA_NO_EFFECT);
  P.getZoneStatus(1);
  P.getZoneStatus(0);
    if (millis() - lastTime >= 200)
  {
    lastTime = millis();
    getTim(szTime);
    getsecond(szsecond);
    P.displayReset(1);
    P.displayReset(0);
  } 
  }

 


 

    if (Mode == 5) 
  { 
  static uint8_t  display = 0;  // current display mode
  P.displayAnimate();
  P.getZoneStatus(2);
        P.setTextEffect(2, PA_PRINT, PA_SCROLL_LEFT);
        dow2str(RTC.dow, szMesg, MAX_MESG);

    P.displayReset(2);
  }


 

    if (Mode == 6) 
  { 
  P.displayAnimate();
  P.getZoneStatus(2);
    P.setTextEffect(2, PA_PRINT, PA_NO_EFFECT);
        getdyy(szMesg);
    P.displayReset(2);
  }

    if (Mode == 7) 
  { 
  P.displayAnimate();
  P.getZoneStatus(2);
    P.setTextEffect(2, PA_PRINT, PA_NO_EFFECT);
        getmon(szMesg);
    P.displayReset(2);
  }


 

    if (Mode == 8) 
  { 
  P.displayAnimate();
  P.getZoneStatus(2);
    P.setTextEffect(2, PA_PRINT, PA_NO_EFFECT);
        getyyyy(szMesg);
    P.displayReset(2);
  }
 
 
}
  void buttonAisPressed()
  {
    if (NewStateOfbuttonA != StateOfbuttonA) 
  {
    if (NewStateOfbuttonA == 0) 
    {
      buttonA=true;
    }
    delay(50);
  }
   StateOfbuttonA = NewStateOfbuttonA;
  }

void buttonBisPressed()
{
  if (NewStateOfbuttonB != StateOfbuttonB) 
  {
    if (NewStateOfbuttonB == 0) {
      buttonB=true;
    }
    delay(50);
  }
   StateOfbuttonB = NewStateOfbuttonB;
}

void buttonCisPressed()
{
   if (NewStateOfbuttonC != StateOfbuttonC) 
  {
    if (NewStateOfbuttonC == 0) {
      buttonC=true;
    }
    delay(50);
  }
   StateOfbuttonC = NewStateOfbuttonC;
}

Font_Data.h

// Data file for user example user defined fonts
#ifndef FONTDATA_H
#define FONTDATA_H

MD_MAX72XX::fontType_t numeric7Seg[] PROGMEM = 
{
  0,    // 0
  0,    // 1
  0,    // 2
  0,    // 3
  0,    // 4
  0,    // 5
  0,    // 6
  0,    // 7
  0,    // 8
  0,    // 9
  0,    // 10
  0,    // 11
  0,    // 12
  0,    // 13
  0,    // 14
  0,    // 15
  0,    // 16
  0,    // 17
  0,    // 18
  0,    // 19
  0,    // 20
  0,    // 21
  0,    // 22
  0,    // 23
  0,    // 24
  0,    // 25
  0,    // 26
  0,    // 27
  0,    // 28
  0,    // 29
  0,    // 30
  0,    // 31
  1, 0,   // 32 - 'Space'
  0,    // 33 - '!'
  0,    // 34 - '"'
  0,    // 35 - '#'
  0,    // 36 - '$'
  0,    // 37 - '%'
  0,    // 38 - '&'
  0,    // 39 - '''
  0,    // 40 - '('
  0,    // 41 - ')'
  0,    // 42 - '*'
  0,    // 43 - '+'
  0,    // 44 - ','
  0,    // 45 - '-'
  1, 64,    // 46 - '.'
  0,    // 47 - '/'
  3, 62, 34, 62,  // 48 - '0'
  3, 36, 62, 32,      // 49 - '1'
  3, 58, 42, 46,    // 50 - '2'
  3, 42, 42, 62,    // 51 - '3'
  3, 14, 8, 62,    // 52 - '4'
  3, 46, 42, 58,    // 53 - '5'
  3, 62, 42, 58,  // 54 - '6'
  3, 6, 2, 62,    // 55 - '7'
  3, 62, 42, 62,  // 56 - '8'
  3, 46, 42, 62,  // 57 - '9'
  1, 20,    // 58 - ':'
  0,    // 59 - ';'
  0,    // 60 - '<'
  0,    // 61 - '='
  0,    // 62 - '>'
  0,    // 63 - '?'
  0,    // 64 - '@'
  5, 127, 9, 9, 9, 127,   // 65 - 'A'
  5, 127, 73, 73, 73, 54,   // 66 - 'B'
  5, 127, 65, 65, 65, 65,   // 67 - 'C'
  5, 127, 65, 65, 65, 62,   // 68 - 'D'
  5, 127, 73, 73, 73, 73,   // 69 - 'E'
  5, 127, 9, 9, 9, 9,     // 70 - 'F'
  0,    // 71 - 'G'
  0,    // 72 - 'H'
  0,    // 73 - 'I'
  0,    // 74 - 'J'
  0,    // 75 - 'K'
  0,    // 76 - 'L'
  0,    // 77 - 'M'
  0,    // 78 - 'N'
  0,    // 79 - 'O'
  0,    // 80 - 'P'
  0,    // 81 - 'Q'
  0,    // 82 - 'R'
  0,    // 83 - 'S'
  0,    // 84 - 'T'
  0,    // 85 - 'U'
  0,    // 86 - 'V'
  0,    // 87 - 'W'
  0,    // 88 - 'X'
  0,    // 89 - 'Y'
  0,    // 90 - 'Z'
  0,    // 91 - '['
  0,    // 92 - '\'
  0,    // 93 - ']'
  0,    // 94 - '^'
  0,    // 95 - '_'
  0,    // 96 - '`'
  5, 127, 9, 9, 9, 127,   // 97 - 'a'
  5, 127, 73, 73, 73, 54,   // 98 - 'b'
  5, 127, 65, 65, 65, 65,   // 99 - 'c'
  5, 127, 65, 65, 65, 62,   // 100 - 'd'
  5, 127, 73, 73, 73, 73,   // 101 - 'e'
  5, 127, 9, 9, 9, 9,     // 102 - 'f'
  0,    // 103 - 'g'
  0,    // 104 - 'h'
  0,    // 105 - 'i'
  0,    // 106 - 'j'
  0,    // 107 - 'k'
  0,    // 108 - 'l'
  0,    // 109 - 'm'
  0,    // 110 - 'n'
  0,    // 111 - 'o'
  0,    // 112 - 'p'
  0,    // 113 - 'q'
  0,    // 114 - 'r'
  0,    // 115 - 's'
  0,    // 116 - 't'
  0,    // 117 - 'u'
  0,    // 118 - 'v'
  0,    // 119 - 'w'
  0,    // 120 - 'x'
  0,    // 121 - 'y'
  0,    // 122 - 'z'
  0,    // 123 - '{'
  1, 127,   // 124 - '|'
  0,    // 125
  0,    // 126
  0,    // 127
  0,    // 128
  0,    // 129
  0,    // 130
  0,    // 131
  0,    // 132
  0,    // 133
  0,    // 134
  0,    // 135
  0,    // 136
  0,    // 137
  0,    // 138
  0,    // 139
  0,    // 140
  0,    // 141
  0,    // 142
  0,    // 143
  0,    // 144
  0,    // 145
  0,    // 146
  0,    // 147
  0,    // 148
  0,    // 149
  0,    // 150
  0,    // 151
  0,    // 152
  0,    // 153
  0,    // 154
  0,    // 155
  0,    // 156
  0,    // 157
  0,    // 158
  0,    // 159
  0,    // 160
  0,    // 161
  0,    // 162
  0,    // 163
  0,    // 164
  0,    // 165
  0,    // 166
  0,    // 167
  0,    // 168
  0,    // 169
  0,    // 170
  0,    // 171
  0,    // 172
  0,    // 173
  0,    // 174
  0,    // 175
  0,    // 176
  0,    // 177
  0,    // 178
  0,    // 179
  0,    // 180
  0,    // 181
  0,    // 182
  0,    // 183
  0,    // 184
  0,    // 185
  0,    // 186
  0,    // 187
  0,    // 188
  0,    // 189
  0,    // 190
  0,    // 191
  0,    // 192
  0,    // 193
  0,    // 194
  0,    // 195
  0,    // 196
  0,    // 197
  0,    // 198
  0,    // 199
  0,    // 200
  0,    // 201
  0,    // 202
  0,    // 203
  0,    // 204
  0,    // 205
  0,    // 206
  0,    // 207
  0,    // 208
  0,    // 209
  0,    // 210
  0,    // 211
  0,    // 212
  0,    // 213
  0,    // 214
  0,    // 215
  0,    // 216
  0,    // 217
  0,    // 218
  0,    // 219
  0,    // 220
  0,    // 221
  0,    // 222
  0,    // 223
  0,    // 224
  0,    // 225
  0,    // 226
  0,    // 227
  0,    // 228
  0,    // 229
  0,    // 230
  0,    // 231
  0,    // 232
  0,    // 233
  0,    // 234
  0,    // 235
  0,    // 236
  0,    // 237
  0,    // 238
  0,    // 239
  0,    // 240
  0,    // 241
  0,    // 242
  0,    // 243
  0,    // 244
  0,    // 245
  0,    // 246
  0,    // 247
  0,    // 248
  0,    // 249
  0,    // 250
  0,    // 251
  0,    // 252
  0,    // 253
  0,    // 254
  0,    // 255
};

MD_MAX72XX::fontType_t numeric7Se[] PROGMEM = 
{
  0,    // 0
  0,    // 1
  0,    // 2
  0,    // 3
  0,    // 4
  0,    // 5
  0,    // 6
  0,    // 7
  0,    // 8
  0,    // 9
  0,    // 10
  0,    // 11
  0,    // 12
  0,    // 13
  0,    // 14
  0,    // 15
  0,    // 16
  0,    // 17
  0,    // 18
  0,    // 19
  0,    // 20
  0,    // 21
  0,    // 22
  0,    // 23
  0,    // 24
  0,    // 25
  0,    // 26
  0,    // 27
  0,    // 28
  0,    // 29
  0,    // 30
  0,    // 31
  1, 0,   // 32 - 'Space'
  0,    // 33 - '!'
  0,    // 34 - '"'
  0,    // 35 - '#'
  0,    // 36 - '$'
  0,    // 37 - '%'
  0,    // 38 - '&'
  0,    // 39 - '''
  0,    // 40 - '('
  0,    // 41 - ')'
  0,    // 42 - '*'
  0,    // 43 - '+'
  0,    // 44 - ','
  0,    // 45 - '-'
  1, 64,    // 46 - '.'
  0,    // 47 - '/'
  4, 127, 65, 65, 127,  // 48 - '0'
  4, 0, 66, 127, 64,     // 49 - '1'
  4, 121, 73, 73, 79,   // 50 - '2'
  4, 99, 73, 73, 119,   // 51 - '3'
  4, 15, 8, 8, 127,    // 52 - '4'
  4, 79, 73, 73, 121,   // 53 - '5'
  4, 127, 73, 73, 121,  // 54 - '6'
  4, 3, 1, 125, 3,     // 55 - '7'
  4, 119, 73, 73, 119,  // 56 - '8'
  4, 79, 73, 73, 127,   // 57 - '9'
  1, 20,    // 58 - ':'
  0,    // 59 - ';'
  0,    // 60 - '<'
  0,    // 61 - '='
  0,    // 62 - '>'
  0,    // 63 - '?'
  0,    // 64 - '@'
  5, 127, 9, 9, 9, 127,   // 65 - 'A'
  5, 127, 73, 73, 73, 54,   // 66 - 'B'
  5, 127, 65, 65, 65, 65,   // 67 - 'C'
  5, 127, 65, 65, 65, 62,   // 68 - 'D'
  5, 127, 73, 73, 73, 73,   // 69 - 'E'
  5, 127, 9, 9, 9, 9,     // 70 - 'F'
  0,    // 71 - 'G'
  0,    // 72 - 'H'
  0,    // 73 - 'I'
  0,    // 74 - 'J'
  0,    // 75 - 'K'
  0,    // 76 - 'L'
  0,    // 77 - 'M'
  0,    // 78 - 'N'
  0,    // 79 - 'O'
  0,    // 80 - 'P'
  0,    // 81 - 'Q'
  0,    // 82 - 'R'
  0,    // 83 - 'S'
  0,    // 84 - 'T'
  0,    // 85 - 'U'
  0,    // 86 - 'V'
  0,    // 87 - 'W'
  0,    // 88 - 'X'
  0,    // 89 - 'Y'
  0,    // 90 - 'Z'
  0,    // 91 - '['
  0,    // 92 - '\'
  0,    // 93 - ']'
  0,    // 94 - '^'
  0,    // 95 - '_'
  0,    // 96 - '`'
  5, 127, 9, 9, 9, 127,   // 97 - 'a'
  5, 127, 73, 73, 73, 54,   // 98 - 'b'
  5, 127, 65, 65, 65, 65,   // 99 - 'c'
  5, 127, 65, 65, 65, 62,   // 100 - 'd'
  5, 127, 73, 73, 73, 73,   // 101 - 'e'
  5, 127, 9, 9, 9, 9,     // 102 - 'f'
  0,    // 103 - 'g'
  0,    // 104 - 'h'
  0,    // 105 - 'i'
  0,    // 106 - 'j'
  0,    // 107 - 'k'
  0,    // 108 - 'l'
  0,    // 109 - 'm'
  0,    // 110 - 'n'
  0,    // 111 - 'o'
  0,    // 112 - 'p'
  0,    // 113 - 'q'
  0,    // 114 - 'r'
  0,    // 115 - 's'
  0,    // 116 - 't'
  0,    // 117 - 'u'
  0,    // 118 - 'v'
  0,    // 119 - 'w'
  0,    // 120 - 'x'
  0,    // 121 - 'y'
  0,    // 122 - 'z'
  0,    // 123 - '{'
  1, 127,   // 124 - '|'
  0,    // 125
  0,    // 126
  0,    // 127
  0,    // 128
  0,    // 129
  0,    // 130
  0,    // 131
  0,    // 132
  0,    // 133
  0,    // 134
  0,    // 135
  0,    // 136
  0,    // 137
  0,    // 138
  0,    // 139
  0,    // 140
  0,    // 141
  0,    // 142
  0,    // 143
  0,    // 144
  0,    // 145
  0,    // 146
  0,    // 147
  0,    // 148
  0,    // 149
  0,    // 150
  0,    // 151
  0,    // 152
  0,    // 153
  0,    // 154
  0,    // 155
  0,    // 156
  0,    // 157
  0,    // 158
  0,    // 159
  0,    // 160
  0,    // 161
  0,    // 162
  0,    // 163
  0,    // 164
  0,    // 165
  0,    // 166
  0,    // 167
  0,    // 168
  0,    // 169
  0,    // 170
  0,    // 171
  0,    // 172
  0,    // 173
  0,    // 174
  0,    // 175
  0,    // 176
  0,    // 177
  0,    // 178
  0,    // 179
  0,    // 180
  0,    // 181
  0,    // 182
  0,    // 183
  0,    // 184
  0,    // 185
  0,    // 186
  0,    // 187
  0,    // 188
  0,    // 189
  0,    // 190
  0,    // 191
  0,    // 192
  0,    // 193
  0,    // 194
  0,    // 195
  0,    // 196
  0,    // 197
  0,    // 198
  0,    // 199
  0,    // 200
  0,    // 201
  0,    // 202
  0,    // 203
  0,    // 204
  0,    // 205
  0,    // 206
  0,    // 207
  0,    // 208
  0,    // 209
  0,    // 210
  0,    // 211
  0,    // 212
  0,    // 213
  0,    // 214
  0,    // 215
  0,    // 216
  0,    // 217
  0,    // 218
  0,    // 219
  0,    // 220
  0,    // 221
  0,    // 222
  0,    // 223
  0,    // 224
  0,    // 225
  0,    // 226
  0,    // 227
  0,    // 228
  0,    // 229
  0,    // 230
  0,    // 231
  0,    // 232
  0,    // 233
  0,    // 234
  0,    // 235
  0,    // 236
  0,    // 237
  0,    // 238
  0,    // 239
  0,    // 240
  0,    // 241
  0,    // 242
  0,    // 243
  0,    // 244
  0,    // 245
  0,    // 246
  0,    // 247
  0,    // 248
  0,    // 249
  0,    // 250
  0,    // 251
  0,    // 252
  0,    // 253
  0,    // 254
  0,    // 255
};
#endif

66 comments:

  1. Replies
    1. I Had some problems but at end of the day. the code and circuit are working very Good

      Cesar

      Delete
  2. I made it woking perfect. Thank you & loves from Turkiye..

    ReplyDelete
    Replies
    1. Can you help me? my problem is the DHT dht; line

      Delete
    2. Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Alaplap:"Arduino/Genuino Uno"

      In file included from C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_315130\sketch_mar30a.ino:25:0:

      C:\Users\User\Documents\Arduino\libraries\MD_Parola-master\src/MD_Parola.h:962:3: warning: 'typedef' was ignored in this declaration

      };

      ^

      lto1.exe: internal compiler error: in lto_output_varpool_node, at lto-cgraph.c:624

      Please submit a full bug report,

      with preprocessed source if appropriate.

      See for instructions.

      lto-wrapper.exe: fatal error: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status

      compilation terminated.

      c:/program files/windowsapps/arduinollc.arduinoide_1.8.21.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

      collect2.exe: error: ld returned 1 exit status

      exit status 1

      Delete
    3. The same error. What happen?

      Delete
  3. i doesnt work with pro mini because low memory (a bit little maybe ok)

    ReplyDelete
  4. errore compilazione interna non funziona!!!

    ReplyDelete
  5. non funziona con arduino nano perché poca memoria

    ReplyDelete
  6. Lo sketch usa 30738 byte (100%) dello spazio disponibile per i programmi. Il massimo è 30720 byte.
    Le variabili globali usano 771 byte (37%) di memoria dinamica, lasciando altri 1277 byte liberi per le variabili locali. Il massimo è 2048 byte.
    Sketch troppo grande; guarda http://www.arduino.cc/en/Guide/Troubleshooting#size per consigli su come ridurne la dimensione
    Errore durante la compilazione per la scheda Arduino Nano.

    ReplyDelete
  7. if I compile with ARDUINO UNO it's ok, but with ARDUINO NANO (Atmega 328) a little memory error

    ReplyDelete
  8. why? the two cards should be compatible ...

    ReplyDelete
  9. P.setFont(1, numeric7Seg);
    P.setFont(0, numeric7Seg);
    ------- not declare in this scope-------
    ------- error compiling for board (all board)
    pls help me!!!

    ReplyDelete
    Replies
    1. P.setFont(1,numeric7Se);

      please correct the flowing line

      Delete
  10. whit Arduino Nano doesn't work.

    ReplyDelete
  11. Hello
    meda error on the line
    DHT dht;
    no matching funtion for call to DHT :: DHT () '
    please help
    I use arduino 1.8.9

    ReplyDelete
  12. is showing error MD_DS1307.h: No such file or directory

    ReplyDelete
  13. Has anyone here tried to make this Watch with IR Remote Control? (for control)

    ReplyDelete
  14. When I load the sketch for the first time via USB it works, then when I turn the board off and on again I have to press the Reset button several times to run the clock. If you do not, do not turn on the watch.
    Why does this happen?

    ReplyDelete
  15. Replies
    1. Same prblm with me. But I saw that no response for any quary from author :(

      Delete
    2. I had the same problem, solution is:

      change P.setZone(0, 4, 1) to P.setZone(0, 0, 0);

      Delete
  16. CLOCK IS NOT AUTO START AFTER PLUG IN THE POWER
    HELP TO RESOLVE

    ReplyDelete
  17. Hello i have error avrdude: stk500_recv(): programmer is not responding is there someone who know what is this ?

    ReplyDelete
  18. We kindly ask the author to correct alleged errors in the Arduino code. With many thanks

    ReplyDelete
  19. Try commenting the following lines;
    //NewStateOfbuttonA = digitalRead(4);
    //NewStateOfbuttonB = digitalRead(7);
    //NewStateOfbuttonC = digitalRead(8);
    Seems to be something related to switch button input pin bouncing.
    Need to check further..

    ReplyDelete
  20. Can you tell me the value of those resistors, please

    ReplyDelete
  21. Hi
    Plz tell me how to use RTC DS3231 with arduino nano

    ReplyDelete
  22. Hi
    Plz tell me how to use RTC DS3231 with arduino nano

    ReplyDelete
  23. Hello there, this is a nice project and with me its working fine. compiled in fist time without any error. the only issue i am facing is that when it is uploaded for first time the display is ok. but when disconnected from PC and hooked power bank, there is no display and when display comes there is no seconds displayed. any idea what could be the problem. i have replaced power bank with external

    ReplyDelete
    Replies
    1. I Confirm. No more seconds after I disconnected and then reconnect to the PC.
      Pls hlp.

      Delete
    2. Mentioned above.
      change P.setZone(0, 4, 1) to P.setZone(0, 0, 0);

      Also, there is no need for the 10K resistors used for so sort of 0 logic on 3,4,5 pins.
      I have removed them(since PULLUP resistors are activated and is monitored only the change of the pin status)and I put the push buttons to the ground.

      Delete
    3. thank you so much bro.i also hade the same problem.after changing the valo to 0,0,0 my circuit are working well.

      Delete
  24. Hello! I made it and it works just fine.
    Congrats for the project!
    First time compiled and no errors.
    I'll try it with Nano and I will tell you if it works or not.
    Kind regards.

    ReplyDelete
    Replies
    1. hello may i know the how to solve the error - exit status 1
      Error compiling for board Arduino/Genuino Uno.

      Delete
    2. hello may i know the how to solve the error - exit status 1
      Error compiling for board Arduino/Genuino Uno.

      Delete
  25. I will not use a power bank unless that power bank is able to supply 5V while it is hooked at a wall charger and I haven't found one doing that till now.
    What I will use are: the below module + one 18650 battery + a phone wall charger.
    These 3 items are working as an 5V UPS.
    https://www.aliexpress.com/item/32860485087.html?spm=a2g0s.9042311.0.0.27424c4d9U4eMQ
    Good luck.

    ReplyDelete
    Replies
    1. The green module from that link. ”3.7V to 9V 2A”
      Micro USB input, output set to 5V and the battery (at least one ofc :)) to the Bat+ and Bat-.
      This module is dual - it supply 5V while charging the battery and when the input is lost it continues to supply 5V until the battery is depleted.

      Delete
  26. Dear author (or anyone else),
    Pls adv about how to change the code in order to make, in Mode 1, the scroll not to be shown until we press one of the other push buttons, but to break after the temperature is displayed and revert to the clock. The break the loop in the end I mean.
    I tried, but I am not so skilled.
    Thank you.

    ReplyDelete
  27. Everything is working like a charm following the tuto2and some comments but the clock is running a bit faster.. After some days I have to correct the minutes because is 3,4 minute forward..
    Any chance to fix that?

    ReplyDelete
    Replies
    1. Did you connect all the Grounds? Review your connections and perhaps replace your RTC.

      Delete
  28. Hi, why this code is not working for 8 panel LED display. I change #define MAX_DEVICES 4 to #define MAX_DEVICES 8

    ReplyDelete
  29. Hello, set up your circuit, I have a problem with the clock, the minutes are delayed, I use the DS3231 module, when loading the code, the seconds in the 4 digit do not appear, can you help me

    ReplyDelete
  30. Guys, correct the size and location of the zones.

    ReplyDelete
  31. Works on any number of matrices, if you choose the right zones.

    ReplyDelete
  32. HI
    JUST WANT TO THANK YOU VERY MUCH
    THANKS FRON SAUDI ARABIA

    ReplyDelete
  33. SALUDOS, ANTE TODO MUY BUEN TRABAJO, COMO USO EL CODIGO Font_Data.h

    ReplyDelete
  34. GREETINGS, FIRST OF ALL VERY GOOD JOB, HOW I USE THE CODE Font_Data.h. GRACIAS

    ReplyDelete