Set Real Time Control Light Using 7 Segment
1. Abstract
Traditionally electrical light control by Time that regulate the electricity to these device. Time control light works by making everything in your house that turn on or turn of automatic controlled using technology control and do job that we would normally do manually. Light automatic take care of a lot of different activities in the house.
2. Introduction
In this project we want to do how to turn ON/OFF LED by press button as a switch to control Light of LED. We have three button for set time to turn on and turn of LED light. we used Real Time Clock (DS3231 module) to keep tract of the time even if the microcontroller is disconnect the main power because RTC run on its own batter like our clock. Using two of 7 segments cathode to display time by get real time from DS3231 module.
3. Objective
The main objective of this project is: that we are control light at our home using simple circuit.
- Display Real Time on 7 segment
- Set Time Automatic Turn ON LED Light
- Set Time Automatic Turn OFF LED Light
4. Electronic Requirement
Electronic requirement use in this project:
- Arduino Meg 2560
- RTC DS3231 Module
- 7 Segment Two Digit Cathode Type (x2)
- Button (x3)
- Resistance 330 Ohm (x6)
- LED Red(x2) Wite(x1)
- Breadboard (x1)
- USB Connected from Arduino to Computer
- Jumper Wire
5. Methodology
To create this project we use Arduino Meg 2560 as a main controller and 7segment show time clock, button set time such as minute and hour and LED turn on/off light. RTC DS3231 module to keep the time alive, and Arduino as a software for transfer the data from device to laptop or computer.
- Controller
Figure 1: Arduino MEGA 2560) |
- RTC DS3231 Module
The DS3231 is low-cost, highly accurate real-time which can maintain hours, minute, and seconds. This module work on both 3.3v and 5v that make it suitable for using with microcontroller (Arduino).
Figure 2: DS3231 Real-time Clock Module |
- 7 Segment Cathode Two Digit
Figure 3: 7Segment Cathode Two Digit |
- Button
Figure 4: Button |
- LED
Figure 5: LED |
5.2 Circuit Diagram
Connect Arduino pins to RTC and 7 Segment like diagram bellowed:
- RTC DS3231 Module
Table Connection RTC to Arduno |
Figure 6: The circuit of connection from Arduino MEGA to RTC |
- 7 Segment Cathode Two Digit
Table Connection 7 Segment to Arduino |
Figure 7: The circuit of connection from Arduino MEGA to 7 Segment |
5.3 Algorithim of Project
For this project we have 3 buttons to set time turn on and turn off LED light. The first button is use for save time and change digit edit time value. Second button use for go to set time turn on LED light and decrease time value. The last button use for go to set time turn off LED light and increase time value. DS312 module is keeping track of the time and 7 Segment display clock number.
Figure 8: Full Diagram of Project |
Flow Chart Process |
5.4 Coding
First open arduino software plus Arduino Mega USB Cable to computer and the select port:
After connect pin RTC DS3231 module like above then upload code set real time to RTC like below:
//#include <SPI.h>
#include <DS3231.h> //Library for RTC module (Download from Link in article)
DS3231 rtc(SDA, SCL);
void setup()
{
Serial.begin(9600);
//SPI.begin(); /* Enable the SPI interface */
rtc.begin(); // Initialize the rtc object
rtc.setTime(13, 52, 00); // Set the time to 12:00:00 (24hr format)
rtc.setDate(13, 3, 2018); // Set the time to 12:00:00 (24hr format)
}
Void loop()
{
}
*Note: You have to add library DS3231 in to this software.
Then download code and upload to your arduino: Download Code
6. Result
After upload code to Arduino already we get result like below:
- 7 Segment display real time clock by get time from DS3231.
- Button 2 (Middle): press a second 7 Segment will go to set time turn on LED mode. In mode set time if click less than a second on Button it will increase number on 7 Segment.
- Button 3 (Right): press a second 7 Segment will go to set time turn off LED mode. In mode set time if click less than a second on Button it will decrease number on 7 Segment.
- Button 1 (Left): press a second in set time mode it will save time value. But if we click less than a second it will change digit for edit number of time.
- LED will turn on/off when time we set the same real time.
Royal University of Phnom Penh
Faculty of Engineering
Dep. Telecommunication and Electronic Engineering
Group Member:
1. Tann Thona
2. Sim Pichdany
3. Ven Seyha
Faculty of Engineering
Dep. Telecommunication and Electronic Engineering
Group Member:
1. Tann Thona
2. Sim Pichdany
3. Ven Seyha
Instructor: Prof. Kuong Samnang
Date: 16 March 2018
kop
ReplyDelete