Components and supplies
1
Arduino Nano R3
1
Jumper wires (generic)
2
LED Lighting, 16 X 8 LED Matrix
1
DHT22 Temperature and Humidity Sensor
1
Real Time Clock (RTC)
Tools and machines
1
Soldering iron (generic)
1
Solder Wire, Lead Free
1
Hot glue gun (generic)
1
3D Printer (generic)
Project description
Code
Code
arduino
1/*MAX7219 Display Arduino 2VCC 5 V 3GND GND 4DIN 11 (MOSI) 5CS 3 (SS) 6CLK 13 (SCK) 7 8RTC- clk 6, dat 7, rst 8 9DHT22 - D4 10 11Hardware: Arduino Nano v3, Max7219 4x matrix Display, jumper wires, solidering iron,ds 1302 RTC real time clock,DHT22 12 13 14 15*/ 16 17 18// Include the required Arduino libraries: 19//DHT11 20#include <Adafruit_Sensor.h> 21#include <DHT.h> 22#include <DHT_U.h> 23#define DHTPIN 4 24//MAX 25#include <MD_Parola.h> 26#include <MD_MAX72xx.h> 27#include <SPI.h> 28//RTC 29#include <virtuabotixRTC.h> 30virtuabotixRTC myRTC(6, 7, 8);//RTC pins 31// Define Max hardware type, size, and output pins: 32#define HARDWARE_TYPE MD_MAX72XX::FC16_HW 33#define MAX_DEVICES 4 34#define CS_PIN 3 35 36#define DHTTYPE DHT22 37 38DHT dht(DHTPIN, DHTTYPE); 39 40// Create a new instance of the MD_Parola class with hardware SPI connection: 41MD_Parola myDisplay = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); 42 43 44unsigned long time = millis();//idk something for counting 45void setup() { 46 47 dht.begin(); 48 //myRTC.setDS1302Time(50, 46, 13, 3, 30, 4, 2021); //Setting up time 49 //max settings 50 myDisplay.begin(); 51 // Set the intensity (brightness) of the display (0-15): 52 myDisplay.setIntensity(13); 53 // Clear the display: 54 myDisplay.displayClear(); 55 myDisplay.setTextAlignment(PA_CENTER); 56 myDisplay.setInvert(true); 57 myDisplay.print("Settin"); 58 myDisplay.setInvert(false); 59 delay(6000); 60 myDisplay.print("DONE"); 61 delay(2000); 62 myDisplay.displayClear(); 63} 64 65void loop() { 66 float h = dht.readHumidity();//DHT humidity 67 float temp = dht.readTemperature();//DHT temperature 68 69//TEMP--------------------------------------------------------------------- 70if(millis()-time > 20000){ 71 if(millis()-time < 23000){ 72myDisplay.setTextAlignment(PA_CENTER); 73 myDisplay.print("TEMP"); 74 } 75 else{ 76 if(millis()-time < 39999){ 77 78 int te = round(temp); 79 myDisplay.print((String)te+"*C"); 80 81 //myDisplay.print(tempC,0); 82 delay(1000); 83 } 84//----HIUMIDITY---------------------------------------------------------- 85if(millis()-time > 40000){ 86 87 if(millis()-time < 43000){ 88 myDisplay.print("HIUM%"); 89 } 90 else{ 91 if(millis()-time < 59999){ 92 int hum = round(h); 93 myDisplay.print((String)hum+"%"); 94 //myDisplay.print(h,0); 95 delay(1000); 96 } 97 } 98 } 99 100//----------------DATE--------------------------------------------------- 101 102if(millis()-time > 60000){ 103myDisplay.setTextAlignment(PA_CENTER); 104 if(millis()-time < 63000){ 105 myDisplay.print("DATE"); 106 } 107 else{ 108 myDisplay.print((String)myRTC.dayofmonth+" / "+myRTC.month); 109 delay(10000); 110 } 111 } 112 113//----Counter Reset------------------------------------------------------- 114 if(millis()-time > 80000){ 115 time = millis(); 116 } 117 }//end of else--------------------------------------------------------------- 118 }//end of if------------------------------------------------------------ 119else{ //HOUR--------------------------------------------------------- 120 myRTC.updateTime();//time update 121 122myDisplay.setTextAlignment(PA_CENTER); 123 124 //myDisplay.print(myRTC.hours); 125 //myDisplay.setTextAlignment(PA_CENTER); 126 //myDisplay.print(":"); 127 //myDisplay.setTextAlignment(PA_RIGHT); 128 //myDisplay.print(myRTC.minutes); 129 myDisplay.print((String)myRTC.hours+" : "+myRTC.minutes); 130 delay(1000); 131 132 133 134 135 136}//end of else----------------------- 137 138 //end-------------------------------------- 139} 140
Downloadable files
Schematic
Schematic

Schematic
Schematic

Comments
Only logged in users can leave comments