You are on page 1of 39

AUTOMATIC RATION DISPENSING SYSTEM

ABSTRACT:
Automatic Ration Dispensing System presented here is an advanced system useful for the automatic & more efficient way of ration distribution. This project is designed to minimize the manual intervention in the process of ration distribution, so that more transparency & efficiency can be maintained.

The project consists of a User Card; based on a FLASH / E2PROM memory chip 9356 as user card & an automated system interfaced with a PC and material dispensing mechanism. The project is also equipped with a microcontroller unit for the ease of message display and for easy future enhancements in the project.

METHODOLOGY:
As shown in the Block diagram, the project consists of following sub-systems;

The system consists of a User Card reader connected to the system, into which the user card can be inserted. The card reader is connected to the system through the printer port. The P. C communicates with the Card through the printer port which is a versatile port through which the data can be inputted and outputted. The program is stored in the memory of the program. The system program is written in C language. The card consists of an EEPROM chip, which can be written & erased electrically. To store the information it is written and to retrieve it is read. The card is programmed serially. Logical unit (Computer): This unit is logical & processing unit i.e. computer. The system software or program is stored in the computer. The system or hardware unit is connected to the computer by a connector connected to the printer port. The various outputs from the hardware like memory card, Buzzer etc are all connected to this unit only. Buzzer Indication: This section consists of Piezo buzzer which sounds if we enter the wrong password. This section input is form P. C, the input signal is amplified and given to the buzzer. The buzzer operates on 9V power supply.

Material Dispensing Motors: These are normal DC used to control the dispensing mechanism of the project. They are typically of 12V rating and can be controlled with the aid of Darlington driver circuit.. Regulated Power supply: This section is very important section of the system as it feeds the power to all the sections. This section generates a 5V D.C source to supply all the I. Cs and circuits. This section consists of a step down transformer of 9V A.C, diode bridge rectifier, and filter capacitor and 5V regulator I. Cs. The output is 5V-regulated D.C for all the I.C s and unregulated 9V d. c is supplied to relay operating directly.

APPLICATIONS 1. The project can be used at the places where the automated ration distribution is required. 2. With certain modification the project can also be used for automated medicine dispensing.

ADVANTAGES 1. The project is fully automatic and easy to use, eliminating the man power 2. The project is based in advanced memory chip technology, thus enabling to to track & protect the database of the user. 3. With its centralized server connectivity the project can be made real time & thus helping resource management effectively.

Block Diagram of Automatic Ration Dispensing System:

Ration card (RFID card) Alarm unit for wrong pswd Printer

Card Reader

Container Sensor

PC (Central Display Unit) Microcontroller Unit

Max 232 Unit

Rs232 Cable

Driver Ckt Input Unit

Valve

CHAPTER 2
POWER SUPPLY UNIT

2.1 CIRCUIT DIAGRAM

Fig.2.1. Circuit Diagram of Power Supply

2.1.1 Working Principle The AC voltage, typically 220V rms, is connected to a transformer, which steps that ac voltage down to the level of the desired DC output. A diode rectifier then provides a full-wave rectified voltage that is initially filtered by a simple capacitor filter to produce a dc voltage. This resulting dc voltage usually has some ripple or ac voltage variation.

A regulator circuit removes the ripples and also remains the same dc value even if the input dc voltage varies, or the load connected to the output dc voltage changes. This voltage regulation is usually ohtained using one of the popular voltage regulator 1C units.

Figure 2.2 Block diagram of power supply

2.1.2 TRANSFORMER

The potential transformer will step down the power supply voltage (0-230V) to (0-6V) level. Then the secondary

of the potential transformer will be connected to the precision rectifier, which is constructed with the help of op-amp. The

advantages of using precision rectifier are it will give peak voltage output as DC, rest of the circuits will give only RMS output.

2.1.3 BRIDGE RECTIFIER When four diodes are connected as shown in figure, the circuit is called as bridge rectifier. The input to the circuit is applied to the diagonally opposite corners of the network, and the output is taken from the remaining two comers.

Let us assume that the transformer is working properly and there is a positive potential, at point A and a negative potential at point B. the positive potential at point A will forward bias D3 and reverse bias D4. The negative potential at point B will forward bias Dl and reverse D2. At this time D3 and Dl are forward biased and will allow current flow to pass through them; D4 and D2. are reverse biased and will block current flow.

The path for current flow is from point B through Dl, up through RL, through D3, through the secondary of the transformer back to point B. this path is indicated by the solid arrows. Waveforms (1) and (2) can be observed across Dl and D3.

One-half cycle later the polarity across the secondary of the transformer reverse, forward biasing D2 and D4 and reverse biasing Dl and D3, Current flow will now be from point A through D4, up through RL, through D2, through the secondary of T1, and back to point A.

This path is indicated by the broken arrows. Waveforms (3) and (4) can be observed across D2 and D4. The current flow through RL is always in the same direction. In flowing through RL this current develops a voltage corresponding to that shown waveform (5). Since current flows through the load (RL) during both half cycles of the applied voltage, this bridge rectifier is a full-wave rectifier.

One advantage of a bridge rectifier over a conventional full-wave rectifier is that with a given transformer the bridge rectifier produces a voltage output that is nearly twice that of the conventional full-wave circuit.

This may be shown by assigning values to some of the components shown in views A and B. assume that the same transformer is used in both circuits. The peak voltage developed between points X and y is 1000 volts in both circuits. In the conventional full-wave circuit shown --in view A, the peak voltage from the center tap to either X or Y is 500 volts. Since only one diode can conduct at any instant, the maximum voltage that can be rectified at any instant is 500 volts.

The maximum voltage that appears across the load resistor is nearly-but never exceeds-500 vOlts, as result of the small voltage drop across the diode. In the bridge rectifier shown in view B, the maximum voltage that can be rectified is the full secondary voltage, which is 1000 volts. Therefore, the peak output voltage across the load resistor is nearly 1000 volts. With both circuits using the same transformer, the bridge rectifier circuit produces a higher output voltage than the conventional full-wave rectifier circuit. 2.1.4 SMOOTHING CAPACITOR: Smoothing is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The diagram shows the unsmoothed varying DC (dotted line) and the smoothed DC (solid line). The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output.

Note that smoothing significantly increases the average DC voltage to almost the peak value (1.4 RMS value). For example 6V RMS AC is rectified to full wave DC of about 4.6V RMS (1.4V is lost in the bridge rectifier), with smoothing this increases to almost the peak value giving 1.4 4.6 = 6.4V smooth DC. Smoothing is not perfect due to the capacitor voltage falling a little as it discharges, giving a small ripple voltage. For many circuits a ripple which is 10% of the supply voltage is satisfactory and the equation below gives the required value for the smoothing capacitor. A larger capacitor will give less ripple. The capacitor value must be doubled when smoothing half-wave DC. 5 Io Smoothing capacitor for 10% ripple, C = Vs f C= smoothing capacitance in farads (F) Io= output current from the supply in amps(A) Vs= supply voltage in volts(V), this is the peak value of the unsmoothed DC f= frequency of the AC supply in hertz(Hz), 50Hz in the UK 2.1.5 IC VOLTAGE REGULATORS Voltage regulators comprise a class of widely used ICs. Regulator 1C units contain the circuitry for reference source, comparator amplifier, control device, and overload protection all in a single 1C. 1C units provide regulation of either a fixed positive voltage, a fixed negative voltage, or an adjustably set voltage. The regulators can be selected for operation with load currents from hundreds of milli amperes to tens of amperes, corresponding to power ratings from milli watts to tens of watts. A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi, applied to one input terminal.

CHAPTER 3
SERIAL COMMUNICATION
3.1 INTRODUCTION Serial communication is basically the transmission or reception of data one bit at a time. Today's computers generally address data in bytes or some multiple thereof. A byte contains 8 bits. A bit is basically either a logical 1 or zero. Every character on this page is actually expressed internally as one byte. The serial port is used to convert each byte to a stream of ones and zeroes as well as to convert a stream of ones and zeroes to bytes. The serial port contains a electronic chip called a Universal Asynchronous Receiver/Transmitter (UART) that actually does the conversion.

The serial port has many pins. We will discuss the transmit and receive pin first. Electrically speaking, whenever the serial port sends a logical one (1) a negative voltage is effected on the transmit pin. Whenever the serial port sends a logical zero (0) a positive voltage is affected. When no data is being sent, the serial port's transmit pin's voltage is negative (1) and is said to be in a MARK state. Note that the serial port can also be forced to keep the transmit pin at a

positive voltage (0) and is said to be the SPACE or BREAK state. (The terms MARK and SPACE are also used to simply denote a negative voltage (1) or a positive voltage (0) at the transmit pin respectively).

When transmitting a byte, the UART (serial port) first sends a START BIT which is a positive voltage (0),

followed by the data (general 8 bits, but could be 5, 6, 7, or 8 bits) followed by one or two STOP Bits which is a negative(l) voltage. The sequence is repeated for each byte sent. Figure shows a diagram of what a byte transmission would look like.

Fig 3.1 Byte Transmission At this point you may want to know what the duration of a bit is. In other words, how long does the signal stay in a particular state to define a bit. The answer is simple. It is dependent on the baud rate. The baud rate is the number of times the signal can switch states in one second. Therefore, if the line is operating at 9600 baud, the line can switch states 9,600 times per second. This means each bit has the duration of 1 '9600 of a second or about 100sec.

When transmitting a character there are other characteristics other than the baud rate that must be known or that must be setup. These characteristics define the entire interpretation of the data stream.

The first characteristic is the length of the byte that will be transmitted. This length in general can be anywhere from 5 to 8 bits. The second characteristic is parity. The parity characteristic can be even, odd, mark, space, or none. If even parity, then the last data bit transmitted will be a logical 1 if the data transmitted had an even amount of 0 bits. If odd parity, then

the last data bit transmitted will be a logical 1 if the data transmitted had an odd amount of 0 bits. If MARK parity, then

the last transmitted data bit will always be a logical 1. If SPACE parity, then the last transmitted data bit will always be a logical 0. If no parity then there is no parity bit transmitted. The third characteristic is the amount of stop bits. This value in general is 1 or 2. Assume we want to send the letter A' over the serial port. The binary representation of the letter 'A' is 01000001. Remembering that bits are transmitted from least significant bit (LSB) to most significant bit (MSB), the bit stream transmitted would be as follows for the line characteristics 8 bits, no parity, 1 stop bit and 9600 baud. LSB (0100009101) MSB. The above represents (Start Bit) (Data Bits) (Stop Bit). To calculate the actual byte transfer rate simply divide the

baud rate by the number of bits that must be transferred for each byte of data. In the case of the above example, each character requires 10 bits to be transmitted for each character. As such, at 9600 baud, up to 960 bytes can be transferred in one second.

The above discussion was concerned with the "electrical/logical" characteristics of the data stream. We will expand the discussion to line protocol. Serial communication can be half duplex or full duplex. Full duplex communication means that a device can receive and transmit data at the same time. Half duplex means that the device cannot send and receive at the same time. It can do them both, but not at the same time. Half duplex communication is all but outdated except for a very small focused set of applications.

Half duplex serial communication needs at a minimum two wires, signal ground and the data line. Full duplex serial communication needs at a minimum three wires, signal ground, transmit data line, and receive data line. The RS232 specification governs the physical and electrical characteristics of serial communications. This specification defines several additional signals that are asserted (set to logical 1) for information and control beyond the data signal.

These signals are the Carrier Detect Signal (CD), asserted by modems to signal a successful connection to another modem, Ring Indicator (RI), asserted by modems to signal the phone ringing. Data Set Ready (DSR), asserted by modems to show their presence, Clear To Send (CTS), asserted by modems if they can receive data, Data Terminal Ready (DTR), asserted by terminals to show their presence, Request To Send (RTS), asserted by terminals if they can receive data. The section R.S232 Cabling describes these signals and how they are connected.

The a method

above that to two

paragraph connected

alluded devices

to use

hardware to tell drops it

flow each

control. other

Hardware

flow when

control to send

is

electronically CTS

or

when not longer same practice

send data. A modem in characters. instead to with the It re-asserts the RTS

general it

(logical can

0) its

line when it A terminal flow that

can no does the in DSR

receive thing is

when

receive of

again.

signal.

Another in the

method previous

hardware except

control the

perform

same

procedure

paragraph

and DTR signals are used for the handshake.

Note that hardware flow control requires the use of additional wires. The benefit to this however is crisp and reliable flow control. Another method of flow control used is known as software flow control. This method requires a simple 3 wire serial communication link, transmit data, receive data, and signal ground. If using this method, when a device can no longer receive, it will transmit a character that the two devices agreed on. This character is known as the XOFF character. 3.2 AN INTRODUCTION TO NULL MODEM Serial communications with RS232. One of the oldest and most widely spread communication methods in computer world. The way this type of communication can be performed is pretty well defined in standards. I.e. with one

exception. The standards show the use of DTE/DCE communication, the way a computer should communicate with a peripheral device like a modem. For your information, DTE means Data Terminal Equipment (computers etc.) where

DCE is the abbreviation of Data Communication Equipment (modems). One of the main uses of serial communication

today where no modem is involved-a Serial Null Modem configuration with DTE/DTE communication-is not so well defined, especially when it comes to flow control. The terminology null modem for the situation where two computers communicate directly is so often used nowadays, that most people don't realize anymore the origin of the phrase and that a null modem connection is an exception, not the rule.

In history, practical solutions were developed to let two computers talk with each other using a null modem serial communication line. In most situations, the original modem signal lines are reused to perform some sort of handshaking. Handshaking can increase the maximum allowed communication speed because it gives the computers the ability to control the flow of information.

A high amount of incoming data is allowed if the computer is capable to handle it. but not if it is busy performing other tasks. If no How control is implemented in the null modem connection, communication is only possible at speeds at which it is sure the receiving side can handle the amount information even under worst case conditions.

3.3 ORIGINAL USE OF RS232 When we look at the connector pin out of the RS232 port, we see two pins which are certainly used for flow

control. These two pins are RTS, request to send and CTS, clear to send. With DTE/DCE communication (i.e. a computer communicating with a modem device) RTS is an output on the DTE and input on the DCE. CTS are the answering signal coming from the DCE.

Before sending a character, the DTE asks permission by setting its RTS output. No information will be sent until the

DCE grants permission by using the CTS line. If the DCE cannot handle new requests, the CTS signal will go low. A simple but useful mechanism allowing flow control in one direction. The assumption is that the DTE can always handle incoming information faster than the DCE can send it. In the past, this was true. Modem speeds of 300 baud were common and 1200 baud was seen as a high speed connection.

The last flow control signal present in DTE/DCE communication is the CD carrier detect. It is not used directly for flow control, but mainly an indication of the ability of the modem device to communicate with its counter part. This signal indicates the existence of a communication Jink between two modem devices.

3.4 NULL MODEM WITHOUT HANDSHAKING How to use the handshaking lines in a null modem configuration? The simplest way is to don't use them at all. In that situation, only the data lines and signal ground are cross connected in the null modem communication cable. All other pins have no connection. An example of such a null modem cable without handshaking can be seen in the figure below.

Fig.3.2. Null Modem without Handshaking

3.5 COMPATIBILITY ISSUES If you read about null modems, this three wire null modem cable is often talked about. Yes, it is simple but can we

use it in all circumstances? There is a problem, if either of the two devices checks the DSR or CD inputs. These signals normally define the ability of the other side to communicate. As they are not connected, their signal level will never go high. This might cause a problem.

The same holds for the RTS/CTS handshaking sequence. If the software on both sides is well structured, the RTS

output is set high and then a waiting cycle is started until a ready signal is received on the CTS line. This causes the software to hang because no physical connection is present to either CTS line to make this possible. The only type of communication which is allowed on such a null modem line is data-only traffic on the cross connected Rx/TX lines.

This does however not mean that this null modem cable is useless. Communication links like present in the Norton Commander program can use this null modem cable. This null modem cable can also be used when communicating with devices which do not have modem control signals like electronic measuring equipment etc.

As you can imagine, with this simple null modem cable no hardware flow control can be implemented. The only way to perform flow control is with software flow control using the XOFF and XON characters.

CHAPTER 4
GSM MODEM

4.1 DEFINITION Global system for mobile communication (GSM) is a globally accepted standard for digital cellular communication. GSM is the name of a standardization group established in 1982 to create a common European' mobile telephone standard that would formulate specifications for a pan-European mobile cellular radio system operating at 900 MHz.

4.2 THE GSM NETWORK GSM provides recommendations, not requirements. The GSM specifications define the functions and interface requirements in detail but do not address the hardware. The reason for this is to limit the designers as little as possible but still to make it possible for the operators to buy equipment from different suppliers. The GSM network is divided into three major systems: the switching system (SS), the base station system (BSS), and the operation and support system (OSS). The basic GSM network elements are shown in below figure.

Fig.4.1. GSM Network Elements

4.3 GSM MODEM

A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a

dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves.

A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an external GSM modem is connected to a computer through a serial cable or a USB cable. A GSM modem in the form of a PC Card / PCMCIA Card

is designed for use with a laptop computer. It should be inserted into one of the PC Card / PCMCIA Card slots of a laptop computer. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate.

As mentioned in earlier sections of this SMS tutorial, computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. You can use a GSM modem just like a dial-up modem.

In addition to the standard AT commands, GSM modems support an extended set of AT commands. These extended AT commands are defined in the GSM standards. With the extended AT commands, you can do things like: Reading, writing and deleting SMS messages. Sending SMS messages. Monitoring the signal strength. Monitoring the charging status and charge level of the battery. Reading, Writing and searching phone book entries.

The number of SMS messages that can be processed by a GSM modem per minute is very low - only about six to ten SMS messages per minute.

4.4 MILESTONES OF GSM 1982-Confederation of European Post and Telegraph (CEPT) establishes Group Special Mobile. 1985- Adoption of list of recommendation to be generated by the group. 1986- Different field tests for radio technique for the common air interface. 1987- TDMA chosen as Access Standard. MoU signed between 12 operators. 1988- Validation of system. 1989- Responsibility taken up ETSI 1990-First GSM specification released 1991-First commercial GSM system launched.

4.5 FREQUENCY RANGES OF GSM GSM works on 4 different frequency ranges with FDMA-TDMA and FDD.They are as follows. System Freq Uplink Freq Downlink P-GSM (Primary) 890-915MHz 935-960MHz E-GSM (Extended) 880-915MHz 925-960MHz GSM 1800 1710-1785MHz 1805-1880MHz GSM 1900 1850-1910MHz 1930-1990MHz

Table 4.1 Frequency range of GSM

4.6 SERVICES OF GSM Bearer Services Basic telecommunication services to transfer data b/w access points Specification of services up to the terminal interface (corresponding to OSI layers 1-3) Different data rates for voice and data (original standard)

Data service (circuit switched) Synchronous: 2.4, 4.8 or 9.6 KBit/s Asynchronous: 300-- 1200 Bit/s

Data service (packet switched) Synchronous: 2.4, 4.8 or 9.6 KBit/s Asynchronous: 300 - 9600 Bit/s Additionally: signaling channels for connection control (used by telematic services)

Tele Services Telecommunication services that enable voice communication via mobile phones. All services have to obey cellular functions, security measurements, etc. Offered services: Mobile telephony Primary goal of GSM was to enable mobile telephony offering the traditional bandwidth of 3.1 kHz _ Emergency number Common number throughout Europe (112); mandatory for all service providers; free of charge; connection

with the highest priority (preemption of other connections possible) _ Multinumbering Several phone numbers per user possible

Non-Voice-Teleservices Fax Voice mailbox (implemented in the fixed network supporting the mobile terminals) Electronic mail (MHS, Message Handling System, implemented in the fixed network) Short Message Service (SMS) Alphanumeric data transmission to/from the mobile terminal using the signaling channel, thus allowing simultaneous use of basic services and SMS

Supplementary Services Services in addition to the basic services, cannot be offered stand-alone Similar to ISDN services besides lower bandwidth due to radio link May differ between different service providers, countries and protocol Versions.

Important services Identification: forwarding of caller number Suppression of number forwarding Automatic call-back Conferencing with up to 7 participants Locking of the mobile terminal (incoming or outgoing calls

4.7 GSM ARCHITECTURE GSM is a PLMN (Public Land Mobile Network) several providers setup mobile networks following the GSM standard within each country.

Diagram for GSM architecture

Fig.4.2 GSM architecture Components MS (mobile station) BS (base station) MSC (mobile switching center) LR (location register) Subsystems

RSS (radio subsystem): covers all radio aspects NSS (network and switching subsystem): call forwarding, handover, switching OSS (operation subsystem): management of the network

Base Station Subsystem Transcoding Rate and Adaptation Unit (TRAD) Performs coding between the 64 kpbs PCM coding used in the backbone network and the 13 kbps coding used for the Mobile Station Base Station Controller (BSC) Controls the channel (time slot) allocation implemented by the BTSes Manages the handovers within the BSS area Knows which mobile stations are within the cell and informs the MSC/VLR about this Does now know the exact location of a MS before a call is made.

Base Transceiver Station (BTS) Controls several transmitters Each transmitter has 8 time slots, some used for signaling, on a specific frequency

Maximum amount of frequencies and transmitters in a cell is 6, thus maximum capacity of a cell is 45 calls (+ 3 time slots for signaling).

Network and Switching Subsystem The backbone of a GSM network is an ordinary telephone network with some added capabilities Mobile Switching Center (MSC) An ISDN exchange with additional capabilities to support mobile communications Visitor Location Register (VLR) A database, part of the MSC Contains the location of the active Mobile Stations

Gateway Mobile Switching Center (GMSC) Links the system to PSTN and other operators Home Location Register (HLR) Contains subscriber information, including authentication information in Authentication Center (AuC) Equipment Identity Register (EIR) International Mobile Station Equipment Identity (IMEI) codes for e.g. blacklisting stolen phones.

Home Location Register One database per operator

Contains all the permanent subscriber information MSISDN (Mobile Subscriber ISDN number) is the telephone number of the subscriber IMSI code is used to link the MSISDN number to the subscriber's SIM (Subscriber Identity Module) International Mobile Subscriber Identity (IMSI) is the 15 digit code used to identify the subscriber It incorporates a country and operator code Charging information Services available to the customer Also the subscriber's present Location Area Code, which refers to the MSC, which can connect to the MS.

Mobile Station MS is the user's handset and has tv/o parts Mobile Equipment Radio equipment User interface Processing capability and memory required for various tasks Encryption SMS messages Equipment IMEI number Subscriber Identity Module

Subscriber Identity Module A small smart card Encryption codes needed to identify the Subscriber Subscriber IMSI number

Subscriber's own information (telephone directory) Third party applications (banking etc.) Can also be used in other systems besides GSM, e.g. some WLAN access points accept SIM based user authentication

Other Systems Operations Support System The management network for the whole GSM system Usually vendor dependent Very loosely specified in the GSM standards Value added services Voice mail Call forwarding Group calls Short Message Service Center Stores and forwards the SMS messages Like an e-mail server Required to operate the SMS service The SMS service was initially used to notify the subscriber about new voicemail.

4.8 SIMCOM SIM300GSM MODULE


INTRODUCTON SIMCOM SIM300 module connects to the specific application and the air interface. As SIM300 can be integrated with a wide range of applications, all functional components of SIM300 are described in great detail.

PRODUCT CONCEPT Designed for global market, SIM300 is a Tri-band GSM/GPRS engine that works on frequencies EGSM 900 MHz, DCS 1800 MHz and PCS 1900 MHz. SIM300 features GPRS multi-slot class 10/ class 8 (optional) and supports the GPRS coding schemes CS-1, CS-2, CS-3 and CS-4.

Fig.4.3 EVB top view

Designed for global market, SIM300 is a Tri-band GSM/GPRS engine that works on frequencies EGSM 900 MHz, DCS 1800 MHz and PCS 1900 MHz. SIM300 features GPRS multi-slot class 10/ class 8 (optional) and supports the GPRS coding schemes CS-1, CS-2, CS-3 and CS-4.With a tiny configuration of 40mm x 33mm x 2.85mm , SIM300 can fit almost all the space requirements in our applications, such as smart phone, PDA phone and other mobile devices. In this hardware SIM300 is only interfaced with RS232, Regulated power Supply 4.0V SIM Tray Antenna with LED indications. A: SIM300 module interface B: SIM card interface C: headset interface D: Download switch, turn on or off download function

E: VBAT switch, switch the voltage source from the adaptor or external battery F: PWRKEY key, turn on or turn off SIM300 G: RESET key H: expand port, such as keypad port, main and debug serial port, display port I: MAIN serial port for downloading, AT command transmitting, data exchanging J: DEBUG serial port K: hole for fixing the antenna L: source adapter interface M: light N: buzzer O: headphones interface P: hole for fixing the SIM300

NETWORK STATUS INDICATION LED LAMP State SIM300 function Off - SIM300 is not running 64ms On/ 0.8 sec Off - SIM300 does not find the network 64ms On/ 3 Sec Off - SIM300 find the network 64ms On/ 0.3 sec Off - GPRS communication

SIM CARD INTERFACE You can use AT Command to get information in SIM card. The SIM interface supports the functionality of the GSM Phase 1 specification and also supports the functionality of the new GSM Phase 2+ specification for FAST 64 kbps SIM (intended for use with a SIM application Tool-

kit).Both 1.8V and 3.0V SIM Cards are supported.The SIM interface is powered from an internal regulator in the module having nominal voltage 2.8V. All pins reset as outputs driving low.

Fig.4.4 SIM card interface AT Command Format A command line is a string of characters sent from a DTE to the modem (DCE) while the modem is in a command state. A command line has a prefix, a body, and a terminator. Each command line (with the exception of the A/ command) must begin with the character sequence AT and must be terminated by a carriage return. Commands entered in upper case or lower cases are accepted, but both the A and T must be of the same case, i.e., AT or at. The default terminator is the ENTER key <CR> character. Characters that precede the AT prefix are ignored. The command line interpretation begins upon receipt of the ENTER key character. Characters within the command line are parsed as commands with associated parameter values. The basic commands consist of single ASCII characters, or single characters proceeded by a prefix character (e.g., & or +), followed by a decimal parameter. Missing decimal parameters are evaluated as 0.

4.9 APPLICATIONS Access control devices

Now access control devices can communicate with servers and security staff through SMS messaging. Complete

log of transaction is available at the head-office Server instantly without any wiring involved and device can instantly alert security personnel on their mobile phone in case of any problem. RaviRaj Technologies is introducing this technology in all Fingerprint Access control and time attendance products.

Transaction terminals: EDC machines, POS terminals can use SMS messaging to confirm transactions from central servers. The main benefit is that central server can be anywhere in the world. Today you need local servers in every city v/ith multiple telephone lines. You save huge infrastructure costs as well as per transaction cost.

Supply Chain Management: Today SCM require huge IT infrastructure with leased lines, networking devices, data centre, workstations and still you have large downtimes and high costs. You can do all this at a fraction of the cost with GSM M2M technology. A central server in your head office with GSM capability is the answer; you can receive instant transaction data from all your branch offices, warehouses and business associates with nil downtime low cost.

SENDING SMS MESSAGES FROM A COMPUTER USING A MOBILE PHONE OR GSM/GPRS MODEM: The SMS specification has defined a way for a computer to send SMS messages through a mobile phone or GSM/GPRS modem. A GSM/GPRS modem is a wireless modem that works with GSM/GPRS wireless networks. A wireless modem is similar to a dial-up modem. The main difference is that a wireless modem transmits data through a wireless network whereas a dial-up modem transmits data through a copper telephone line. More information about GSM/GPRS modems will be provided in the section "Introduction to GSM / GPRS Wireless Modems". Most mobile phones can be used as a wireless modem. However, some mobile phones have certain limitations comparing to GSM/GPRS modems. This will be discussed in the section "Which is Better: Mobile Phone or GSM / GPRS Modem" later. To send SMS messages, first place a valid SIM card from a wireless carrier into a mobile phone or GSM/GPRS modem, which is then connected to a computer. There are several ways to connect a mobile phone or GSM/GPRS modem to a computer. For example, they can be connected through a serial cable, a USB cable, a Bluetooth link or an infrared link. The actual way to use depends on the capability of the mobile phone or GSM/GPRS modem. For

example, if a mobile phone does not support Bluetooth, it cannot connect to the computer through a Bluetooth link. After connecting a mobile phone or GSM/GPRS modem to a computer, you can control the mobile phone or GSM/GPRS modem by sending instructions to it. The instructions used for controlling the mobile phone or GSM/GPRS modem are called AT commands. (AT commands are also used to control dial-up modems for wired telephone system.) Dial-up modems, mobile phones and GSM/GPRS modems support a common set of standard AT commands. In addition to this common set of standard AT commands, mobile phones and GSM/GPRS modems support an extended set of AT commands. One use of the extended AT commands is to control the sending and receiving of SMS messages. The following table lists the AT commands that are related to the writing and sending of SMS messages:

AT command +CMGS +CMSS +CMGW +CMGD +CMGC +CMMS

Meaning Send message Send message from storage Write message to memory Delete message Send command More messages to send

One way to send AT commands to a mobile phone or GSM/GPRS modem is to use a terminal program. A terminal program's function is like this: It sends the characters you typed to the mobile phone or GSM/GPRS modem. It then displays the response it receives from the mobile phone or GSM/GPRS modem on the screen. The terminal program on Microsoft Windows is called HyperTerminal. More details about the use of Microsoft HyperTerminal can be found in the "How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem" section of this SMS tutorial.

Below shows a simple example that demonstrates how to use AT commands and the HyperTerminal program of Microsoft Windows to send an SMS text message. The lines in bold type are the command lines that should be entered in HyperTerminal. The other lines are responses returned from the GSM / GPRS modem or mobile phone.

AT OK AT+CMGF=1 OK AT+CMGW="+85291234567" > A simple demo of SMS text messaging. +CMGW: 1

OK AT+CMSS=1 +CMSS: 20

OK

Here is a description of what is done in the above example:

Line 1: "AT" is sent to the GSM / GPRS modem to test the connection. The GSM / GPRS modem sends back the result code "OK" (line 2), which means the connection between the HyperTerminal program and the GSM / GPRS modem works fine.

Line 3: The AT command +CMGF is used to instruct the GSM / GPRS modem to operate in SMS text

mode. The result code "OK" is returned (line 4), which indicates the command line "AT+CMGF=1" has been executed successfully. If the result code "ERROR" is returned, it is likely that the GSM / GPRS modem does not support the SMS text mode. To confirm, type "AT+CMGF=?" in the HyperTerminal program. If the response is "+CMGF: (0,1)" (0=PDU mode and 1=text mode), then SMS text mode is supported. If the response is "+CMGF: (0)", then SMS text mode is not supported.

Line 5 and 6: The AT command +CMGW is used to write an SMS text message to the message storage of the GSM / GPRS modem. "+85291234567" is the recipient mobile phone number. After typing the recipient mobile phone number, you should press the Enter button of the keyboard. The GSM / GPRS modem will then return a prompt "> " and you can start typing the SMS text message "A simple demo of SMS text messaging.". When finished, press Ctrl+z of the keyboard.

Line 7: "+CMGW: 1" tells us that the index assigned to the SMS text message is 1. It indicates the location of the SMS text message in the message storage.

Line 9: The result code "OK" indicates the execution of the AT command +CMGW is successful. Line 10: The AT command +CMSS is used to send the SMS text message from the message storage of the GSM / GPRS modem. "1" is the index of the SMS text message obtained from line 7.

Line 11: "+CMSS: 20" tells us that the reference number assigned to the SMS text message is 20. Line 13: The result code "OK" indicates the execution of the AT command +CMSS is successful.

To send SMS messages from an application, you have to write the source code for connecting to and sending AT commands to the mobile phone or GSM/GPRS modem, just like what a terminal program does. You can write the source code in C, C++, Java, Visual Basic, Delphi or other programming languages you like. However, writing your own code has a few disadvantages:

You have to learn how to use AT commands. You have to learn how to compose the bits and bytes of an SMS message. For example, to specify the

character encoding (e.g. 7-bit encoding and 16-bit Unicode encoding) of an SMS message, you need to know which bits in the message header should be modified and what value should be assigned.

Sending SMS messages with a mobile phone or GSM/GPRS modem has a drawback -- the SMS

transmission speed is low. As your SMS messaging application becomes more popular, it has to handle a larger amount of SMS traffic and finally the mobile phone or GSM/GPRS modem will not be able to take the load. To obtain a high SMS transmission speed, a direct connection to an SMSC or SMS gateway of a wireless carrier or SMS service provider is needed. However, AT commands are not used for communicating with an SMS center or SMS gateway. This means your have to make a big change to your

SMS messaging application in order to move from a wireless-modem-based solution to a SMSC-based solution. In most cases, instead of writing your own code for interacting with the mobile phone or GSM/GPRS modem via AT commands, a better solution is to use a high-level SMS messaging API (Application programming interface) / SDK (Software development kit) / library. The API / SDK / library encapsulates the low-level details. So, an SMS application developer does not need to know AT commands and the composition of SMS messages in the bit-level.

Some SMS messaging APIs / SDKs / libraries support SMSC protocols in addition to AT commands. To move from a wireless-modem-based SMS solution to a SMSC-based SMS solution, usually you just need to modify a configuration file / property file or make a few changes to your SMS messaging application's source code. The links to some open source and free SMS messaging libraries can be found in the article "Free Libraries/Tools for Sending/Receiving SMS with a Computer". Another way to hide the low-level AT command layer is to place an SMS gateway between the SMS messaging application and the mobile phone or GSM/GPRS modem. (This has been described in the section "What is an SMS Gateway?" earlier.) Simple protocols such as HTTP / HTTPS can then be used for sending SMS messages in the application. If an SMSC protocol (e.g. SMPP, CIMD, etc) is used for communicating with the SMS gateway instead of HTTP / HTTPS, an SMS messaging API / SDK / library can be very helpful to you since it encapsulates the SMSC protocol's details. Usually a list of supported / unsupported mobile phones or wireless modems is provided on the web site of an SMS messaging API / SDK / library or an SMS gateway software package. Remember to check the list if you are going to use an SMS messaging API / SDK / library or an SMS gateway software package.

4.9 APPLICATIONS SUITABLE FOR GSM COMMUNICATION

If your application needs one or more of the following features, GSM will be more cost-effective then other communication systems.

Short Data Size

You data size per transaction should be small like 1-3 lines, e.g. banking transaction data, sales/purchase data, consignment tracking data, updates. These small but important transaction data can be sent through SMS messaging which cost even less then a local telephone call or sometimes free of cost worldwide. Hence with negligible cost you are able to send critical information to your head office located anywhere in the world from multiple points. You can also transfer faxes, large data through GSM but this will be as or more costly compared to landline networks.

Multiple remote data collection points:

If you have multiple data collections points situated all over your city, state, country or worldwide you will benefit the most. The data can be sent from multiple points like your branch offices, business associates, warehouses, and agents with devices like GSM modems connected to PCs, GSM electronic terminals and Mobile phones. Many a times some places like warehouses may be situated at remote location may not have landline or internet but you will have GSM network still available easily.

High uptime If your business require high uptime and availability GSM is best suitable for you as GSM mobile networks have high uptime compared to landline, internet and other communication mediums. Also in situations where you expect that someone may sabotage your communication systems by cutting wires or taping landlines, you can depend on GSM.

Large transaction volumes: GSM SMS messaging can handle large number of transaction in a very short time. You can receive large number SMS messages on your server like e-mails without internet connectivity. E-mails normally get delayed a lot but SMS messages are almost instantaneous for instant transactions.

Consider situation like shop owners doing credit card transaction with GSM technology instead of conventional landlines time you find local transaction servers busy as these servers use multiple telephone lines to take care of multiple transactions, whereas one GSM connection is enough to handle hundreds of transaction per minute.

Mobility, Quick installation GSM technology allows mobility, GSM terminals, modems can be just picked and installed at other location unlike telephone lines. Also you can be mobile with GSM terminals and can also communicate with server using your mobile phone. You can just purchase the GSM hardware like modems, terminals and mobile handsets, insert SIM cards, configure software and your are ready for GSM communication. GSM solutions can be implemented within few weeks whereas it may take many months to implement the infrastructure for other technologies.

4.10 ADVANTAGES OF GSM OVER ANALOG SYSTEMS Capacity increases Reduced RF transmission power and longer battery life. International roaming capability. Better security against fraud (through terminal validation and user authentication). Encryption capability for information security and privacy. Compatibility with ISDN, leading to wider range of services

CHAPTER 5 AT89C51
5.1 INTRODUCTION
controllers, hand-held communication devices, dedicated controllers, have certainly improved the functional, operational and performance based specifications.

Today, micro controllers have become an integral of all automatic and semi-automatic machines. Remote

Microcontrollers are single chip microcomputers, more suited for control and automation of machines and process. Microcontrollers have central processing unit (CPU), memory, I/O units, timers and counters, analog to digital converters (ADC), digital to analog converters (DAC), serial ports, interrupt logic, oscillator circuitry and many more functional blocks on chip. All these functional block on a single Integrated Circuit (IC), result into a reduced size of control board, low

power consumption, more reliability and ease of integration within an application design. The usage of micro controllers not only reduces the cost of automation, but also provides more flexibility

5.2 FEATURES
Compatible with MCS-51 Products 4K Bytes of In-System Reprogrammable Flash Memory Endurance: 1,000 Write/Erase Cycles Fully Static Operation: 0 Hz to 24 MHz Three-level Program Memory Lock

128 x 8-bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Programmable Serial Channel Low-power Idle and Power-down Modes

5.3 DESCRIPTION
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmels high-density non-volatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

5.4 PIN CONFIGURATION

Fig.5.1 Pin configuration

5.5 BLOCK DIAGRAM

Fig.5.2. Block diagram

5.6 PIN DESCRIBTION


VCC Supply voltage. GND Ground.

PORT 0 Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port 0 may also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode P0 has internal pull ups. Port 0 also receives the code bytes during Flash programming, and outputs the code bytes during program verification. External pull ups are required during program verification. PORT 1 Port 1 is an 8-bit bi-directional I/O port with internal pull ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal pull ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull ups. Port 1 also receives the low-order address bytes during Flash programming and verification. PORT 2 Port 2 is an 8-bit bi-directional I/O port with internal pull ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal pull ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pull ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, it uses strong internal pull ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. PORT 3 Port 3 is an 8-bit bi-directional I/O port with internal pull ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pull ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull ups. Port 3 also serves the functions of various special features of the AT89C51 as listed below:

PORT PIN

ALTERNATE FUNCTIONS

P3.0

RXD (serial input port)

P3.1

TXD (serial output port)

P3.2

INT0 (external interrupt 0)

P3.3

INT1 (external interrupt 1)

P3.4 P3.5

T0 (timer 0 external input) T1 (timer 1 external input)

P3.6 P3.7

WR (external data memory write strobe) RD (external data memory read strobe)

Port 3 also receives some control signals for Flash programming and verification. RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external Data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. PSEN Program Store Enable is the read strobe to external program memory. When the AT89C51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming, for parts that require 12-volt VPP. XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier. OSCILLATOR CHARACTERISTICS XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed. IDLE MODE In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. It should be noted that when idle is terminated by a hard ware reset, the device normally resumes program execution, from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory.

Fig.5.3. Oscillator Connections

Note: C1, C2 = 30 pF 10 pF for Crystals = 40 pF 10 pF for Ceramic Resonators

Fig.5.4.External Clock Drive Configuration

SOFTWARE TOOLS

8.1 KEIL C
Keil software is the leading vendor for 8/16-bit development tools (ranked at first position in the 2004 embedded market study of the embedded system and EE times magazine).

Keil software is represented worldwide in more than 40 countries, since the market introduction in 1988; the keil C51 compiler is the de facto industry standard and supports more than 500 current 8051 device variants. Now, keil software offers development tools for ARM.

Keil software makes C compilers, macro assemblers, real-time kernels, debuggers, simulators, integrated environments, and evaluation boards for 8051, 251, ARM and XC16x/C16x/ST10 microcontroller families.

The Keil C51 C Compiler for the 8051 microcontroller is the most popular 8051 C compiler in the world. It provides more features than any other 8051 C compiler available today.

The C51 Compiler allows you to write 8051 microcontroller applications in C that, once compiled, have the

efficiency and speed of assembly language. Language extensions in the C51 Compiler give you full access to all resources of the 8051.

The C51 Compiler translates C source files into relocatable object modules which contain full symbolic

information for debugging with the uVision Debugger or an in-circuit emulator. In addition to the object file, the compiler generates a listing file which may optionally include symbol table and cross reference.

Nine basic data types, including 32-bit IEEE floating-point, Flexible variable allocation with bit, data, bdata, idata, xdata, and

pdata

memory types, Interrupt functions may be written in C, Full use of the 8051 register banks,

Complete symbol and type information for source-level debugging, Use of AJMP and ACALL instructions, Bit-addressable data objects, Built-in interface for the RTX51 real time kernels, Support for the Philips 8xC750, 8xC751, and 8.xC752 limited instruction sets, Support for the Infineon 80C517 arithmetic unit.

You might also like