This shows you the differences between two versions of the page.
pm:prj2023:tmiu:digitalclock [2023/05/30 16:37] sajjad.al [Software Design] |
pm:prj2023:tmiu:digitalclock [2023/05/30 16:58] (current) sajjad.al [Introduction] |
||
---|---|---|---|
Line 7: | Line 7: | ||
| | ||
- | • The goal and purpose of this project is to build and design a simple Digital Clock with Alarm and LED Matrix Display, to displays the current time on LED display and it also can be set to sound an Alarm on a specific time. The clock uses an LED matrix to display the time, and a buzzer to sound the alarm. | + | • The goal and purpose of this project is to build and design a simple Digital Clock with Alarm and LED Matrix Display, to displays the current time and date on LED display and it also can be set to sound an Alarm on a specific time. The clock uses an LED matrix to display the time, and a buzzer to sound the alarm. |
- | • The idea of this project comes from an actual Digital clock but I added the Alarm function. | ||
Line 23: | Line 23: | ||
- | {{:pm:prj2023:tmiu:pic.jpg?200|}} | + | |
- | ===== Hardware Design ===== | + | {{:pm:prj2023:tmiu:1.jpg?200|}}===== Hardware Design ===== |
Line 63: | Line 63: | ||
#include <MD_Parola.h> | #include <MD_Parola.h> | ||
+ | |||
+ | |||
#include "RTClib.h" | #include "RTClib.h" | ||
+ | |||
+ | |||
#include <toneAC.h> | #include <toneAC.h> | ||
+ | |||
+ | |||
RTC_DS1307 RTC; | RTC_DS1307 RTC; | ||
+ | |||
DateTime now; | DateTime now; | ||
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW | #define HARDWARE_TYPE MD_MAX72XX::FC16_HW | ||
+ | |||
#define MAX_DEVICES 4 | #define MAX_DEVICES 4 | ||
+ | |||
#define CLK_PIN 13 | #define CLK_PIN 13 | ||
+ | |||
#define DATA_PIN 11 | #define DATA_PIN 11 | ||
+ | |||
#define CS_PIN 10 | #define CS_PIN 10 | ||
- | + | | |
int i = 9; | int i = 9; | ||
+ | |||
int Animation; | int Animation; | ||
+ | |||
String RandAn; | String RandAn; | ||
Line 82: | Line 95: | ||
// Brightness variables | // Brightness variables | ||
+ | |||
int brightness = 5; // Initial brightness level | int brightness = 5; // Initial brightness level | ||
+ | |||
const int brightnessStep = 1; // Step to increase/decrease brightness | const int brightnessStep = 1; // Step to increase/decrease brightness | ||
+ | |||
const int brightnessMin = 0; // Minimum brightness level | const int brightnessMin = 0; // Minimum brightness level | ||
+ | |||
const int brightnessMax = 15; // Maximum brightness level | const int brightnessMax = 15; // Maximum brightness level | ||
// Button pin numbers | // Button pin numbers | ||
+ | |||
const int brightnessUpPin = 2; | const int brightnessUpPin = 2; | ||
+ | |||
const int brightnessDownPin = 3; | const int brightnessDownPin = 3; | ||
+ | |||
const int alarmButtonPin = 4; // Alarm button pin | const int alarmButtonPin = 4; // Alarm button pin | ||
Line 95: | Line 115: | ||
bool isAlarmEnabled = false; | bool isAlarmEnabled = false; | ||
+ | |||
bool isAlarmOn = false; | bool isAlarmOn = false; | ||
char daysOfTheWeek[7][12] = {"sun", "mon", "tues", "wedn", "thur", "fri", "sat"}; | char daysOfTheWeek[7][12] = {"sun", "mon", "tues", "wedn", "thur", "fri", "sat"}; | ||
+ | |||
char monthOfTheYear[12][12] = {"Jan", "Feb", "Mar", "April", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"}; | char monthOfTheYear[12][12] = {"Jan", "Feb", "Mar", "April", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"}; | ||
struct sCatalog | struct sCatalog | ||
+ | |||
{ | { | ||
+ | |||
textEffect_t effect; | textEffect_t effect; | ||
+ | | ||
const char * psz; | const char * psz; | ||
+ | | ||
uint16_t speed; | uint16_t speed; | ||
+ | | ||
uint16_t pause; | uint16_t pause; | ||
}; | }; | ||
+ | |||
sCatalog catalog[] = | sCatalog catalog[] = | ||
+ | |||
{ | { | ||
{ PA_PRINT,"",80,3000 }, | { PA_PRINT,"",80,3000 }, | ||
+ | | ||
{ PA_SCROLL_UP,"",80,3000 }, | { PA_SCROLL_UP,"",80,3000 }, | ||
+ | | ||
{ PA_SCROLL_DOWN,"",80,3000 }, | { PA_SCROLL_DOWN,"",80,3000 }, | ||
+ | | ||
{ PA_SCROLL_LEFT,"",80,3000 }, | { PA_SCROLL_LEFT,"",80,3000 }, | ||
+ | | ||
{ PA_SCROLL_RIGHT,"",80,3000 }, | { PA_SCROLL_RIGHT,"",80,3000 }, | ||
+ | | ||
{ PA_SPRITE,"",80,3000 }, | { PA_SPRITE,"",80,3000 }, | ||
+ | | ||
{ PA_SLICE,"",15,3000 }, | { PA_SLICE,"",15,3000 }, | ||
+ | | ||
{ PA_MESH,"",150,3000 }, | { PA_MESH,"",150,3000 }, | ||
+ | | ||
{ PA_FADE,"",250,3000 }, | { PA_FADE,"",250,3000 }, | ||
+ | | ||
{ PA_DISSOLVE,"",500,3000 }, | { PA_DISSOLVE,"",500,3000 }, | ||
+ | | ||
{ PA_BLINDS,"",120,3000 }, | { PA_BLINDS,"",120,3000 }, | ||
+ | | ||
{ PA_RANDOM,"",50,3000 }, | { PA_RANDOM,"",50,3000 }, | ||
+ | | ||
{ PA_WIPE,"",80,3000 }, | { PA_WIPE,"",80,3000 }, | ||
+ | | ||
{ PA_WIPE_CURSOR,"",80,3000 }, | { PA_WIPE_CURSOR,"",80,3000 }, | ||
+ | | ||
{ PA_SCAN_HORIZ,"",80,3000 }, | { PA_SCAN_HORIZ,"",80,3000 }, | ||
+ | | ||
{ PA_SCAN_HORIZX,"",80,3000 }, | { PA_SCAN_HORIZX,"",80,3000 }, | ||
+ | | ||
{ PA_SCAN_VERT,"",80,3000 }, | { PA_SCAN_VERT,"",80,3000 }, | ||
+ | | ||
{ PA_SCAN_VERTX,"",80,3000 }, | { PA_SCAN_VERTX,"",80,3000 }, | ||
+ | | ||
{ PA_OPENING,"",80,3000 }, | { PA_OPENING,"",80,3000 }, | ||
+ | | ||
{ PA_OPENING_CURSOR,"",80,3000 }, | { PA_OPENING_CURSOR,"",80,3000 }, | ||
+ | | ||
{ PA_CLOSING,"",80,3000 }, | { PA_CLOSING,"",80,3000 }, | ||
+ | | ||
{ PA_CLOSING_CURSOR,"",80,3000 }, | { PA_CLOSING_CURSOR,"",80,3000 }, | ||
+ | | ||
{ PA_SCROLL_UP_LEFT,"",80,3000 }, | { PA_SCROLL_UP_LEFT,"",80,3000 }, | ||
+ | | ||
{ PA_SCROLL_UP_RIGHT,"",80,3000 }, | { PA_SCROLL_UP_RIGHT,"",80,3000 }, | ||
+ | | ||
{ PA_SCROLL_DOWN_LEFT,"",80,3000 }, | { PA_SCROLL_DOWN_LEFT,"",80,3000 }, | ||
+ | | ||
{ PA_SCROLL_DOWN_RIGHT,"",80,3000 }, | { PA_SCROLL_DOWN_RIGHT,"",80,3000 }, | ||
+ | | ||
{ PA_GROW_UP,"",80,3000 }, | { PA_GROW_UP,"",80,3000 }, | ||
+ | | ||
{ PA_GROW_DOWN,"",80,3000 }, | { PA_GROW_DOWN,"",80,3000 }, | ||
+ | | ||
}; | }; | ||
Line 348: | Line 405: | ||
===== Results Obtained ===== | ===== Results Obtained ===== | ||
+ | After i built the Hardware components and wrote the Software (CODE): | ||
- | | + | * The digital clock should display the current time in hours and minutes using the LED matrix. |
- | What were the results obtained after the realization of your project. | + | |
+ | * The clock should retrieve the time from the Tiny RTC module using the I2C interface. | ||
+ | |||
+ | * The clock should display the current day of the week, date, month, and year on the LED matrix. | ||
+ | |||
+ | * The clock should support different text effects and animations for displaying the time and date. | ||
+ | |||
+ | * The clock should have three push buttons for controlling the brightness of the LED matrix and activating/deactivating the alarm. | ||
+ | |||
+ | * The clock should activate an alarm sound using the buzzer at a predefined alarm time (8:30 AM). | ||
Line 356: | Line 423: | ||
===== Conclusions ===== | ===== Conclusions ===== | ||
+ | |||
+ | the project demonstrates the ability to create a digital clock using an Arduino Uno, LED matrix, Tiny RTC module, push buttons, and a buzzer. The project combines both hardware and software components to deliver a functional and interactive digital clock. | ||
===== Download ===== | ===== Download ===== | ||
Line 377: | Line 446: | ||
- | + | **Software Resources** | |
- | List of documents, datasheets, Internet resources used, possibly grouped by **Software Resources** and **Hardware Resources**. | + | |
+ | https://mytectutor.com/ds1307-real-time-clock-with-arduino-including-digital-clock-using-max7219-led-matrix/ | ||
+ | |||
+ | |||
+ | https://pastebin.com/EkX8aJvc | ||
+ | |||
+ | |||
+ | https://lastminuteengineers.com/ds1307-rtc-arduino-tutorial/ | ||