Introduction: Beautiful and Practical Clock With Calendar

Picture of Beautiful and Practical Clock With Calendar

Use I2C_LCD to make a beautiful and practical clock with calendar.

I2C_LCD can display bitmap, graphic and character, you can make beautiful UI for your project with I2C_LCD.
I'm sure you'll be interested in this work.

Materials have to be prepared:

I2C_LCD(With Female Jumper Cable) x1

I2C_LCD(With universal Grove cable) x1

Seeeduino Lotus - ATMega328 Board with Grove Interface x1

Grove - RTC x1

Grove - Universal 4 Pin 20cm Unbuckled Cable (5 PCs Pack) x1

Step 1: Install the Arduino Library for I2C_LCD.

You can download the library from here: I2C_LCD Library

How to install the library? For more informations? please refer to the WIKI page.

More exciting features please refer to the User Manual.

Step 2: Install the Arduino Library for Grove-RTC.

You can download the RTC library from here.

For more informations about Grove_RTC, please refer to the WIKI page.

Step 3: Connection.

Picture of Connection.

Connect the I2C_LCD and Grove-RTC to your Arduino board, here we use Seeeduino Lotus.

I2C_LCD and Grove-RTC are I2C interface module, so we connect them to the I2C bus.

Step 4: Coding.

Picture of Coding.

1. Download the arduino demo project (clockWithCalendar.rar) to your computer.

2. Open the project by Arduino IDE, and then upload the program to your board.

For more informations? please refer to the WIKI page.

More exciting features please refer to the User Manual.

The main code is shown below.

<p>#include  <Wire.h></p><p>#include  <I2C_LCD.h></p><p>#include "DS1307.h"</p><p>//For detials of the function useage, please refer to "I2C_LCD User Manual". 
//You can download the "I2C_LCD User Manual" from I2C_LCD WIKI page: 
//                              http://www.seeedstudio.com/wiki/I2C_LCD</p><p>I2C_LCD LCD;         //define a object of I2C_LCD class           
uint8_t I2C_LCD_ADDRESS = 0x51;    //Device address configuration, the default value is 0x51.</p><p>extern GUI_Bitmap_t bmClock;       //Declare bitmap data packet.</p><p>char monthTab[13][6] = {"Null","Jan.,","Feb.,", "Mar.,", "Apr.,", "May,", "Jun.,", "Jul.,", 
                        "Aug.,", "Sep.,", "Oct.,", "Nov.,", "Dec.,"};
char weekTab[8][10] = {"Null","Mon.,","Tues.,", "Wed.,", "Thur.,", "Fri.,", "Sat.,", "Sun.,"};
char dayTab[32][6] = {"Null","1st,","2nd,", "3rd,", "4th,", "5th,", 
                        "6th,", "7th,", "8th,", "9th,", "10th,",
                        "11th,", "12th,", "13th,", "14th,", "15th,",
                        "16th,", "17th,", "18th,", "19th,", "20th,",
                        "21th,", "22nd,", "23rd,", "24th,", "25th,",
                        "26th,", "27th,", "28th,", "29th,", "30th,", "31st,"};</p><p>char timeTab[10] = {"00:00:00"};</p><p>DS1307 clock;       //define a object of DS1307 class</p><p>void setup()
{
    Wire.begin();   //I2C controller initialization.
	clock.begin();  //RTC initialization.
	
	clock.fillByYMD(2015,07,31);    //Jul 31,2015
	clock.fillByHMS(21,20,30);      //21:20:30"
	clock.fillDayOfWeek(FRI);       //Friday
	clock.setTime();    //Write time to the RTC chip.
}</p><p>void loop()
{
    LCD.CleanAll(WHITE);    //Clean the screen with black or white.</p><p>    //Booting logo ON, backlight ON, bitmap work mode.
    //If you want to display characters please switch to WM_CharMode.
    LCD.WorkingModeConf(ON, ON, WM_BitmapMode);</p><p>    //Display bitmap at the specified location.
    //Prototype: void DrawScreenAreaAt(GUI_Bitmap_t *bitmap, uint8_t x, uint8_t y)
    LCD.DrawScreenAreaAt(&bmClock, 4, 3);</p><p>    //Draw a rectangle, and filled with black; 
    //Prototype: void DrawRectangleAt(x, y, width, height, mode);
    LCD.DrawRectangleAt(0, 0, 128, 5, BLACK_FILL);
    LCD.DrawRectangleAt(0, 59, 128, 5, BLACK_FILL);
    
    //Booting logo ON, backlight ON, character work mode.
    LCD.WorkingModeConf(ON, ON, WM_CharMode);</p><p>    while(1)
    {
        //Update the date and time.
        clock.getTime();</p><p>        //Set font size.
        LCD.FontModeConf(Font_6x8, FM_ANL_AAA, BLACK_BAC);
        //Set the start coordinate.
        LCD.CharGotoXY(5,10);
        
        //Date format: Fri.,24st,Jul.,2015
        LCD.print(weekTab[clock.dayOfWeek]); 
        LCD.print(dayTab[clock.dayOfMonth]); 
        LCD.print(monthTab[clock.month]); 
        LCD.print(clock.year+2000);
        
        //Set font size.
        LCD.FontModeConf(Font_10x20, FM_ANL_AAA, BLACK_BAC); 
        //Set the start coordinate.
        LCD.CharGotoXY(40,32);
        
        //Time format: 00:00:00
        snprintf(timeTab, 9, "%02d:%02d:%02d", clock.hour, clock.minute, clock.second);    
        LCD.print(timeTab); 
        
        delay(1000);
    }
}</p>

Step 5: Enjoy Yourself.

Picture of Enjoy Yourself.

Thanks for your time.

Comments

schliefer (author)2017-08-16

Please can you say me what can I do that is go for Arduino.

Many thanks.

paul.schliefer@orange.fr

sketch_aug16d:1: error: stray '#' in program

<p>#include <Wire.h></p><p>#include <I2C_LCD.h></p><p>#include "DS1307.h"</p><p>//For detials of the function useage, please refer to "I2C_LCD User Manual".

^

sketch_aug16d:1: error: stray '#' in program

<p>#include <Wire.h></p><p>#include <I2C_LCD.h></p><p>#include "DS1307.h"</p><p>//For detials of the function useage, please refer to "I2C_LCD User Manual".

^

sketch_aug16d:1: error: stray '#' in program

<p>#include <Wire.h></p><p>#include <I2C_LCD.h></p><p>#include "DS1307.h"</p><p>//For detials of the function useage, please refer to "I2C_LCD User Manual".

^

sketch_aug16d:1: error: expected unqualified-id before '<' token

<p>#include <Wire.h></p><p>#include <I2C_LCD.h></p><p>#include "DS1307.h"</p><p>//For detials of the function useage, please refer to "I2C_LCD User Manual".

^

sketch_aug16d:5: error: expected unqualified-id before string constant

"Aug.,", "Sep.,", "Oct.,", "Nov.,", "Dec.,"};

^

sketch_aug16d:5: error: expected declaration before '}' token

"Aug.,", "Sep.,", "Oct.,", "Nov.,", "Dec.,"};

^

exit status 1
stray '#' in program

About This Instructable

3,067views

44favorites

License:

Bio: Electronics can be art! I'm a maker, and I make for makers~
More by Joney S:Display Picture Or Icon On the fancy I2C_LCDBeautiful and practical clock with calendar
Add instructable to: