Course Project Self-Calibrating Prayers Clock

Slides:



Advertisements
Similar presentations
Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
Advertisements

EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Copyright, 2006: Invisible Service Technicians, LLC Invisible Service Technicians, LLC Invisible Service Technician Monitor Activation Process: IST MaintSelectionV3.php.
MM Player Supervised by: Dr. Luai Malhis. Prepared by: Mustafa Assaf & Mahmoud Musa.
Lab7: Introduction to Arduino
Mini-SumoBot Construction and Programming
Digital Thermostat and Data Logger Brandon Wagner and David Southwick.
Loops (Part 1) Computer Science Erwin High School Fall 2014.
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
Computer Science 1620 Loops.
Read Chapter 3 (David E. Simon, An Embedded Software Primer)
Railway Foundation Electronic, Electrical and Processor Engineering.
Railway Foundation Electronic, Electrical and Processor Engineering.
Digital Outputs 7-Segment Display
PYROCON12 De-Ice controller User Operation Presentation 2013.
Khaled A. Al-Utaibi  What is Arduino?  Arduino Boards  Arduino Shields  Arduino Uno Hardware.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
Capacitance Sensor Project
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Serial Peripheral Interface (SPI) Bus. SPI Bus There is no official specification for the SPI bus. It is necessary to consult the data sheets of the devices.
Digital Outputs LCD Display
Renesas Technology America Inc. 1 M16C/Tiny SKP Tutorial 2 Creating A New Project Using HEW4.
EE 1106: Introduction to EE Freshman Practicum
LSU 10/22/2004Serial I/O1 Programming Unit, Lecture 5.
Peripherals and their Control An overview of industrially available “peripheral devices” that use “pulse-width modulation” for information passing. Review.
RC CAR CONTROLLER BASED ON INTEL GALILEO SOC PLATFORM Nadav Shiloach Sagi Sabag Supervisor: Idan Shmuel Spring 2014 One Semester Project PROJECT’S ENDING.
The Voice Operated and Wirelessly Controlled Elevator Jeremy Hester Advisor: Dr. Mohammad Saadeh Class: ET 494 (Senior Design II), Fall 2013 Class Professor:
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
© Copyright 2013 by Pearson Education, Inc. All Rights Reserved.1 Chapter 4 Mathematical Functions, Characters, and Strings.
Gauge Operation and Software by Scott A. Ager. Computer Recommendations 750 MHz Pentium III 64 Meg SRAM 40 Gig Hard Drive 1024 x 768 graphics CD Writer.
INTERFACING WEB SERVER WITH A ROBOT
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
Introduction to Sensor Technology Week Five Adam Taylor
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Smart Parking System PREPARED BY : GHADEER AQRAA AND MARAH JABER.
Microcontrollers Module 3: Digital Display. 7 – Segment Display A seven-segment display (SSD), or seven- segment indicator, is a form of electronic display.
Introduction 2 Smart Design. What is smart design? 2 Everything is designed except nature The packaging of a Band-Aid The curve of a bike frame The shape.
Logic Analyzer ECE-4220 Real-Time Embedded Systems Final Project Dallas Fletchall.
Digital Inputs Interfacing Keypad
Starting Out with C++ Early Objects ~~ 7 th Edition by Tony Gaddis, Judy Walters, Godfrey Muganda Modified for CMPS 1044 Midwestern State University 6-1.
Sections © Copyright by Pearson Education, Inc. All Rights Reserved.
Laundry Now Senior Design Project Submitted By:
Chapter 5 - Interrupts.
目录 12 in 1 Sensor Features ● PIR motion sensor ● Ultrasonic sensor ● LUX sensor ● Temperature sensor ● 2 Dry contacts ● 2 external condition inputs ● IR(infrared)
Microcontrollers, Microcomputers, and Microprocessors
Department of Electronic & Electrical Engineering Further work? Simple Voltmeter. ● Analogue to Digital converter (MCP3001 SPI ) ● Analogue → 10bit binary.
Group: CCM Project 2.5. EMERSON Emerson is a diversified global manufacturing company.  Provides innovative solutions to customers in the following areas:
C# SERIAL COMMUNICATION TEMPERATURE CONTROL WITH ARDUINO KAAN EREN
Group 25 Kevin Kong Mei Ling Yeoh Xianze Zhan ECE 445 Spring 2016 THIEF RESISTANT SHOPPING CART.
Microcontroller basics Embedded systems for mortals.
1 Stacks Abstract Data Types (ADTs) Stacks Application to the analysis of a time series Java implementation of a stack Interfaces and exceptions.
Microcontroller basics
CEng3361/18 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2007 Recitation 01.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
User Operation Presentation
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Application Case Study Security Camera Controller
SB-DN-Logic960 Logic module.
Val Manes Department of Math & Computer Science
Microcontroller basics
Arduino & its hardware interfacing
Microcontroller basics
UNIT – Microcontroller.
DIGITAL CALCULATOR USING 8051
Chapter D – Serial Connections to the RPi and Analog-to-Digital Converters
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Introduction to Arduino
Presentation transcript:

Course Project Self-Calibrating Prayers Clock Khaled A. Al-Utaibi alutaibi@uoh.edu.sa

Agenda Microprocessors Microcontrollers Embedded Systems

Introduction To help Muslims everywhere to know the prayer times accurately, local and international companies have manufactured many models for prayer clock Most of these can display the following information: Current time and date. Room temperature. ATHAN times for the five prayers. Time to the IQAMA.

Introduction The existing prayer clocks have the following features: Preprogrammed prayer times for large set of cities around the world. Ability to program prayer times for other cities by entering latitude and longitude coordinates. Ability to program prayer times according to different Islamic calendars such as Umm Alqura, International Islamic University and University of Islamic Sciences. Ability to alarm prayer time using sound alarm or by flashing the prayer time display.

Introduction The existing prayer clocks have the following limitations: Require programming of date, time, location and calendar for the first time (auto –detect setting is not supported). Some models require reprogramming of date, time, location and calendar each time the power is disconnected. Require manual adjustment (calibration) of date and time at regular intervals to account of internal timer errors. Do not provide any means of synchronization between individual devices.

Project Objective The objective of this project is to design a self-calibrating prayer clock based on Arduino board that overcomes the limitations of the existing models.

Design Features Specifically, the self-calibrating clock will have the following features: Display date, time, temperature, prayer times and time to IQAMA. Auto-detect settings (i.e., location, date, time and prayer times). Automatic calibration of date and time at predefined regular intervals to account of internal timer errors. Auto synchronization between individual devices at the same city.

Design Interface The interface of the self-calibrating prayer clock (Figure 1) consists of the following component: 6 seven-segment display digits to display the current time. 2 seven-segment display digits to display the room temperature as well as the time to IQAMA. 4 seven-segment display digits to display the ATHAN time for FAJR prayer. 4 seven-segment display digits to display the SUNRISE time. 4 seven-segment display digits to display the ATHAN time for DHUHR prayer. 4 seven-segment display digits to display the ATHAN time for ASR prayer. 4 seven-segment display digits to display the ATHAN time for MAGHREB prayer. 4 seven-segment display digits to display the ATHAN time for ISHA prayer. 7 LEDs to display the current day of the week.

Figure 1: Prayer clock interface.

Design Component The required component of the complete project can be grouped as follows: Microcontroller board. Location detection system. Configuration and calibration system. Display system.

Design Component Microcontroller Board The self-calibrating prayer clock will be designed based on Arduino Uno board shown in Figure 2. Figure 2: Arduino Uno board.

Design Component Location Detection System In order to configure /calibrate the self-calibrating clock, we need a mechanism to automatically determine the location where the clock is installed. One option is to use a GPS shield (Figure 3). Figure 3: GPS shield form Sparkfun.

Design Component Configuration/Calibration System After determining the location of the self-calibrating prayer clock, it can be automatically configured/calibrated by accessing a dedicated server that will provide the clock with the required information (i.e., current date and time as well as prayer times). In order to access the server, we need to use a WiFi shield shown in Figure 4. Figure 4: WiFi shield.

Design Component Display System The display system consists of two types of digital outputs: Simple LEDs to indicate the current day of the week. Seven-segment display digits to display date, time, temperature, ATHAN times, and time to IQAMA. The display system requires a large number of display digits (40 seven-segment display digits). Hence, we need to use an efficient implementation of display digits in order to minimize the required connections and simplify the display control. One option is to use the MAX7219 based serial seven segment display module which allows you to add 8 digits of seven segment displays to your project using (Figures 5-6)

Figure 5: SPI 7-Seg Display. Figure 6: Interfacing the SPI display with Arduino

Design Phases The project consists of three main phases: Designing the clock interface and operation system. Designing a tentative clock configuration/calibration system by reading required information from an SD card file. Designing the final clock configuration/calibration system using GPS and WiFi shields. In this semester, students will design and program the first and second phases. The third phase will be designed and programmed by another group of students in the next semester.

Design Requirements (Phase I & II) The main design requirements of the first and second phases of the project are given below: Designing the interface of the self-calibrating clock according. Interfacing and programming the temperature sensor system. Programming the tentative clock configuration and calibration logic. Programming the time logic. Programming the ATHAN times logic. Programming the time to IQAMA logic.

Design Requirements (Phase I & II) Interface Design Design the interface of the self-calibrating clock according to Figure 1. The MAX7219 based serial seven segment display modules can be interfaced to the Arduino board as shown in Figure 7. The module has three control inputs: CLK, Din, and CS. Each module requires a separate CS connection. All modules will share the same CLK and Din connections. It is recommended to consecutive pins starting from pin 0 (i.e., 0, 1, 2, …, etc.) to control the CS lines of the modules.

Figure 7: Interfacing two modules of the MAX7219 based serial 7-segment display. Module 0 Module 1 1 2 3 4 5 6 7 8 ------------------------------------- digits

Design Requirements (Phase I & II) Interface Design Programming The MAX7219 based modules is very simple: The Maxim-Integrated company provided the necessary codes to initialize and control these modules as shown in Figure 8 (a-e). The parameters that needs to be adjusted by the user are the first three global variables: maxInUse din clk In your program, you can use the following function to display the value 5 on the 3rd digit of the 1st module (module 0): maxSingle(0, 3, 5);

Figure 8 (a): Global variables of the MAX7219 modules. // global variables for the MAX7219 modules int maxInUse = 2; // number of MAX7219 modules to be used int din = 2; // Arduino pin connected to Din of the MAX7219 int clk = 3; // Arduino pin connected to CLK of the MAX7219 // define max7219 registers byte max7219_reg_noop = 0x00; byte max7219_reg_digit0 = 0x01; byte max7219_reg_digit1 = 0x02; byte max7219_reg_digit2 = 0x03; byte max7219_reg_digit3 = 0x04; byte max7219_reg_digit4 = 0x05; byte max7219_reg_digit5 = 0x06; byte max7219_reg_digit6 = 0x07; byte max7219_reg_digit7 = 0x08; byte max7219_reg_decodeMode = 0x09; byte max7219_reg_intensity = 0x0a; byte max7219_reg_scanLimit = 0x0b; byte max7219_reg_shutdown = 0x0c; byte max7219_reg_displayTest = 0x0f;

Figure 8 (b): Function to send one byte serially to MAX7219 modules. // sends one byte serially through Din of the MAX7219 modules void putByte(int data) { int i = 8; int mask; while(i > 0) { mask = 0x01 << (i - 1); digitalWrite(clk, LOW); if ( ( data & mask ) != 0 ){ digitalWrite(din, HIGH); } else{ digitalWrite(din, LOW); VBBWait(); digitalWrite(clk, HIGH); --i;

Figure 8 (c): Function code to write to a single MAX7219 module. // writes to a single MAX7219 module void maxSingle(int cs, int reg, int col) { digitalWrite(cs, LOW); putByte(reg); putByte(col); digitalWrite(cs, HIGH); VBBWait(); } Figure 8 (d): Function code to write to all MAX7219 modules. // writes to all MAX7219 modules in the system void maxAll (int reg, int col) { for (int cs = 0; cs < maxInUse; cs++) { digitalWrite(cs, LOW); putByte(reg); putByte(col); digitalWrite(cs, HIGH); VBBWait(); }

Figure 8 (e): Function to initialize the MAX7219 modules. // initializes the MAX7219 modules void initMAX7219(){ VBBInit(6); maxAll(max7219_reg_scanLimit, 0x07); maxAll(max7219_reg_decodeMode, 0xFF); maxAll(max7219_reg_shutdown, 0x01); maxAll(max7219_reg_displayTest, 0x00); for (int e = 1; e <= 8; e++) { maxAll(e, 0); } maxAll(max7219_reg_intensity, 0x0f & 0x0f);

Design Requirements (Phase I & II) Display Room Temperature Interface a temperature sensor (TMP36) to one of the analog pins of the Arduino board as done in Experiment 08. Program the Arduino board to read the temperature sensor and display room temperature using two 7-segment display digits. Note that the same two 7-segment display digits will be used to display the time to IQAM at each prayer time (i.e., ATHAN time). After IQAMA, the two 7-segment display digits will be used again to display the room temperature until the next prayer time.

Design Requirements (Phase I & II) Tentative Clock Configuration/Calibration Program a tentative clock configuration and calibration system by reading the required information from a file on the SD card. An example of the file format is given in Figure 9: Line 1: current time Line 2: FAJR prayer time Line 3: SUNRISE time Line 4: DHUHR prayer time Line 5: ASR prayer time Line 6: MAGHREB prayer time Line 7: ISHA prayer time Line 8: current day index (0-6: Sunday – Friday) Line 9: current date

Figure 9: Format of the prayers data file. 03:03:49 04:35 05:57 12:16 03:47 06:35 08:05 1 07/04/2014

Design Requirements (Phase I & II) Tentative Clock Configuration/Calibration The code required to read configuration and calibration information file is given in Figure 10 (a-e). The self-calibrating prayer clock system needs to read the file at startup time as well as on some predefined interval (say every 24 hours). After reading the file, the system will start running the time, ATHAN and IQAM logics (i.e., design requirements 4, 5, and 6). The user needs only to call the calibration function, and then use the variables: time, date, day, and prayers.

Figure 10 (a): Global variables for configuration/calibration. // current time variable int [] time = {0,0,0,0,0,0}; // prayer times variable int [][] prayers = { {0,0,0,0}, {0,0,0,0} }; // current date variable int [] date = {0,0,0,0,0,0,0,0}; // current day index variable int day; // file variable File f;

Figure 10 (b): Function to initialize SD file. boolean initSDFile() { if( !SD.begin(4)) { return false; } f = SD.open(“prayers.txt”); if( f == null) { return true; Figure 10 (c): Function to close SD file. // close SD file void closeSDFile() { f.close(); }

Figure 10 (d): Function to convert character to integer. // converts character to integer int toInt(char c) { int number = 0; switch(c) { case '0': number = 0; break; case '1': number = 1; break; case '2': number = 2; break; case '3': number = 3; break; case '4': number = 4; break; case '5': number = 5; break; case '6': number = 6; break; case '7': number = 7; break; case '8': number = 8; break; case '9': number = 9; break; default: number = 0; } return number;

Figure 10 (e): Function to read configuration/calibration information. // reads configuration/calibration information void calibrate(){ initSDFile(); // read time for (int i = 0; i < 6; i++) { time[i] = readInt(); } // read prayer times for (int j = 0; j < 4; j++) { prayers[i][j] = readInt(); // read day day = readInt(); // read date for (int i = 0; i < 8; i++) { date[i] = readInt(); closeSDFile();

Design Requirements (Phase I & II) Time Logic After calibration, the self-calibrating prayer clock system will display the time, date, temperature, and prayer times. Then, the system will update and display the time every second.

Design Requirements (Phase I & II) ATHAN and IQAMA Logics After calibration, ATHAN logic will display the ATHAN time for every prayer. When it is the ATHAN time for a particular prayer, ATHAN logic will start blinking the display of the particular prayer time (Figure 11). At the same time, IQAMA logic will start by displaying time to IQAMA. IQAMA logic will decrement time to IQAMA every minute and display the remaining time. Once the time to IQAMA reaches 0, ATHAN logic will stop blinking the prayer time and IQAMA logic will display the temperature.

Figure 11: ATHAN and IQAMA logics