BANGLA DIGITAL CLOCK
Haider Ali Shuvo
1606134
1
Ratul Kundu
1606147
Prasun Datta
1606148
Raisa Bentay Hossain
1606151
Submitted by – Group C.02
C
EEE 416 – Microprocessor and Embedded Systems Laboratory
Jan 2020 Level-4 Term-I Section A
Final Project Demonstration
Department of Electrical and Electronics Engineering
Bangladesh University of Engineering and Technology
Outline
Bangla Digital Clock
2
EEE 416 (2020) – Final Project Group C.02
Summary
Goals:
Bangla Digital Clock
3
EEE 416 (2020) – Final Project Group C.02
Goals Fulfilled:
Background
Not everyone in Bangladesh can use English clock. Besides, it is a good idea to use our native language in a tool which is used in our daily life for more comfortable experience.
Bangla Digital Clock
4
EEE 416 (2020) – Final Project Group C.02
Methods-1: Hierarchy
Bangla Digital Clock
5
EEE 416 (2020) – Final Project Group C.02
STM32F 103R6
Methods-2 : Setting Up pins in STM32CubeMX
Bangla Digital clock
6
EEE 416 (2020) – Final Project Group C.02
Methods-3:Generating Initial Code With other essential Setups in CubeMX
Bangla Digital Clock
7
EEE 416 (2020) – Final Project Group C.02
Simulation
Bangla Digital Clock
8
EEE 416 (2020) – Final Project Group C.02
Change Minute:
Change Hour:
Key features
Bangla Digital Clock
9
EEE 416 (2020) – Final Project Group C.02
Change AM-PM
Display Current time
Bangla Digital Clock
10
EEE 416 (2020) – Final Project Group C.02
Video Demonstration
Bangla Digital Clock
11
EEE 416 (2020) – Final Project Group C.02
Simulation: Clock With RTC(Real Time Clock)
Displaying Current System Time (from AM part)
Displaying Time(from PM part)
Bangla Digital Clock
12
EEE 416 (2020) – Final Project Group C.02
Video Demonstration
PCB Layout
Bangla Digital clock
13
EEE 416 (2020) – Final Project Group C.02
3d rendering
Bangla Digital Clock
14
EEE 416 (2020) – Final Project Group C.02
Top View of 3d Rendered PCB
Bangla Digital Clock
15
EEE 416 (2020) – Final Project Group C.02
Bangla Digital Clock
16
EEE 416 (2020) – Final Project Group C.02
Top Silk:Position of Components that will be placed on PCB
Top Copper: Traces that will be on the upper layer of PCB
Bottom Copper: Traces that will be on the bottom side of PCB
Future Outlook
Bangla Digital Clock
17
EEE 416 (2020) – Final Project Group C.02
In this project, ”Real Time Clock(RTC)” embedded in the STM32F 103R6 has been used to display time. To change the hour,min and sec, RTC interrupt coding has to be incorporated. This can be a promising extension of the project.
Furthermore, inclusion of time zone would make the project more dynamic as well as user friendly.
Last but not the least, integration of organic light-emitting diode (OLED) screen would make this project more realistic.
This project can be extended further in the following directions:
Conclusion
Bangla Digital Clock
18
EEE 416 (2020) – Final Project Group C.02
Implementation of digital devices in our native language will make them user friendly for mass people.
Moreover for implementing this project, an up-to-date microcontroller called STM32F from cortex m series is used which will make this clock easily implementable for day -to-day use.
Besides the advantage of adjusting the H:M:S as well as AM/PM makes the clock a dynamic one. Nonetheless, this design also incorporates a nice menu layout which will attract the users.
Furnishing this project a little more by introducing some more functionality will make this digital clock a profitable product.
ADDITIONAL SLIDES
19
C
EEE 416 – Microprocessor and Embedded Systems Laboratory
Jan 2020 Level-4 Term-I Section A
Final Project Demonstration
Department of Electrical and Electronics Engineering
Bangladesh University of Engineering and Technology
References
20
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
Custom Character generator-
https://maxpromer.github.io/LCD-Character-Creator/
Stm32 RTC tutorial-
https://www.youtube.com/watch?v=c6D-IiWSbqA
Liquid Crystal Library for stm32-
https://github.com/SayidHosseini/STM32LiquidCrystal
Stm32f103R6 Datasheet-
https://www.st.com/resource/en/datasheet/cd00210843.pdf
Arduino custom character function-
https://www.arduino.cc/en/Reference/LiquidCrystalCreateChar
Proteus PCB Design tutorial links:
https://www.youtube.com/watch?v=TwHGJlalI88
https://www.youtube.com/watch?v=TwHGJlalI88
Detailed Methods
Softwares used for this project & tutorial video URLs and screen shots
Bangla Digital Clock
21
EEE 416 (2020) – Final Project Group C.02
STM32CubeMX
ARM Keil uvision5
Bangla Digital Clock
22
EEE 416 (2020) – Final Project Group C.02
Proteus schematic capture
Proteus PCB Design tool
Bangla Digital Clock
23
EEE 416 (2020) – Final Project Group C.02
Explanation Of How The Software Used
STM32CubeMX:
STM32CubeMX is a graphical tool that allows a very easy configuration of STM32 microcontrollers and microprocessors, as well as the generation of the corresponding initialization C code. The step-by-step process is,
Bangla Digital Clock
24
EEE 416 (2020) – Final Project Group C.02
Explanation Of How The Software Used
ARM Keil MicroVision5:
Keil MicroVision is a free software which solves many of the pain points for an embedded program developer. This software is an integrated development environment (IDE), which integrated a text editor to write programs, a compiler and it will convert your source code to hex files too.
We have used ARM Keil MicroVision5 to,
Bangla Digital Clock
25
EEE 416 (2020) – Final Project Group C.02
Explanation Of How The Software Used
Proteus,
As we have no physical slide, we are using PROTEUS as the circuit simulator. We have used this for,
Bangla Digital Clock
26
EEE 416 (2020) – Final Project Group C.02
byte customChar[] = { 0x10, 0x08, 0x04, 0x02, 0x01, 0x02, 0x1C, 0x18 };
byte customChar[] = { 0x1E, 0x01, 0x01, 0x06, 0x18, 0x04, 0x02, 0x01 };
Custom Character Generator-https://maxpromer.github.io/LCD-Character-Creator/
Bangla Digital Clock
27
EEE 416 (2020) – Final Project Group C.02
byte customChar[] = { 0x0E, 0x0E, 0x01, 0x11, 0x11, 0x11, 0x0A, 0x04 };
8
byte customChar[] = { 0x1F, 0x12, 0x14, 0x17, 0x11, 0x11, 0x1F, 0x0E };
28
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
byte customChar[] = { 0x11, 0x12, 0x14, 0x13, 0x11, 0x11, 0x0A, 0x04 };
byte customChar[] = { 0x1F, 0x11, 0x11, 0x1F, 0x01, 0x01, 0x01, 0x01 };
byte customChar[] = { 0x10, 0x10, 0x10, 0x1F, 0x1E, 0x11, 0x1F, 0x1F };
Bangla Digital Clock
29
EEE 416 (2020) – Final Project Group C.02
byte customChar[] = { 0x10, 0x10, 0x0C, 0x02, 0x01, 0x1D, 0x13, 0x01 };
0
Circuit Diagram
30
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
Source Codes
Function Name : lcdnumber(0~9)
31
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
void lcdnumber0(int startposition) { setCursor(startposition+0,0); print("0"); } void lcdnumber1(int startposition) { setCursor(startposition+0,0); write((0)); } void lcdnumber2(int startposition) { setCursor(startposition+0,0); write((1)); } void lcdnumber3(int startposition) { setCursor(startposition+0,0); write((2)); } | void lcdnumber4(int startposition) { setCursor(startposition+0,0); print("8"); } void lcdnumber5(int startposition) { setCursor(startposition+0,0); write((3)); //5 } void lcdnumber6(int startposition) { setCursor(startposition+0,0); write((5)); } | void lcdnumber7(int startposition) { setCursor(startposition+0,0); write((4)); } void lcdnumber8(int startposition) { setCursor(startposition+0,0); write((6)); } void lcdnumber9(int startposition) { setCursor(startposition+0,0); write((7)); } |
Source Codes
Function Name : numberprinter(int num , int pos)
32
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
void numberprinter(int num , int pos) { if(num == 0) { lcdnumber0(pos); } if(num == 1) { lcdnumber1(pos); } if(num == 2) { lcdnumber2(pos); } if(num == 3) { lcdnumber3(pos); } if(num == 4) { lcdnumber4(pos); } | if(num == 5) { lcdnumber5(pos); } if(num == 6) { lcdnumber6(pos); } if(num == 7) { lcdnumber7(pos); } if(num == 8) { lcdnumber8(pos); } if(num == 9) { lcdnumber9(pos); }//serial.begin(9600); } |
Source Codes
Function : character generator
33
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
byte C0[8] = {0x10,0x08,0x04,0x02,0x01,0x02,0x1C,0x18}; //1 byte C1[8] = {0x1E,0x01,0x01,0x06,0x18,0x04,0x02,0x01}; //2 byte C2[8] = {0x0E,0x0E,0x01,0x11,0x11,0x11,0x0A,0x04}; //3 byte C3[8] = {0x1F,0x12,0x14,0x17,0x11,0x11,0x1F,0x0E}; //5 byte C5[8] = {0x11,0x12,0x14,0x13,0x11,0x11,0x0A,0x04}; //6 byte C4[8] = {0x1F,0x11,0x11,0x1F,0x01,0x01,0x01,0x01}; //7 byte C6[8] = {0x10,0x10,0x10,0x1F,0x1E,0x11,0x1F,0x1F}; //8 byte C7[8] = {0x10,0x10,0x0C,0x02,0x01,0x1D,0x13,0x01}; //9 |
LCD Initialization & Bangla Character Generation:
Function : LiquidCrystal (function called in main code)
34
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
LiquidCrystal(GPIOB, GPIO_PIN_2, GPIO_PIN_1, GPIO_PIN_3, GPIO_PIN_4, GPIO_PIN_5, GPIO_PIN_6, GPIO_PIN_7);
// create a new character createChar(0, C0); //1 createChar(1, C1); //2 createChar(2, C2); //3 createChar(3, C3); //5 createChar(4, C4); //7 createChar(5, C5); //6 createChar(6, C6); //8 createChar(7, C7); //9
|
35
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
Menu Configuration:
setCursor(0, 1);
write(cnt);
if(cnt==0)
{
setCursor(1, 1);
print(":DISPLAY TIME");
setCursor(14, 1);
print(" ");
}
if(cnt==1)
{
setCursor(1, 1);
print(":CHANGE MINUTE");
}
if(cnt==2)
{
setCursor(1, 1);
print(":CHANGE HOUR");
setCursor(13, 1);
print(" ");
}
if(cnt==3)
{
setCursor(1, 1);
print(":CHANGE AM-PM");
setCursor(14, 1);
print(" ");
}
36
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_1)==GPIO_PIN_RESET && state==1)
{
cnt++;
state=0;
setCursor(0, 1);
write(cnt);
if(cnt>3){
cnt=0;
setCursor(0, 1);
write(cnt);
}
}
else if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_1)!=GPIO_PIN_RESET && state==0)
{
state=1;
}
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_2)==GPIO_PIN_RESET && state==1)
{
dg=1;
state1=0;
}
else if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_2)!=GPIO_PIN_RESET && state==0)
{
state1=1;
}
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_3)==GPIO_PIN_RESET && state==1)
{
dg=-1;
state2=0;
}
else if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_3)!=GPIO_PIN_RESET && state==0)
{
state2=1;
}
PushButtons:
37
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
state=1;
state1=1;
state2=1;
s=0;
m=0;
h=0;
a=0;
switch(cnt)
{
case 1:
m=m+dg;
dg=0;
if(m>59)
{
m=59;
}
if(m<0)
{
m=0;
}
break;
Clock Functioning:
case 3:
if(dg==1){
a=1;
dg=0;}
if(dg==-1){
a=0;
dg=0;}
break;
}
if(s>59){
s=0;
m++;
if(m>59){
m=0;
h++;
if(h>11){
h=0; //12 Hour Format
a=!a;
}
}
}
case 2:
h=h+dg;
dg=0;
if(h>11)
{
h=11;
}
if(h<0)
{
h=0;
}
break;
38
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
d=h%10;
numberprinter(d, 4);
d=h/10;
numberprinter(d, 3);
d=m%10;
numberprinter(d, 7);
d=m/10;
numberprinter(d, 6);
d=s%10;
numberprinter(d, 10);
d=s/10;
numberprinter(d, 9);
setCursor(14, 0);
if(a){
print("AM");
}
else{
print("PM");
}
if(cnt==0)
{
s++;
setCursor(5, 0);
print(" ");
setCursor(8, 0);
print(" ");
HAL_Delay(1000);
setCursor(5, 0);
print(":");
setCursor(8, 0);
print(":");
}
Hour , Minutes, Hour Digits Printing:
39
EEE 416 (2020) – Final Project Group C.02 Bangla Digital Clock
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2|GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4
|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7, GPIO_PIN_RESET);
/*Configure GPIO pins : PC1 PC2 PC3 */
GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : PB2 PB3 PB4 PB5
PB6 PB7 */
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
|GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
GPIO Input & Output pins
Bangla Digital Clock
40
EEE 416 (2020) – Final Project Group C.02
DIFICULTIES
Some Difficulties That We Faced While Implementing This Project Are,
We have solved these following issues,