Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Mikiklopsiki
Published © GPL3+

Matrix max7219 32x8 temperature humidity clock

Cool clock with temperature and humidity.

IntermediateShowcase (no instructions)3,952
Matrix max7219 32x8 temperature humidity clock

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
or other one
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Real Time Clock (RTC)
Real Time Clock (RTC)
I dont found right one, its 1302 real time clock
×1
DHT22 Temperature and Humidity Sensor
DFRobot DHT22 Temperature and Humidity Sensor
×1
LED Lighting, 16 X 8 LED Matrix
LED Lighting, 16 X 8 LED Matrix
I used one 32 x 8 Max7219 matrix display
×2

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
3D Printer (generic)
3D Printer (generic)

Story

Read more

Schematics

Schematic

Code

Code

Arduino
/*MAX7219 Display  Arduino
VCC 5 V
GND GND
DIN 11 (MOSI)
CS  3 (SS)
CLK 13 (SCK)

RTC- clk 6, dat 7, rst 8
DHT22 - D4

Hardware: Arduino Nano v3, Max7219 4x matrix Display, jumper wires, solidering iron,ds 1302 RTC real time clock,DHT22



*/


// Include the required Arduino libraries:
//DHT11
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 4 
//MAX
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
//RTC
#include <virtuabotixRTC.h>
virtuabotixRTC myRTC(6, 7, 8);//RTC pins
// Define Max hardware type, size, and output pins:
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES 4
#define CS_PIN 3

#define DHTTYPE    DHT22

DHT dht(DHTPIN, DHTTYPE);

// Create a new instance of the MD_Parola class with hardware SPI connection:
MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);


unsigned long time = millis();//idk something for counting
void setup() {
 
  dht.begin();
  //myRTC.setDS1302Time(50, 46, 13, 3, 30, 4, 2021);  //Setting up time
  //max settings
  myDisplay.begin();
  // Set the intensity (brightness) of the display (0-15):
  myDisplay.setIntensity(13);
  // Clear the display:
  myDisplay.displayClear();
  myDisplay.setTextAlignment(PA_CENTER);
  myDisplay.setInvert(true);
  myDisplay.print("Settin");
  myDisplay.setInvert(false);
  delay(6000);
  myDisplay.print("DONE");
  delay(2000);
  myDisplay.displayClear();
}

void loop() {
  float h = dht.readHumidity();//DHT humidity
  float temp = dht.readTemperature();//DHT temperature
  
//TEMP---------------------------------------------------------------------
if(millis()-time > 20000){
  if(millis()-time < 23000){
myDisplay.setTextAlignment(PA_CENTER);
  myDisplay.print("TEMP");
  }
  else{
    if(millis()-time < 39999){
           
  int te = round(temp);
    myDisplay.print((String)te+"*C");
  
  //myDisplay.print(tempC,0);
  delay(1000);
    }
//----HIUMIDITY----------------------------------------------------------
if(millis()-time > 40000){

  if(millis()-time < 43000){
    myDisplay.print("HIUM%");
    }
    else{
    if(millis()-time < 59999){
    int hum = round(h);
    myDisplay.print((String)hum+"%");
    //myDisplay.print(h,0); 
    delay(1000);
    }
    }   
  } 

//----------------DATE---------------------------------------------------

if(millis()-time > 60000){
myDisplay.setTextAlignment(PA_CENTER);
  if(millis()-time < 63000){
    myDisplay.print("DATE");
    }
    else{
    myDisplay.print((String)myRTC.dayofmonth+" / "+myRTC.month);
    delay(10000);
    }   
  } 

//----Counter Reset-------------------------------------------------------
  if(millis()-time > 80000){
   time = millis();     
  }     
  }//end of else---------------------------------------------------------------
 }//end of if------------------------------------------------------------
else{   //HOUR---------------------------------------------------------
   myRTC.updateTime();//time update

myDisplay.setTextAlignment(PA_CENTER);

 //myDisplay.print(myRTC.hours);
 //myDisplay.setTextAlignment(PA_CENTER);
 //myDisplay.print(":");
 //myDisplay.setTextAlignment(PA_RIGHT);
 //myDisplay.print(myRTC.minutes);
 myDisplay.print((String)myRTC.hours+" : "+myRTC.minutes);
 delay(1000);
 
 



}//end of else-----------------------

  //end--------------------------------------
}

Credits

Mikiklopsiki

Mikiklopsiki

0 projects • 2 followers

Comments