Introduction: Making a Clock With M5stick C Using Arduino IDE | RTC Real Time Clock With M5stack M5stick-C

Hi guys in this instructables we will learn how to make a clock with m5stick-C development board of m5stack using Arduino IDE.
So m5stick will display date, time & week of the month on the display.

Step 1: Things You Need

For this instructables you will need following things :

m5stick-c development board
Type C cable

Step 2: Setting Up the Arduino IDE

Make sure you installed ESP32 boards in your Arduino IDE and if it is not the case then make please follow the following instructables to do that :


Step 3: Code

Copy the following code below and upload it to your m5stick-C development board :

include "M5StickC.h"

RTC_TimeTypeDef RTC_TimeStruct;
RTC_DateTypeDef RTC_DateStruct;

void setup() {
// put your setup code here, to run once:

M5.Lcd.setCursor(40, 0, 2);
M5.Lcd.println("RTC TEST");
RTC_TimeTypeDef TimeStruct;
TimeStruct.Hours = 18;
TimeStruct.Minutes = 56;
TimeStruct.Seconds = 10;
RTC_DateTypeDef DateStruct;
DateStruct.WeekDay = 3;
DateStruct.Month = 3;
DateStruct.Date = 22;
DateStruct.Year = 2019;

void loop() {
// put your main code here, to run repeatedly:
M5.Lcd.setCursor(0, 15);
M5.Lcd.printf("Data: %04d-%02d-%02d\n",RTC_DateStruct.Year, RTC_DateStruct.Month,RTC_DateStruct.Date);
M5.Lcd.printf("Week: %d\n",RTC_DateStruct.WeekDay);
M5.Lcd.printf("Time: %02d : %02d : %02d\n",RTC_TimeStruct.Hours, RTC_TimeStruct.Minutes, RTC_TimeStruct.Seconds);

Step 4: Getting Date, Time & No. of Week on Display

After uploading the code you can see the display and the date time & week of the month will be displayed on display as it is showing in my case.
If you want to see the time running properly on this clock please refer the video provided and let me know in comment section if you wanna share anything about it.