Você está na página 1de 54

GSM Based Faculty Student Console

Malik Husnain Riaz M.Hussaan Saeed S.M.Jawad Azeem Rizvi Siraj ul Haq

December 2011

Department of Electrical Engineering COMSATS INSTITUTE OF INFORMATION TECHNOLOGY LAHORE PAKISTAN

Submission Form for Final-Year

PROJECT REPORT
PROJECT ID 22 NUMBER OF MEMBERS 4

TITLE

GSM Based Faculty Student Console Sir Saqib Sallahudin/ EXTERNAL

SUPERVISOR NAME

MEMBER NAME Malik Husnain Riaz M.Hussaan Saeed S.M.Jawad Azeem Rizvi Siraj ul Haq

REG. NO. Bte-sp08-25/A Bte-sp08-31/A Bte-sp08-47/A Bte-sp08-53/A

EMAIL ADDRESS Husnain.riaz89@gmail.com Hussaan.saeed@gmail.com seejawad@yahoo.com themask_3004@yahoo.com

CHECKLIST: Number of pages in this report I/We have enclosed the soft-copy of this document along-with the codes and scripts created by myself/ourselves My/Our supervisor has attested the attached document I/We confirm to state that this project is free from any type of plagiarism and misuse of copyrighted material

YES / NO

YES / NO

YES / NO

MEMBERS SIGNATURES

Supervisors Signature

Note 1: This paper must be signed by your supervisor Note 2: The soft-copies of your project report, source codes, schematics, and executables should be delivered in a CD

COMSATS Institute of Information Technology, Lahore Campus

Department of Electrical Engineering

This work, entitled GSM Based Faculty Student Console has been approved for the award of

Bachelors in Electrical Engineering

Date 23-12-2011

External Examiner:

Head of Department:

Department of Electrical Engineering

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY


LAHORE PAKISTAN

Declaration
We declare that no portion of the work referred to in the document has been subjected to plagiarism, all the work herein is our own with little help from the literature and this is solely for the degree mentioned in the thesis from this institution.

MEMBERS SIGNATURES

Acknowledgements

In the name of God, the most kind and most merciful, without His blessing it cannot be possible for us to complete our project GSM based faculty student console. May He bless us with all the resources and the guidance for making us able to work for the welfare of humanity.

We would like to thank our parents and our all other family members who kept backing us up in all the times, both monetarily and morally

We are grateful to our project advisor Mr. Saqib Salahudin for his constant guidance, support, friendly behaviour and encouragement for working hard made us able to achieve this milestone. His critical views were the most helpful thing while doing this dissertation work and the project.

We are thankful to our class mates for their assistance, advices and group discussions. Their help directly or indirectly was really supportive for this task completion.

Abstract

Wireless communication was always been a challenge for scientists but as technologies evolves scientists and engineers have defined new dimensions for themselves. Their main emphasis has now gone to create products for making human life unproblematic as it was never before. This project is one of those projects that help others to think about serving humanity in this new way i.e. the ease of communication in the academic scenario. This project is on the subject of wireless transmission of personal data keeping privacy and time saving aspect alive. This project illustrates why and how GSM technology is being used for the purpose of time saving and privacy. This system accomplishes two main functions, one is the short message delivery and the other is the transmission of e-mail. This system resembles to a cellular phone with privacy as its main intention. This system is a user friendly system. Since this project is dedicated to academic purpose, user dont need to have teachers cell number or e-mail address to send SMS or mail respectively. Sometimes teacher vacillate to share its personal contacts with students that causes a communication gap between these two classes. This project utterly resolves this issue with efficiency and speed. This project will open new path and school of thought for the new generations to follow.

Table of Contents
DECLARATION ................................................................................................................................. II ACKNOWLEDGEMENTS .............................................................................................................. III ABSTRACT ....................................................................................................................................... IV 1 2 INTRODUCTION ....................................................................................................................... 1 LITERATURE REVIEW ............................................................................................................ 3 2.1 2.1.1 2.1.2 2.2 2.2.1 2.2.2 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.5.2 2.5.3 2.6 3 BACKGROUND ........................................................................................................................ 3 Market survey.................................................................................................................... 3 Technological ease ............................................................................................................ 3 WIRELESS TECHNOLOGY......................................................................................................... 3 Uses of wireless technology ............................................................................................... 4 Mobile communication ...................................................................................................... 4 GSM/GPRS TECHNOLOGY ..................................................................................................... 4 SMTP ................................................................................................................................ 4 GSM modem...................................................................................................................... 5 AT COMMANDS ...................................................................................................................... 5 Basic syntax ...................................................................................................................... 5 S parameter syntax ............................................................................................................ 6 Extended syntax................................................................................................................. 6 CONTROLLING DEVICES .......................................................................................................... 6 Introduction ...................................................................................................................... 6 Interfacing......................................................................................................................... 7 Serial communication ........................................................................................................ 7 SUMMARY ............................................................................................................................. 7

SYSTEM DESIGN....................................................................................................................... 8 3.1 3.2 3.3 3.4 3.5 SYSTEM OVERVIEW ................................................................................................................ 8 METHODOLOGY ..................................................................................................................... 8 INPUT AND OUTPUT MODULES .............................................................................................. 10 CONTROLLER ....................................................................................................................... 10 GSM M ODULE ..................................................................................................................... 10

IMPLEMENTATION................................................................................................................ 11 4.1 4.1.1 4.1.2 MAIN COMPONENTS ............................................................................................................. 11 Centralized controller...................................................................................................... 11 Display module ............................................................................................................... 12

4.1.3 4.1.4 4.1.5 4.1.6 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.3 5 6

Input module ................................................................................................................... 12 MAX232 .......................................................................................................................... 13 The SIM900D GSM Module............................................................................................. 13 Power Supply .................................................................................................................. 14 INTERFACING ....................................................................................................................... 14 LCD interface.................................................................................................................. 14 Interfacing keypad ........................................................................................................... 15 Interfacing GSM module.................................................................................................. 15 Serial Communication ..................................................................................................... 16 SYSTEM INTEGRATION .......................................................................................................... 17

EVALUATION AND TESTING ............................................................................................... 18 CONCLUSIONS & FUTURE WORK ...................................................................................... 23 6.1 6.2 CONCLUSION........................................................................................................................ 23 FUTURE WORKS ................................................................................................................... 23

REFERENCES .......................................................................................................................... 24

APPENDIX A: HDL OR C SOURCE CODE ................................................................................... 25 APPENDIX B: LIST OF COMPONENTS ........................................................................................ 43 APPENDIX C: PROJECT TIMELINE............................................................................................. 44 PROPOSED TIME LINE: ....................................................................................................................... 44 PRACTICALLY IMPLEMENTED TIMELINE: ............................................................................................ 45

Table of Figures
F IGURE 3-1 BLOCK DIAGRAM ................................................................................................................. 8 FIGURE 3-2 FLOW CHART OF SYSTEM ....................................................................................................... 9 F IGURE 4-1 PIC 18F452 PIN OUT ........................................................................................................ 11 F IGURE 4-2 16X2 LCD ........................................................................................................................ 12 F IGURE 4-3 4X4 KEYPAD ..................................................................................................................... 12 F IGURE 4-4 MAX232 INTERFACED WITH MICROCONTROLLER .............................................................. 13 FIGURE 4-5 POWER SUPPLY FOR GSM MODULE ..................................................................................... 14 F IGURE 4-6 5 VOLT POWER SUPPLY .................................................................................................... 14 F IGURE 4-7 COMPLETE PCB DESIGN ................................................................................................... 17 F IGURE 5-1 LCD TESTING.................................................................................................................... 20 F IGURE 5-2 KEYPAD TESTING WITH CONTROLLER AND LCD ................................................................. 21 F IGURE 5-3 THE COMPLETE INTERFACING DIAGRAM ............................................................................. 22

1 Introduction
As wireless technology is growing rapidly, people are anticipating much more product outputs from this technology. This project is solely wireless communication based project that meets all the requirements of the modern world. It provides communication between a faculty member and a student keeping faculty members personal information hidden. The main aspiration of the project is to investigate how GSM technology plays the important role of making human life easier. This project has been dedicated for student faculty wireless console. Student can communicate his teacher at any time without knowing his number or email address. This provides wireless connectivity 24/7. The research includes devising possible improvements in student-faculty

communication system. Student faculty communication has an important impact on our educational system. In those environments where there is less interaction between teachers and students there possibly have less chances of knowledge transfer from teachers to students. For instance, on occasion a student has a query in his mind he just walk off straight to his teacher or advisor to talk about that but the teacher was not available at that time, what he would think? Student may think: I should try again later. But if he get continues failure in that because of office timings or any other problem he may become hopeless. Student may give it up forever. Student may think that he is not worthy enough to talk to a teacher. All these problems create doubts in students mind that leads to low standard education and non creative thinking. This phenomenon happens quite often in common life and this project is the simplest solution to this problem. This project primarily provides two options to the user; one is to send SMS using keypad or to send E-mail. Keypad used here works just like a cell phones keypad. Student will type his message and send to the destination address that has already been stored in the system. So the teachers privacy will remain intact. Architecture-wise this project consists of an LCD and a keypad. Internally, there is a microcontroller based central processing unit, and a GSM modem. Microcontroller will control all the inputs and functioning of our system, while the GSM modem will work to deliver SMS and mail as programmed in the microcontroller. In this project PIC18F452 is used as microcontroller based central processing unit and SIM900D as GSM modem. This system will be placed outside teachers cabin.

The project includes development of software to use GSM modem for transmitting and receiving data, the programming of LCD such that it will print all characters on screen in order and the programming of keypad such that it will behave like a cell phones keypad. Mobile keypad works in such a way that if we press first button it will show a dot but pressing it again within limited time it will print , or any other symbol as programmed. Similarly for Alphabets: if a student press a button once it will be displayed on screen but within given time if user press it twice or thrice youll get b or c respectively. To send the message there is a little different scenario as compared to the scene of sending a mail. Both, obviously, requires a different set of AT commands to operate. In case of SMS one should apply such commands on GSM modem to make it in writing mode (as discussed in appendix source code). Similarly for accessing a web page for the sake of mail transmission one needs a set of AT commands. Some of the main advantages of this project are: y Short message delivery y E-mail delivery y Wireless connectivity 24/7 y GSM technology is a reliable way to connect wirelessly y Time saving, privacy, reliability and a user friendly device is the main theme of the project y Use of GSM modem for the purpose of connecting our device to the GSM network and enable it for transmitting /receiving data y Use of Microcontroller PIC18f452, cheaper in cost and it can be re-programmed up to 100,000 times. This controller requires just 5v battery, 4 MHz crystal oscillator and 22pF capacitors so that it can start its work y Learning aspect: core electrical engineering concepts are involved. y Portable integrated system, because of its compact size, portability is easier. You can use it anywhere you desire. That will enhance its acceptance at industry level y Easy conversion to other useful systems like electronic notice board and complaint box

2 LITERATURE REVIEW
2.1 Background
Basically one of the core objectives of this project is to replace manual system. Display digitally gives a better preview. In this modern era there are just countable things left in our lives that works manually, all other things have been changed according to the style of modern age. This project is based on digital wireless communication of data, work faster and cheaper in cost. In markets this technology has not yet been used, so one may call this an entrepreneurial thought. 2.1.1 Market survey

There are some devices available in market that uses almost the same technology and similar in purpose. But they are either too costly, inefficient or rarely used devices. Efficiency always matters in electronics. The proposed device has to be less power consuming, providing long ranged operation as the consumers would like. Notice board that may work digitally is one of the similar devices to this device. Other device may be a security system that works on GSM. Notice board, for example, is a very costly device with just a purpose to show important notes, replacing a manual notice board is not acceptable device. Above mentioned project has no other application then representation of data in digital form. It will use almost the same resources as the project student console. But the project student faculty console has variety of applications available. It can even be turned to a digital notice board with a little modification, so the cost on it can be justified. 2.1.2 Technological ease

With the evolution of technology, GSM usage rates are declining considerably. This provides great ease for all the type of consumers to afford it. This device is also so much user friendly, everyone who knows how to use a mobile phone can use it without any difficulty. Even for lay men it is so easy to use; people just need one time briefing for how it works.

2.2 Wireless technology


Wireless communication is the transmission of information between two or more stations that are not connected using any physical media i.e. cables. For long distance

wireless communication word telecommunications is used. Benefit of wireless communication is that we are able to transmit our data where there is not the possibility of cables. [1] 2.2.1 Uses of wireless technology

There can be many uses of wireless technology, the prime uses may be Information access and distribution, PDAs, Network computers, Web usage, Audio and video transmission. 2.2.2 Mobile communication

Basic cellular system is made up of three types of systems 1-mobile stations 2-base stations 3-mobile switching centre (MSC) Mobile station is built in portable device which contains a transceiver; base station is used to connect all mobile users in a cell to the MSC using microwave link or PSTN.

2.3 GSM/GPRS technology


Global system for mobile (GSM) is 2G standard for cellular systems. It was the worlds first cellular system that uses digital modulation. From user point of view the most prominent feature of GSM was SIM (subscriber identity module). SIM is a memory device that stores user information and hence gives uniqueness and identity to all GSM cell phones. Other feature may be the privacy while data is going through air. General packet radio service (GPRS) is basically a packet based system and it is commonly used for non real time internet surfing including the retrieval of email, asymmetric web browsing as well as faxes. Asymmetric web browsing refers to the way of internet usage in which we can download much more data as compared to upload. GPRS supports multi-user network sharing of individual radio channels and time slots unlike HSCSD, GPRS can carry many more users than HSCSD, but in burst manner [1]. 2.3.1 SMTP

Simple mail transfer protocol (SMTP) is a protocol used for email over internet. Email submitted by mail client to mail server using TCP and port 25. Detail of SMTP protocol is given below.

First client is connected to the SMTP server. There are few mail headers and commands send by the client in SMTP protocol. [9] HELO Sender Host Name\r\n MAIL FRM: source@example.com\r\n RCPT TO: destination@example.com\r\n DATA\r\n SUBJECT: <STRING>\r\n <Message String>\r\n .\r\n QUIT\r\n 2.3.2 GSM modem

GSM modem is basically a focused type of modem which works on GSM network using SIM card. This modem is quite similar to the mobile phone as it allows short messaging as well as internet connectivity. We have used SIM900D GSM modem for communication purpose in our project. It works on GSM 850 MHz, EGSM 900MHz, DCS 1800MHz and PCS 1900MHz.

2.4 AT commands
AT commands are used to communicate with GSM modem these commands are forward to modem serially then modem perform actions accordingly. Syntax to write AT is: The "AT" must be set at the start of each Command line. To terminate a Command line enter <CR>. All these AT commands can be divided into three types: basic, S parameter, and extended [7]. These are as follows: 2.4.1 Basic syntax

These AT commands have the syntax like AT<x><n>, or AT&<x><n>, where <x>is the Command, and <n>is/are the argument(s) for that Command. Basically these Commands do not start with + sign e.g. ATD: For Dialing a Number ATE: For setting Echo. ATA: For answering a call.

2.4.2

S parameter syntax

These AT commands have the format of ATS<n>=<m>, where <n> is the index of the S register to set, and <m>is the value to assign to it. <m> is optional; if it is missing, then a default value is assigned. 2.4.3 Extended syntax

These commands are written in several modes. First is test command which is written as AT+<x>=? And response to this command is The mobile equipment returns the list of parameters and value ranges set with the corresponding Write Command or by internal processes. Second is read command whose syntax is AT+<x>? And response is This command returns the currently set value of the parameter or parameters Third one is Write command syntax for this one is AT+<x>=<> and in response this command sets the user definable parameter values Fourth one is Execution command which is written as AT+<x> and in response the execution command reads non-variable parameters affected by internal processes in the GSM engine Extended Commands start with a + sign e.g. AT+CMGS: Send SMS AT+CMGF: Select Message Format AT+CPMS: Preferred SMS Storage AT+CMGD: Delete SMS

2.5 Controlling devices


2.5.1 Introduction

A microcontroller is a single chip device on which a microprocessor is integrated with components of a microprocessor system like RAM (Random Access Memory), ROM (Read Only Memory), I/O (Input Output functions) and various other circuits. The onboard system used here is a PIC 18f452 microcontroller. It features 256 bytes of EEPROM data memory
[4]

and it is programmable. All of its features make it ideal for

more advanced level A/D applications in the industry.

2.5.2

Interfacing

Interfacing is basically a transfer of information by synchronising different devices; we did these major interfaces in our project:

y y y 2.5.3

Interfacing of different components with microcontroller Data transfer of SMS using GSM modem Data transfer of mail using GSM modem with AT commands Serial communication

Serial communication is used for testing project on computer. Built-in software of windows XP named hyper terminal is used for this purpose. One needs to synchronise a computer with the other connecting device in order to send or receive data. For this purpose, baud rate is set between the two communicating devices. Baud rate is the rate of communication as in serial communication data is sent bit by bit. Another important thing to mention here is the use of level convertor. For serial communication we have to manage the transmit power levels, for that particular reason the IC max232 is used.

2.6 Summary
Since wireless technology is the main emphasis in this project, the above mentioned literature has the key importance in developing this idea into the real form. There is nothing available in market that is comparable to this device in terms of range of operation, cost and efficiency. Its a learning based project using all the concepts of technical subjects of electrical engineering that includes electronics, wireless data communication and microprocessors as the main insight.

3 System Design
In this chapter a complete architecture of device is explained. The core element of our design is controller and all other components are interfaced with it. The design consists of three main parts in first part input and output modules are interfaced with controller, second part consist of communication with GSM modem and third one is for testing which consists of serial communication through hyper terminal, by which at commands are tested easily and easily implemented

3.1 System overview

Figure 3-1 Block diagram

3.2 Methodology
Project has divide into five different phases of completion. First phase is of gathering all the information about this project, the components used and also reviewing the literature. Second phase comprises of testing and interfaceing of output module used in this project. In third phase input module is tested and interfaced. Fourth is the main phase of this project in which the wireless communication module is tested and interfaced with central controller through set of defined commands. In this phase all the other componets which are tested separetly also interfaced with central controller. With the completion of this phase the objectives of project are achieved. Fifth phase is

dedicated to written work organization and summerization which is started with the first phase. Fifth phase is converting all work done in this project into written form. This phase was initialized from the very first day. Compilation of all results and arranging all methods used in project implementation onto a document took some time as well

Figure 3-2 Flow chart of system

3.3 Input and Output modules


Input block gives text formate input to the controller. This bolck control functions performed by the controller and provide an human interface. User provides data that he wants to send through this input module. Output block was used to display data input by the user. This module provides a visual of action performed by the user.

3.4 Controller
This block provides processing of inputs given by the user and perform action accourding to these input. Controller also give instruction to the output module to provide visual to the user.

3.5 GSM Module


GSM module was use to communicate over the GSM technology. This module controlled by the controller, on the bases of the inputs given by the user. User selection configures the functionality of this module either mail or message. .

4 Implementation
This chapter describe implement procedure of the project. How components are interface with the centralize controller.

4.1 Main components


The main components for input output and control are given below:

4.1.1 Centralized controller


Action performed by the controller describe in pervious chapter was done with the help of PIC microcontroller.

PIC microcontroller is used as processing unit. It controls all the inputs and output. PIC family have a large number of controllers. Microcontroller used here in this project is PIC18F452. This microcontroller helps multiple peripheral devices to handle at the same time without multiplexing [4]. Input module was connected with PORTD and output module was connected with the PORTB. Third component which is GSM module was connected with the port dedicated for the serial communication.

Figure 4-1 PIC 18F452 pin out

4.1.2 Display module


First display module is implemented using Liquid Crystal Display (LCD). LCD is a visual display device used to display different types of data e.g. Characters, graphical etc. The LCD found suitable for this project is a character LCD which shows 16characters per line in 2 lines. LCD used in this project is 16x2. First we implement the circuit on software to assure the perfect working of this part in this project. It is connected to PORTD of microcontroller. Few set of commands are used to display a single character on LCD so some part of code is also done in this part. This LCD can be easily interfaced with any port of the microcontroller.

Figure 4-2 16x2 LCD

4.1.3 Input module


Next step was to implement input module. Keypad was used for this purpose. Microcontroller receives input from keypad and performs actions accordingly. 4x4 keypad used in this project. 4x4 keypad is design in such way that it gives an 8bit input to the microcontroller. Microcontroller process this input and select value accordingly.

Figure 4-3 4x4 Keypad

4.1.4 MAX232
This phase of implementation was to implement serial communication module. MAX232 is an Integrated Circuit from MAXIM. It converts the RS232 voltage levels to TTL Compatible logic levels. This conversion is necessary if RS232 serial devices are to be connected with TTL compatible devices i.e. Microcontrollers or PCs (Hyper Terminals) etc. The capacitors used are of 10 F each. They are used in the circuit to reduce noise in the circuit. The serial connector used is DB9 Female Connector. Its pin configuration is as follows.

Figure 4-4 MAX232 interfaced with microcontroller

[6]

4.1.5

The SIM900D GSM Module SIM900D is a GSM/GPRS modem that works on frequencies, GSM 850 MHz, EGSM 900MHz, DCS 1800MHz and PCS 1900MHz. It is very small and light weight module and can be used for a vast variety of applications. It is a slave device with 68 pins and can be configured/controlled with its AT (Attention) Commands to send and receive SMS, send and receive calls and GPRS connectivity. This chip is embedded on a circuit board from which 8 pins are given out from which only 5 are by us. Power key, Rx, Tx, voltage and GND. Pin lay-out is given in datasheet [5]

4.1.6

Power Supply

Project requires two different voltage levels i.e. 3.7 volts power supply[10] for GSM module and 5 volts power supply for remaining circuitry. Circuit diagram are given below.

VI ADJ

VO

RV1

+ 12v

C1
1000uf

C2
1000uf POT

R1
1k

C3
1000uF

+ 3.7v

Figure 4-5 Power Supply for GSM module

Five volt power supply required following circuit.

VI GND

VO

R1 C3
1000uf 1k

+ 12v

C1
1000uF

C2
1000uF

+ 5v

Figure 4-6 5 volt Power Supply

4.2 Interfacing
All the interfacing descriptions of this project are:

4.2.1

LCD interface

16x2 LCD is used in this project. As described in previous chapter LCD contains 16 pin in which 4 pin is used for data. 3 pins are controlling pins (RS, EN, R/W). All these 7 pins attached with the microcontroller. Microcontroller displays data by sending

different bits on 4 data pins. LCD is connected with the PORTB of the microcontroller. First we use a very simple code to check the working of the LCD. First the port of the Microcontroller is Initialized which is connected with the LCD. After this the LCD is initialized. Then the screen is cleared to remove all garbage values and the curser is set to off. After that the data is sent to the LCD as a string to display it. 4.2.2 Interfacing keypad

4x4 Keypad is used and with the help multiplexing it works as mobile keypad used in most mobiles we used in our daily life for writing short messages. Multiplexing means single key is used for multiple tasks. For example in mobile if 1 is pressed single time then the output will be .. And if pressed it twice the output will be 1. Likewise if same procedure runs on second button for example 2 is pressed single time then its outcome will be a, if pressed twice the output will changed to b, and if it press one more time within a specific time period output changed to c and fourth try will change it to 2 and so on for other keys. This function implement in a simple 4x4 keypad by efficient use of programming skills. Microcontroller checks the output for the specific interval of time and if a key is press multiple times that set the output accordingly. Port D of microcontroller is assigned for this purpose. Keypad which is used in this project is of 16 keys only but it can handle more the 40 keys by multiplexing. 4.2.3 Interfacing GSM module

As describe earlier GSM module is working through serial transmission of ATcommands. SIM900D is the GSM module used in this project. Microcontroller pin 25 and pin 26 is dedicated for serial communication. Pin number 25 is Tx (Transmit) pin and pin number 26 is Rx (receive) pin. SIM900Ds Rx pin is connected to the microcontrollers 25th pin which is Tx (transmit) pin and Tx pin is connected to the microcontrollers 26th pin which is Rx (receive) pin. Now series of AT-Command is transmitted to control working of the modem.
SMS

GSM module was connected to microcontroller serially. For SMS series of ATCommand was send to the module. Each AT-command activates a feature in GSM module. For message following feature was activated y Select TEXT mode

y y
Mail

Send destination Mobile phone number Send body of the message

To send an Email detailed knowledge of SMTP was required. SMTP client part was defined in the microcontroller. First step was to configure GPRS in GSM modem by following given procedure y y y y y y y Attach GPRS Define PDP context Set primary and secondary DNS <Domain name Server> Set ANP, User ID, Password Get local IP Address Start up TCP connection Send commands

Second step was to connect with SMTP server. SMTP server address for yahoo is smpt.mail.yahoo.com. After connected with the SMTP server data was send in similar format describe above. 4.2.4 Serial Communication

Serial communication is required to communicate with SIM900D. To check serially transmit data from the microcontroller and to check communication with the SIM900D. Project requires designing circuit as described in previous chapter. Connected the circuit with computer using serial cable and receive and transmit different bytes to check the working of the circuit. This circuit is also connected to the SIM900D check either modem is working normally. Sent AT command to sent SMS and connect with GPRS.

4.3 System integration


Now the next and final steps are to join these parts together. In start this project implemented on software (PROTEUS). After the successful outputs it is implemented on bread board. Next step is to design PCB this step is done by the help of software (Easy PCB). And then finally it is implemented on PCB board.

Figure 4-7 Complete PCB design

5 Evaluation and Testing


Numbers and other detail of faculty member is already programmed in microcontroller user input the message or mail what he want to send and select the name of faculty member to whom he wants to send and then send it. First task of this project is to initialize GSM module then it searches the particular network for connections as connection established indicated by LED, GSM module is ready to receive AT commands from controller. Then by initializing the controller firstly microcontroller send AT commands to GSM module to check the connectivity between them. GSM also send an acknowledgment to controller to assure that it is ready to receive data. Afterwards a message is displayed on LCD for the user to select either if wants to mail or send a short message. Hyper terminal testing screen shots are given:

Figure 5-1 Message sending through hyperterminal

Figure 5-2 GPRS connectivity using hyperterminal

As described in the earlier chapters that this project completed in five phase, which are first tested on software and bread boards. First phase of this project is to interface LCD with microcontroller before implementing on the bread board it is tested on Proteus, desired outputs are obtained. After that hardware implementation procedure started. Interface LCD and microcontroller on bread board. In this procedure some ambiguities are faced. Power is properly supplied to the LCD. 16th pin of the LCD requires power through potential meter. Now a small MikroC code is run for testing it displays HELLO on the LCD. This will confirm the proper working of the LCD.

LCD

VSS VDD VEE

RS RW E 4 5 6

1 2 3

U1
13 14 1 2 3 4 5 6 7 8 9 10 OSC1/CLKIN OSC2/CLKOUT MCLR/Vpp/THV RB0/INT RB1 RB2 RB3/PGM RB4 RB5 RB6/PGC RB7/PGD 33 34 35 36 37 38 39 40 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30

R1
PULLUP

RA0/AN0 RA1/AN1 RA2/AN2/VREFRA3/AN3/VREF+ RA4/T0CKI RA5/AN4/SS RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RE0/AN5/RD RC2/CCP1 RE1/AN6/WR RC3/SCK/SCL RE2/AN7/CS RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 PIC16F877

Figure 5-3 LCD testing

Next step was to interface keypad with the microcontroller. Hardware design was very simple for keypad. First keypad was checked with a simple mikroC code for 4x4 keypad but requirement in this project was a mobile like keypad. So multiplexing was required. This was done with the help of programming. First code was implemented for single key. Check working of the key. Either it was shifting its output within specific interval of the time. This procedure was required sophisticated programming. Keeping check on the key either it was pressed again within a specific interval of time.

7 8 9 10 11 12 13 14

D0 D1 D2 D3 D4 D5 D6 D7

LCD

VSS VDD VEE

RS RW E 4 5 6

1 2 3

U1
13 14 1 2 3 4 5 6 7 8 9 10 OSC1/CLKIN OSC2/CLKOUT MCLR/Vpp/THV RB0/INT RB1 RB2 RB3/PGM RB4 RB5 RB6/PGC RB7/PGD 33 34 35 36 37 38 39 40 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30

R1
PULLUP

RA0/AN0 RA1/AN1 RA2/AN2/VREFRA3/AN3/VREF+ RA4/T0CKI RA5/AN4/SS RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RE0/AN5/RD RC2/CCP1 RE1/AN6/WR RC3/SCK/SCL RE2/AN7/CS RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 PIC16F877

7 4 1
ON C
1

8 5 2 0
2

Figure 5-4 keypad testing with controller and LCD

As GSM technology was used in this project so the core component is GSM module. As describe earlier SIM900D by SIMCOM was use in this project. This module is controlled using AT-Commands. First Testing procedure was run on modem by connecting it with computer. GSM module receives data serially so modem connected with the computer using MAX232. And transmit data using hyper terminal. SIM900D requires a very sophisticated power supply. 3.7 volts is required to operate this modem. Circuitry required for such power is show in previous chapters. Second problem faced related to the GSM modem is signal problem. This device is required high signal strength as compared to mobiles used in daily life. When connected to the hyper terminal procedures run to send SMS and mail is shown in diagram below.

7 8 9 10 11 12 13 14

D0 D1 D2 D3 D4 D5 D6 D7

9 6 3 =

After testing GSM modem on hyper terminal we connected it with the microcontroller. Then sent AT-commands serially through microcontroller and checked the output.

LCD

VSS VDD VEE

RS RW E 4 5 6

1 2 3

U1
13 14 1 2 3 4 5 6 7 8 9 10 OSC1/CLKIN OSC2/CLKOUT MCLR/Vpp/THV RB0/INT RB1 RB2 RB3/PGM RB4 RB5 RB6/PGC RB7/PGD 33 34 35 36 37 38 39 40 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30

R1
PULLUP

RA0/AN0 RA1/AN1 RA2/AN2/VREFRA3/AN3/VREF+ RA4/T0CKI RA5/AN4/SS RC0/T1OSO/T1CKI RC1/T1OSI/CCP2 RE0/AN5/RD RC2/CCP1 RE1/AN6/WR RC3/SCK/SCL RE2/AN7/CS RC4/SDI/SDA RC5/SDO RC6/TX/CK RC7/RX/DT RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 PIC16F877

7 8 9 10 11 12 13 14

D0 D1 D2 D3 D4 D5 D6 D7

RXD TXD RTS A

7 4 1
ON C
1

8 5 2 0
2

9 6 3 =
3

CTS

+
4

Figure 5-5 the complete interfacing diagram

6 Conclusions & Future Work


6.1 Conclusion
In the end, we briefly present the conclusion from this project and the possible future improvements for better design/implementation and investigation of GSM based faculty-student console. The main concern of this project is to make some improvement in our educational system. This project has vast applications in various fields, for now this project has been dedicated to a student faculty console. This project helps students to stay in touch with their teacher, student advisor etc. in case of any problem they are facing. This will save precious study time for a student. In industry, this project can be used in a way that it may be place outside the managing directors cabin. In case director is out of office and before going out he has assigned you some work and hes not available to check that. You can simply inform him after completing your work, by using this device. Time saving, privacy and reliability are the subject matter of the project. This system is quite similar to a mobile phone so it is a user friendly device. We did our best to work according to the proposed time line. This project was completed in time with its entire features working correctly.

6.2 Future Works


The designed project is easily convertible to other useful devices. A little modification will turn this project to an electronic notice board, which is also a demanding application nowadays. This notice board can take the place of existing manual system of notification. An electronic complaint box is the other major amendment that can be done so easily using the concepts of this project. The possible changes may convert this project into

y An electronic notice board y Can be connected with databases y Electronic complaint box outside any industry

7 References
1] Theodore S. Rappaport, Wireless Communications Principles and Practice, 2nd Edition 1990 [2]Datacommunication and networking 4th edition by Forouzan [3]SMTP [Online],2011.Available from: http://cr.yp.to/smtp.html [Accessed March 4, 2011] [4]Microchip [Online], 2011. Available from: http:// ww1.microchip.com/downloads/en/devicedoc/39564c.pdf [Accessed March 4, 2011] [5] sim900D [Online],2011 Available from: http://wm.sim.com/sim/frontsho_en/wireless/detail.aspx?cid=6&nid=770 [Accessed October 9, 2011] [6]Cool Circuits Collection [Online], 2011. Available from: http://www.coolcircuit.com/circuit/rs232_driver/ [Accessed on April 15, 2011]. [7]SIM300 datasheet [Online], 2011Available From: http://probots.co.in/Manuals/SIM300.pdf [Accessed on February 15, 2011] http://www.compel.ru/pdf/SIMCOM/SIM900.pdf [8]CISCO [Online], 2011. Available from: http://www.cisco.com/networkers/nw00/pres/2307.pdf [Accessed on September 12, 2011] [9] Developers Home, Introduction to AT Commands [Online], 2004-2011, Available from: http://www.developershome.com/sms/atCommandsIntro.asp [Accessed on March 4, 2011] . [10]LM317 to regulate voltage. [Online], 2011 Available from: www.reuk.co.uk/using-LM317T-to-regulate-voltage.html [Accessed on August,21 2011]. [11] Global System for Mobile Communication, 2011 [online]. Available from: http://www.naavi.org [Accessed on February, 2011]. [12]K.A. Durga Parshanth : Wireless security system base on GPRS, International conference on advance computing, communication and networks11 [13]SIM300D AT Commands [Online], Available from: dsnet.tu-plovdiv.bg/website/container/uploads/SIM300DATC.pdf [Accessed on june 12, 2011 ].

Appendix A: HDL or C Source Code


unsigned short kp=0, cnt, oldstate = 0,oldstate_CAHR=0,ROW1=1,COLM1=1,opt=0; char txt[6],exit=0,COLM; char data_array [32],char_number=1;

// Lcd pinout settings sbit LCD_RS at RB2_bit; sbit LCD_EN at RB3_bit; sbit LCD_D7 at RB7_bit; sbit LCD_D6 at RB6_bit; sbit LCD_D5 at RB5_bit; sbit LCD_D4 at RB4_bit; // Pin direction sbit LCD_RS_Direction at TRISB2_bit; sbit LCD_EN_Direction at TRISB3_bit; sbit LCD_D7_Direction at TRISB7_bit; sbit LCD_D6_Direction at TRISB6_bit; sbit LCD_D5_Direction at TRISB5_bit; sbit LCD_D4_Direction at TRISB4_bit;

//------------------------------------------------------------------------------

void timer0_init() { T0CON.TMR0ON = 1;// Timer0 On/Off Control bit:1=Enables Timer0 / 0=Stops Timer0 T0CON.T08BIT = 0;// Timer0 8-bit/16-bit Control bit: 1=8-bit timer/counter / 0=16-bit timer/counter T0CON.T0CS = 0;// TMR0 Clock Source Select bit: 0=Internal Clock (CLKO) /

1=Transition on T0CKI pin T0CON.T0SE = 0;// TMR0 Source Edge Select bit: 0=low/high / 1=high/low T0CON.PSA = 0;// Prescaler Assignment bit: 0=Prescaler is assigned; 1=NOT

assigned/bypassed

T0CON.T0PS2 = 1;// bits 2-0 PS2:PS0: Prescaler Select bits T0CON.T0PS1 = 0; T0CON.T0PS0 = 0; TMR0H = 0xB; TMR0L = 0xDC; // preset for Timer0 MSB register // preset for Timer0 LSB register

INTCON.TMR0IE=1; INTCON.TMR0IF=0; } //------------------------------------------------------------------------------

void timer_reload() { TMR0H = 0xB; TMR0L = 0xDC; } //-----------------------------------------------------------------------------// preset for Timer0 MSB register // preset for Timer0 LSB register

void chk() { if (kp != oldstate) { cnt = 1; COLM++; oldstate = kp; } }

//Check botton press agian or not

//------------------------------------------------------------------------------

void cr_shift_left() { Lcd_Cmd(_LCD_MOVE_CURSOR_LEFT); }

//-----------------------------------------------------------------------------void save_data(char charter) { data_array [COLM]=charter; char_number=COLM+1; } //Save Data In a string received from keyPad

//------------------------------------------------------------------------------

void lcd_dis(char ch) { lcd_chr(ROW1,COLM1,ch) if(COLM1==16) { ROW1++; COLM1=1; }

//Display Input chracter on LCD

if(ROW1==2&&COLM==32) { lcd_cmd(LCD_CLEAR); lcd_cmd(LCD_RETRN_HOME); ROW1=1; COLM=1; }

//-----------------------------------------------------------------------------unsigned short option(void) { lcd_cmd(LCD_CLEAR); int slct=1; lcd_out(1,1,"* SMS"); lcd_out(1,2," MAIL"); //Initializing Device.

op=keypad_Key_Click(); do { switch(op) { case 5: lcd_out(1,1,"* SMS"); lcd_out(1,2," MAIL"); slct=1; break; case 6: lce_out(1,1," SMS"); lcd_out(1,2,"* MAIL"); slct=2; break; case 16: op=69; break; } }while(op!=69) if(slct==1) return 1; if(slct==2) return 2; } //------------------------------------------------------------------------------

void sms(void) { UART1_Write_Text("AT+CMGF=1\r\n"); delay_ms(2000); UART1_Write_Text("AT\r\n"); delay_ms(2000); UART1_Write_Text("AT+CPMS=\"SM\"\r\n"); //select sotrage to sm delay_ms(2000); delay_ms(2000); Lcd_Cmd(_LCD_CLEAR); Lcd_Out(1, 3, "SMS SENDING");

data_array [char_number]=0; data_array[0]='$'; UART1_Write_Text("AT+CMGS="); Uart1_write('"'); Uart1_write('0');

Uart1_write('3'); Uart1_write('4'); Uart1_write('5'); Uart1_write('4'); Uart1_write('5'); Uart1_write('3'); Uart1_write('3'); Uart1_write('0'); Uart1_write('7'); Uart1_write('0'); Uart1_write('"'); Uart1_write('\r'); Uart1_write('\n'); delay_ms(5000); UART1_Write_Text(data_array); Uart1_write(0x1A); Lcd_Cmd(_LCD_CLEAR); delay_ms(1000);

Lcd_Out(1, 3, "SMS SENT"); delay_ms(5000); Lcd_Cmd(_LCD_CLEAR); } //-----------------------------------------------------------------------------void mail(void) { UART1_Write_Text("AT+CMGF=1\r\n"); delay(2000); UART1_Write_Text("AT+CGATT=1\r\n"); delay(2000); UART1_Write_Text("AT+CGDCONT=1,"IP","UFONE"\r\n"); delay(2000); UART1_Write_Text("AT+CSTT="UFONE","",""\r\n");

delay(2000); UART1_Write_Text("AT+CDNSCFG="208.67.222.222","208.67.222.220"\r\n"); delay(2000); UART1_Write_Text("CIICR\r\n"); delay(2000); UART1_Write_Text("AT+EMAILCID=1\r\n"); delay(2000); UART1_Write_Text("AT+EMALTO=30\r\n"); delay(2000); UART1_Write_Text("AT+SMTPSRV="smtp.maiL.yahoo.com",25\r\n"); delay(2000); UART1_Write_Text("AT+SMTPAUTH=1,"GSM","PAWSORD"\r\n"); delay(2000); UART1_Write_Text("AT+SMTPFRM="cool_mani89@yahoo.com","Communicator"\r \n"); delay(2000); UART1_Write_Text("AT+SMTPRCPT=0,0,"cool_mani89@yahoo.com"\r\n"); delay(2000); UART1_Write_Text("AT+SMTPSUB="TEST"\r\n"); delay(2000); UART1_Write_Text("AT+SMTPBODY="); UART1_Write_Text(data_array); UART1_Write(0x1A) delay(2000); UART1_Write_Text("AT+SMTPSEND\r\n"); delay(2000); //------------------------------------------------------------------------------

void keypad_input(void) { do{ kp = Keypad_Key_Click(); if (exit==1) {

//Inupt From Keypad

// Store key code in kp variable

kp=0; exit=0; break; } }while (kp==0);

timer_reload(); switch (kp) {

case 1: kp = 49; break; // 1 case 2: kp = 52; break; // 2 case 3: kp = 55; break; // 3 case 4: kp = 83; break; // A case 5: kp = 50; break; // 4 case 6: kp = 53; break; // 5 case 7: kp = 56; break; // 6 case 8: kp = 48; break; // B case 9: kp = 51; break; // 7 case 10: kp = 54; break; // 8 case 11: kp = 57; break; // 9 case 12: kp = 67; break; // C case 13: kp = 85; break; // * case 14: kp = 68; break; // 0 case 15: kp = 77; break; // # case 16: kp = 69; break; // D }

if (kp==0) { if (kp !=0xff) { cnt = 1; } }

if (kp=='E') { if(opt==1) sms(); if(opt==2) mail(); } if (kp=='1') { chk(); if (cnt==3) { cnt=1; } if (cnt==1) { Lcd_dis('1'); save_data('1'); } else if (cnt==2) { Lcd_dis('.'); save_data('.'); } cnt++; } if (kp=='2') { chk(); if (cnt==5) { cnt=1; } if (cnt==1)

{ Lcd_dis('A'); save_data('A'); } else if (cnt==2) { Lcd_dis('B'); save_data('B'); } else if (cnt==3) { Lcd_dis('C'); save_data('C'); } else if (cnt==4) { Lcd_dis('2'); save_data('2'); } cnt++; } if (kp=='3') { chk(); if (cnt==5) { cnt=1; } if (cnt==1) { Lcd_dis('D'); save_data('D'); } else if (cnt==2)

{ Lcd_dis('E'); save_data('E'); } else if (cnt==3) { Lcd_dis('F'); save_data('F'); } else if (cnt==4) { Lcd_dis('3'); save_data('3'); } cnt++; }

if (kp=='4') { chk(); if (cnt==5) { cnt=1; } if (cnt==1) { Lcd_dis('G'); save_data('G'); } else if (cnt==2) { Lcd_dis('H'); save_data('H'); }

else if (cnt==3) { Lcd_dis('I'); save_data('I'); } else if (cnt==4) { Lcd_dis('4'); save_data('4'); } cnt++; }

if (kp=='5') { chk(); if (cnt==5) { cnt=1; } if (cnt==1) { Lcd_dis('J'); save_data('J'); } else if (cnt==2) { Lcd_dis('K'); save_data('K'); } else if (cnt==3) { Lcd_dis('L'); save_data('L');

} else if (cnt==4) { Lcd_dis('5'); save_data('5'); } cnt++; }

if (kp=='6') { chk(); if (cnt==5) { cnt=1; } if (cnt==1) { Lcd_dis('M'); save_data('M'); } else if (cnt==2) { Lcd_dis('N'); save_data('N'); } else if (cnt==3) { Lcd_dis('O'); save_data('O'); } else if (cnt==4) { Lcd_dis('6');

save_data('6'); } cnt++; }

if (kp=='7') { chk(); if (cnt==6) { cnt=1; } if (cnt==1) { Lcd_dis('P'); save_data('P'); } else if (cnt==2) { Lcd_dis('Q'); save_data('Q'); } else if (cnt==3) { Lcd_dis('R'); save_data('R'); } else if (cnt==4) { Lcd_dis('S'); save_data('S'); } else if (cnt==5) {

Lcd_dis('7'); save_data('7'); } cnt++; }

if (kp=='8') { chk(); if (cnt==5) { cnt=1; } if (cnt==1) { Lcd_dis('T'); save_data('T'); } else if (cnt==2) { Lcd_dis('U'); save_data('U'); } else if (cnt==3) { Lcd_dis('V'); save_data('V'); } else if (cnt==4) { Lcd_dis('8'); save_data('8'); } cnt++;

if (kp=='9') { chk(); if (cnt==6) { cnt=1; } if (cnt==1) { Lcd_dis('W'); save_data('W'); } else if (cnt==2) { Lcd_dis('X'); save_data('X'); } else if (cnt==3) { Lcd_dis('Y'); save_data('Y'); } else if (cnt==4) { Lcd_dis('Z'); save_data('Z'); } else if (cnt==5) { Lcd_dis('9'); save_data('9'); }

cnt++; } if (kp=='0') { chk(); if (cnt==3) { cnt=1; } if (cnt==1) { Lcd_dis(' '); save_data(' '); } else if (cnt==2) { Lcd_dis('0'); save_data('0'); } cnt++; } if (kp=='C') { if (COLM!=0) { cr_shift_left(); Lcd_Chr(1, COLM--, ' '); cr_shift_left(); cnt=1; oldstate=kp; COLM++; save_data(0); COLM--;

} } if (cnt == 255) { cnt = 0; } }

//-----------------------------------------------------------------------------//MAIN FUNCTION //-----------------------------------------------------------------------------void main() { INTCON.GIE=1; adcon1=0x06; trisa=0xff; timer0_init(); TRISC.b0=1; cnt=0; Keypad_Init(&PORTD); Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_UNDERLINE_ON); UART1_Init(9600); delay_ms(100); // Reset counter // Initialize Keypad // Initialize LCD // Clear display // Cursor off

Lcd_Out(1, 3, "WAITING"); while(portc.b0==1); Lcd_Out(1, 3, "GSM INI");

UART1_Write_Text("AT\r\n"); delay_ms(2000); UART1_Write_Text("ATE0\r\n"); delay_ms(2000);

lcd_out("Welcome To Faculty-Student Console"); delay_ms(2000); lcd_cmd(LCD_CLEAR); lcd_out("Teacher Name:"); lcd_cmd(LCD_SECOND_ROW); lcd_out("Sir Saqib Sallaudin") delay_ms(2000); lcd_cmd(LCD_CLEAR); lcd_out("Select Option And Press Enter"); delay_ms(2000); opt=option();

do { keypad_input(); } while (1); }

void interrupt() { if (INTCON.TMR0IF==1) { INTCON.TMR0IF=0; TMR0H = 0xB; TMR0L = 0xDC; exit=1; } }

Appendix B: List of Components


4 MHz crystal oscillator Pic18f452 microcontroller Serial cable DB9 SIM900D GSM modem Max 232 IC Connecting wires Bridge Diode Power supply 12V Capacitors 16x2 LCD 4x4 keypad PCB Resistors Pull-up resistor

Appendix C: Project Timeline


DATE 23-12-2011

Proposed time line:

Practically implemented timeline:

ID 1 2 3 4 5 6 7 8

Task Task Name Mode

Duration Start

Mar 20, '11 Apr 24, '11 May 29, '11 Jul 3, '11 Aug 7, '11 Sep 11, '11 Oct 16, '11 Nov 20, '11 Dec 25, '11 Jan F S S M T W T F S S M T W T F S S M T W T

Litrature Review 20 days Documentation And 25 days Material Collection Implemetation 144 days Input module 16 days implemetation Output module 15 days Implementaion GSM Module 112 days Implementation Write Up 204 days Evaluation And Testing 26 days

Thu 3/10/11 Mon 4/4/11 Wed 5/11/11 Wed 5/11/11 Thu 6/2/11 Thu 6/23/11 Thu 3/10/11 Fri 11/25/11

Você também pode gostar