Wednesday 26 December 2012

SMS Based Banking Security System



INTRODUCTION

                          The purpose of this project is to alert the Bank manager in case unauthorized entry in to Bank strong room premises. This system monitors the strong room of Bank and send text message to Bank manager mobile number when an intrusion occurs. The motion sensor sense the strong room condition and send signal to microcontroller. If an intrusion occurs in to the strong room the alarm gives indication to the security staff and automatically send text message to Bank manager.
GSM is also known as Global System for Mobile Communications, or simply Global System for Mobile. A technology started development in 1985 by a French company formerly known as Groupe Spécial Mobile. It's main competetor is CDMA, currently in use by Bell Mobility, Telus Mobility and Mobility Canada carriers.
                                 The purpose of this project is control any electrical device from your Cell Phone using SMS and send SMS When a Human Intrusion occurs. With this circuit you can get the sms alert. The main operation of the system is to detect the infrared signals from the Human Beings will be detected by the PIR sensor then the GSM modem can detect the signals and send the sms alert to the bank manager  or  other authorized peoples. The sensor will respond to a moving body only; it will not detect a stationary infrared source, however it is very sensitive to changes in air density close to the front of sensor and might produce false responses if not covered by a lens or IR transparent window. The detection range without a lens is about three feet but can be extended to up to 90 feet or more by placing an infrared Fresnel lens in front of the sensor. A Glolab FL65 infrared Fresnel lens with a focal length of 0.65 inch is recommended for longest range. The lens can be mounted in an enclosure with its grooves facing inside, using silicone rubber adhesive around the mounting flange.

                                                                   When motion is detected the sensor will output a very small voltage transition at pin 2. This voltage must be amplified many times in order to do useful work. Two sections of a LP324 or equivalent quad operational amplifier are used to provide the necessary amplification. Sensor pin 2 feeds into the first stage amplifier IC1A at non-inverting input pin 3. This is a very high impedance input and does not load the sensor. A high pass filter and feedback network, R4, C4 connects from IC1A output pin 1 to inverting input pin 2 and a high pass filter and bias network, C3, R3 connects from pin 2 to ground. These networks set the amplifier gain and operating point and also form a bandpass filter that amplifies only signals above DC and below about 10Hz. The pyroelectric sensor is a thermal device and its response time falls within this band of frequencies. Filtering out signals outside its response time eliminates noise sources from frequencies that are not used anyway and makes the amplifier more stable.

                                        The output of the first amplifier stage, IC1A is taken from pin 1. It then feeds through R5 and C5 into the inverting input of the second amplifier stage at pin 13 of IC1B. C5 blocks the flow of DC and, together with R5, forms a high pass filter to reduce gain at very low frequencies. A feedback network R10, R11, C6 connects from IC1B output pin 14 to inverting input pin 13. R10 is a potentiometer that controls the amount of feedback and therefore the gain of this stage. R11 limits the amount of feedback. The non-inverting input to IC1B at pin 12 is biased to ½ of the supply voltage or 2.5 volts by resistor divider network R6, R7, R8, R9. This bias sets the operating point of the amplifier so that its output pin 14 is at 2.5 volts when no motion is being detected.
                                                                The output of IC1B pin 14 feeds into a window comparator made of IC1C and IC1D. When an operational amplifier is used as a comparator It is run at full open loop gain so that its output switches to a full up or down level when one input is just a few millivolts higher or lower than the other. The purpose of this comparator is to provide a small voltage window or dead zone centered around 2.5 volts that will not respond to small voltage transitions caused by noise or minor fluctuations from the sensor. The inverting input of IC1C at pin 9 is biased by the voltage at the junction of R6, R7 so it is about 175 millivolts above the 2.5 volt output level at pin 14 of IC1B, and inverting input pin 10 of IC1C is connected to IC1B pin 14. IC1C will not turn on until pin 10 goes more positive than pin 9. The non-inverting input at pin 5 of IC1D is biased by the voltage at the junction of R8, R9 to about 175 millivolts below the 2.5 volt output level at pin 14 of IC1B, and inverting input pin 6 of IC1D is connected to IC1B pin 14. IC1D will not turn on until pin 6 goes more negative than pin 5.


BLOCK DIAGRAM






 






















`










BLOCK DIGRAM EXPLANATION
                                 The power supply unit converts the 230 volts supply voltage to 9 volts and 12 volts. The 9 volt supply is fed to bridge rectifier and it converts the 9v supply into 5v supply for proper working of the system and it is fed to LM7805 which is a voltage regulator which maintains a fixed output voltage.

                                The GSM modem serves as the transmitter and receiver. There is a GSM Sim card inserted on the module .It accepts the SMS and transfer the data to the microcontroller. The GSM module also sends the status SMS from the system to the user.
                               
             The PIR sensor or the Passive Infrared sensor is the part of the security system of the system .This sensor detects the presence of human and alerts the user .The sensor is connected to the microcontroller and the activation and deactivation of the sensor is according to the SMS from the user.
                            
                     The microcontroller is the primary part of the system. It is programmed to analyze the incoming SMS and to execute according to the information. The micro controller first checks the SMS and analyze whether the SMS is from the default number, if only the SMS will be executed. The output ports of the microcontroller are connected to the display and to the relay driver circuit which controls the devices. The microcontroller replies the status of the devices to the GSM module which sends it to the user.
                               
                                        The display is an LCD display which displays the status of the devices which is controlled by the system .The LCD is connected to one of the output ports of the microcontroller .If the sensor  section is more effective and  this can take IR  signals from the human and  send a high response to the  microcontroller .This  signal  will enable gsm modem and send  sms to predefined mobile numbers at the same time the controller provide an alarm signal to the buzzer
Microcontroller

         TPIC is a family of Harvard architecture microcontrollers made by Microchip Technology. The name PIC initially referred to "Peripheral Interface Controller". Mid-Range devices feature a 14-bit program word architecture and are available in 8 to 64-pin packages. These microcontrollers provide 1.8-5.5V operation, speeds up to 20 MHz, interrupt handling and an 8-level deep stack. These devices are available in various peripheral and memory configurations and feature serial analog and digital peripherals.

Motion Sensor

         A Passive Infrared sensor (PIR sensor) is an electronic device that measures infrared (IR) light radiating from objects in its field of view. PIR sensors are often used in the construction of PIR-based motion detectors. Apparent motion is detected when an infrared source with one temperature, such as a human, passes in front of an infrared source with another temperature, such as a wall. A few mechanisms have been used to focus the distant infrared energy onto the sensor surface. The window may have multiple Fresnel lenses molded into it. This filtering window may be used to limit the wavelengths to 8-14 micrometers which is closest to the infrared radiation emitted by humans (9.4 micrometers being the strongest).

Keys

         The keys are used to operate the module.

LCD
               This is a basic 16 character by 2 line display. Black text on Green background. Utilizes the extremely common HD44780 parallel interface chip set. It will need minimum 6 general I/O pins to interface to this LCD screen. Includes LED back light. This will work in 4 bit and 8 bit mode.



Power supply

       TIn mains-supplied electronic systems the AC input voltage must be converted into a DC voltage with the right value and degree of stabilization. The ac from the transformer secondary is rectified by a bridge rectifier and filtered by the capacitor. A Linear voltage regulators produce regulated output voltage.



GSM Modem

         A GSM modem is a specialized type of modem which accepts a SIM card, and operates over a subscription to a mobile operator, just like a mobile phone. When a GSM modem is connected to a microcontroller, this allows the microcontroller to use the GSM modem to communicate over the mobile network. While these GSM modems are most frequently used to  sending and receiving SMS.

Alarm

         Which is used to indicate when an intrusion occurs by buzzer or Hooter.
PIR Sensor

         Pyroelectric devices, such as the PIR sensor, have elements made of a crystalline material that generates an electric charge when exposed to infrared radiation. The changes in the amount of infrared striking the element change the voltages generated, which are measured by an on-board amplifier. The device contains a special filter called a Fresnel lens, which focuses the infrared signals onto the element. As the ambient infrared signals change rapidly, the on-board amplifier trips the output to indicate motion.












CIRCUIT DIAGRAM
·                 MAIN CIRCUIT BOARD

·              BUZZER






·              LCD DISPLAY





CIRCUIT DESCRIPTION

Main board section

Power supply
         
       In main supply in electronics circuit systems the AC input voltage must be converted into a DC voltage with the right value and degree of stabilization. The AC from the transformer secondary is rectified by a bridge rectifier and filtered by the capacitor.
Fig:-Circuit diagram of a voltage regulated power supply


           The +5volt power supply is based on the 7805voltege regulator IC. This IC contains all the circuitry needed to accept any input voltage from 8 to 18 volts and produce a steady +5 volt output, accurate to with in 5 %( 0.25volts). It also contains current limiting circuitry and thermal overload protection. The 10µf and 0.01µf capacitors serve to help   keep the power supply output voltage constants when load condition change. The electrolytic capacitor smoothes out any long-term or low frequency variations. However, at high frequencies this capacitor is not very efficient. Therefore, the 0.01µf is included to bypass high –frequency changes.

Micro controller

       The PICmicro MCU family is based on a RISC architecture, RISC stands for Reduced Instruction set computer. High performance is accomplished as a result of the Harvard architecture, which has separate data and address busses and two separate memory spaces. Single cycle instructions allow high speed code execution, and single word instructions reduce the moment of program memory space required. One of the features in the PICmicro architecture that makes it so powerful is the use of register files. The register file concept means that all RAM locations, peripherals and I/O ports are organized as a simple bank of register.

Oscillator circuit

The function of an oscillator circuit is to provide an accurate and stable periodic clock signal to a microcontroller. The frequency of this clock signal can range from a few kilohertz to tens of megahertz and determines how quickly the microcontroller executes its instructions. Most micro controllers include a clock driver circuit which is designed to drive a quartz crystal into oscillation. The clock driver circuitry built into the PICmicro family is very flexible and allows for different potions. The clock circuitry consists of two capacitors and a quartz crystal. The values of capacitor are determined by both the clock speed and by the selection of a quartz crystal or ceramic resonator as the clock source. Quartz crystals are typically mounted in a sealed metal case with two wire leads protruding from the bottom. Sometimes crystals may have a third ground lead soldered or welded to the top of the metal can. Grounding the pin on the metal can helps to both stabilize the crystal, lessening the impact of mechanical shock, as well as reduce RF emission.

Rest circuit

       The only component required to run a PICnicro is a pull-up resistor connected to the MCLR/Vpp pin. A resistor and a push button switch make up an actual rest circuit. When switch is pressed, it completes a low impedance connection from the MCLR/Vpp pin to ground, forcing the pic micro into rest mode until MCLR is brought high. During this time the oscillator will run and the I/O pins will be held in the reset condition.
                          
GSM MODEM CIRCUIT
GSM differs from first generation wireless systems in that it uses digital technology and time division multiple access transmission methods. Voice is digitally encoded via a unique encoder, which emulates the characteristics of human speech. This method of transmission permits a very efficient data rate/information content ratio.

                                       The GSM module is the transmitter and the receiver of the system. The antenna in the module receives the SMS from the sender and transfer the information to the microcontroller the microcontroller reply with AT command to initiate the module and the reply is send to the predefined number. Thus the information is passed from the module to the Authorized person.

                                  The Subscriber Identity Module or the SIM should be inserted into the GSM module. The module is a modem which acts as a mobile phone. It is connected to the port B of the microcontroller and works on a 12 volt supply. The modem has several input and output pins which is used to transmit and receive the data. It modulates the data to be sent and demodulates the received data and transfers it to the micro controller.
                                  The MAX232 IC is used before connecting the modem to the microcontroller. The MAX232 IC is an integrated circuit that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals.


LCD DISPLAY
  A liquid crystal display is a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. It is prized by engineers because it uses very small amounts of electric power and is therefore suitable for use in battery powered electronic devices. Each pixel of an LCD consists of a layer of perpendicular molecules aligned between two transparent electrodes and two polarizing filters, the axes of polarity of which are perpendicular to each other with no liquid crystal between the polarizing crystals The surfaces of the electrodes that are in contact with the liquid crystal material are treated so as to align the liquid crystal molecules in a particular direction this treatment typically consists of a thin polymer layer that is unidirectional rubbed using a cloth. Before applying the electric field, the orientation of the liquid crystal molecules is determined by the alignment at the surfaces.


                                 

                                  The LCD display displays the status of the devices connected to the system. The display is connected to the port B of the microcontroller. The display gives the information about whether the devices are on or off. The display is updated with the current information from the microcontroller as the SMS changes the status of the device.

BUZZER CIRCUIT

                                   It most commonly consists of a number of switches or sensors connected to a control unit that determines if and which button was pushed or a preset time has lapsed, and usually illuminates a light on the appropriate button or control panel, and sounds a warning in the form of a continuous or intermittent buzzing or beeping sound.
                                  The buzzer is associated with the security system. The PIR sensor senses the presence of human and sends a signal to the buzzer and the micro controller. The buzzer circuit is closed and it stars buzzing. At this moment itself the GSM module sends an SMS to the user about the presence of human. The buzzer is only shut off by the predefined user.

WORKING OF THE CIRCUIT

                     The main element of this project is PIC 16F873A. PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640[1] originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral Interface Controller”. The PIC controls the entire system .Mainly the system has two sections, the security unit and the automation unit. The microcontroller is programmed to execute the SMS from the predefined number and to take action according to the content in the message. SMS other users are also received by the GSM module but the message from the predefined number is only executed.
          The antenna in the GSM modem receives the SMS.The modem us connected to the port A of the microcontroller .The micro controller checks the mobile number and the format of the message. If the message is from the right number and is in the right format, the content in the message is executed. If the message is to switch on a device, the relay associated with the device is triggered by the microcontroller.
                                 The PIR sensor of the system are connected to the port B and port C respectively. The PIR sensor detects the presence of human and will send an SMS to the user as ‘Human Detected’ as in the program. The PIR sensor can be activated or deactivated by sending an SMS. The sensor is connected to the buzzer which alerts the user about the human intrusion.
                                 The power for the working is supplied from the power supply unit of the system. The output from the transformer is supplied to the bridge rectifier and then to the voltage regulator to give regulated power supply to the system. The GSM module works on the 12volt supply and the PIC on 5 volts.





COMPONENTS DESCRIPTION

MICROCONTROLLER DESCRIPTION


                                                   The name PIC initially referred to "Programmable Interface Controller”. PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability. Devices called "programmers" are traditionally used to get program code into the target PIC. Most PICs that Microchip currently sell feature ICSP (In Circuit Serial Programming) and/or LVP (Low Voltage Programming) capabilities, allowing the PIC to be programmed while it is sitting in the target circuit. ICSP programming is performed using two pins, clock and data, while a high voltage (12V) is present on the Vpp/MCLR pin. Low voltage programming dispenses with the high voltage, but reserves exclusive use of an I/O pin and can therefore be disabled to recover the pin for other uses (once disabled it can only be re-enabled using high voltage programming).
                                
                                PIC16F873A/876A devices are available only in 28-pin packages, while PIC16F874A/877A devices are available in 40-pin and 44-pin packages. All devices in the PIC16F87XA family share common architecture with the following differences: • The PIC16F873A and PIC16F874A have one-half of the total on-chip memory of the PIC16F876A and PIC16F877A • The 28-pin devices have three I/O ports, while the 40/44-pin devices have five • The 28-pin devices have fourteen interrupts, while the 40/44-pin devices have fifteen • The 28-pin devices have five A/D input channels, while the 40/44-pin devices have eight • The Parallel Slave Port is implemented only on the 40/44-pin devices.
   
              Fig:-PIC 16F873A                                                                 Fig:-Pin details


Why we use the PIC 16F873A
1. Code Efficiency

The PIC is an 8 bit Microcontroller based on the Harvard architecture – which means there are separate internal busses for memory and data. The throughput rate is therefore increased due to simultaneous access to both data and program memory. Conventional Microcontrollers tend to have one internal bus handling both data and program. This slows operation down by at least a factor of 2 when compared to the PICMCU.


2. Instruction Set

There are 35 instructions you have to learn in order to write software for midrange families. Each instruction, with the exception of CALL, GOTO or bit testing instructions (BTFSS, INCFSZ), executes in one cycle.

3. Speed

The PIC has an internal divide by 4 connected between the oscillator and the internal clock bus. This makes instruction time easy to calculate,especially if you use a 4 MHz crystal. Each instruction cycle then works out at 1uS. The PIC is a very fast micro to work with e.g. a 20MHz crystal steps through a program at 5 million instructions per second

4. Static operation

The PIC is a fully static Microcontroller; in other words, if you stop the clock, all the register contends are maintained. In practice you would not actually do this, you would place the PIC into a Sleep mode – this stops the clock and sets up various flags within the PIC to allow you to know what state it was in before the Sleep. In Sleep, the PIC takes only its standby current which can be less the 1uA.

5. Drive capability

The PIC has a high output drive capability and can directly drive LEDs and triacs etc. Any I/O pin can sink/source 25mA



6. Options

A range of speed, temperature, package, I/O lines, timer functions,serial communication, A/D and memory sizes is available from the PIC family to suit virtually all your requirements.

7. Versatility
             The PIC is a versatile micro and in volume is a low cost solution to replace even a few logic gates; especially where space is at a premium.

8. Security

The PICmicro MCU has a code protection facility which is one of the best in the industry. Once the protection bit has been programmed, the contents of the program memory cannot be read out in a way that the program code can be reconstructed.



                               

























Special Microcontroller Features:

Ø  100,000 erase/write cycle Enhanced Flash program memory typical
Ø  1,000,000 erase/write cycle Data EEPROM memory typical
Ø  Data EEPROM Retention > 40 years
Ø  Self-reprogrammable under software control
Ø  In-Circuit Serial Programming™ (ICSP™) via two pins
Ø  Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
Ø  Programmable code protection
Ø  Power saving Sleep mode
Ø  Selectable oscillator options
Ø  In-Circuit Debug (ICD) via two pins
CMOS Technology:

Ø  Low-power, high-speed Flash/EEPROM technology
Ø  Fully static design
Ø  Wide operating voltage range (2.0V to 5.5V)
Ø  Commercial and Industrial temperature ranges
Ø  Low-power consumption
Ports

There are five parallel ports in the PIC 16F877A, labeled A–E. All pins can be used as bit- or byte oriented digital input or output. It can be seen that many of the port pins have two or more functions, depending on the initialization of the relevant control registers. The TRIS (data direction) register bits in bank 1 is used set the port as input or output. However, there is an IMPORTANT exception. Ports A and E are set to ANALOG INPUT by default, because the analogue control register ADCON1 in bank 1. If analog input is required only on selected pins, ADCON1 can be initialized with bit codes that give a mixture of analogue and digital I/O on Ports A and E.


PORTA and the TRISA Register

PORTA is a 6-bit wide, bidirectional port. The corresponding data direction register is TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA pin an input (i.e., put the corresponding output driver in a High-Impedance mode). Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e., put the contents of the output latch on the selected pin).Reading the PORTA register reads the status of the pins, whereas writing to it will write to the port latch. All write operations are read-modify-write operations .Therefore, a write to a port implies that the port pins are read, the value is modified and then written to the port data latch. Pin RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The RA4/T0CKIpin is a Schmitt Trigger input and an open-drain output. All other PORTA pins have TTL input levels and full CMOS output drivers.

PORTB and the TRISB Register

PORTB is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB pin an input (i.e., put the corresponding output driver in a High-Impedance mode). Clearing a TRISB bit (= 0) will make the corresponding PORTB pin an output (i.e., put the contents of the output latch on the selected pin). Three pins of PORTB are multiplexed with the In-Circuit Debugger and Low-Voltage Programming function: RB3/PGM, RB6/PGC and RB7/PGD. The alternate functions of these pins are described in Section 14.0 “Special Features of the CPU”. Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups. This is performed by clearing bit RBPU (OPTION_REG<7>). The weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups are disabled on a power-on-reset.

PORTC and the TRISC Register

PORTC is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin an input (i.e., put the corresponding output driver in a High-Impedance mode). Clearing a TRISC bit (= 0) will make the corresponding PORTC pin an output (i.e., put the contents of the output latch on the selected pin). PORTC is multiplexed with several peripheral functions (Table 4-5). PORTC pins have Schmitt Trigger input buffers. When the I2C module is enabled, the PORTC<4:3> pins can be configured with normal I2C levels, or with SMBus levels, by using the CKE bit (SSPSTAT<6>). When enabling peripheral functions, care should be taken in defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to make a pin an output, while other peripherals override the TRIS bit to make a pin an input. Since the TRIS bit override is in effect while the peripheral is enabled, read-modify write instructions (BSF, BCF, and XORWF) with TRISC as the destination, should be avoided. The user should refer to the corresponding peripheral section for the correct TRIS bit settings.

PORTD and TRISD Registers

PORTD is an 8-bit port with Schmitt Trigger input buffers. Each pin is individually configurable as an input or output. PORTD can be configured as an 8-bit wide microprocessor port (Parallel Slave Port) by setting control bit, PSPMODE (TRISE<4>). In this mode, the input buffers are TTL.


PORTE and TRISE Register
      
PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6 and RE2/CS/AN7) which are individually configurable as inputs or outputs. These pins have Schmitt Trigger input buffers. The PORTE pins become the I/O control inputs for the microprocessor port when bit PSPMODE (TRISE<4>) is set. In this mode, the user must make certain that the TRISE<2:0> bits are set and that the pins are configured as digital inputs. Also, ensure that ADCON1 is configured for digital I/O. In this mode, the input buffers are TTL. Register 4-1 shows the TRISE register which also controls the Parallel Slave Port operation. PORTE pins are multiplexed with analog inputs. When selected for analog input, these pins will read as ‘0’s. TRISE controls the direction of the RE pins, even when they are being used as analog inputs. The user must make sure to keep the pins configured as inputs when using them as analog inputs.

TIMER0 MODULE

The Timer0 module timer/counter has the following features:
Ø   8-bit timer/counter
Ø  Readable and writable
Ø  8-bit software programmable prescaler
Ø  Internal or external clock select
Ø  Interrupt on overflow from FFh to 00h
Ø  Edge select for external clock

Timer mode is selected by clearing bit T0CS (OPTION_REG<5>). In Timer mode, the Timer0 module will increment every instruction cycle (without prescaler). If the TMR0 register is written, the increment is inhibited for the following two instruction cycles. The user can work around this by writing an adjusted value to the TMR0 register. Counter mode is selected by setting bit T0CS (OPTION_REG<5>). In Counter mode, Timer0 will increment either on every rising or falling edge of pin RA4/T0CKI. The incrementing edge is determined by the Timer0 Source Edge Select bit, T0SE (OPTION_REG<4>). Clearing bit T0SE selects the rising edge.



Timer0 Interrupt

The TMR0 interrupt is generated when the TMR0 register overflows from FFh to 00h. This overflow sets bit TMR0IF (INTCON<2>). The interrupt can be masked by clearing bit TMR0IE (INTCON<5>). Bit TMR0IF must be cleared in software by the Timer0 module Interrupt Service Routine before re-enabling this interrupt. The TMR0 interrupt cannot awaken the processor from Sleep since the timer is shut-off during Sleep.

TIMER1 MODULE

The Timer1 module is a 16-bit timer/counter consisting of two 8-bit registers (TMR1H and TMR1L) which are readable and writable. The TMR1 register pair (TMR1H:TMR1L) increments from 0000h to FFFFh and rolls over to 0000h. The TMR1 interrupt, if enabled, is generated on overflow which is latched in interrupt flag bit, TMR1IF (PIR1<0>). This interrupt can be enabled/disabled by setting/clearing TMR1 interrupt enable bit, TMR1IE (PIE1<0>).
Timer1 can operate in one of two modes:
Ø  As a Timer
Ø  As a Counter
The operating mode is determined by the clock select bit, TMR1CS (T1CON<1>). In Timer mode, Timer1 increments every instruction cycle. In Counter mode, it increments on every rising edge of the external clock input. Timer1 can be enabled/disabled by setting/clearing control bit, TMR1ON (T1CON<0>). Timer1 also has an internal “Reset input”. This Reset can be generated by either of the two CCP modules.

TIMER2 MODULE

Timer2 is an 8-bit timer with a prescaler and a postscaler. It can be used as the PWM time base for the PWM mode of the CCP module(s). The TMR2 register is readable and writable and is cleared on any device Reset. The input clock (FOSC/4) has a presale option of 1:1, 1:4 or 1:16, selected by control bits T2CKPS1:T2CKPS0 (T2CON<1:0>). The Timer2 module has an 8-bit period register, PR2. Timer2 increments from 00h until it match PR2 and then resets to 00h on the next increment cycle. PR2 is a readable and writable register. The PR2 register is initialized to FFh upon Reset. The match output of TMR2 goes through a 4-bit postscaler (which gives a 1:1 to 1:16 scaling inclusive) to generate a TMR2 interrupt (latched in flag bit, TMR2IF (PIR1<1>)). Timer2 can be shut-off by clearing control bit, TMR2ON (T2CON<2>), to minimize power consumption.
















PIC instruction set








MASTER SYNCHRONOUS SERIAL PORT (MSSP) MODULE

Overview

The Master Synchronous Serial Port (MSSP) module is a serial interface, useful for communicating with other peripheral or microcontroller devices. These peripheral devices may be serial EEPROMs, shift registers, display drivers, A/D converters, etc. The MSSP module can operate in one of two modes:
Ø  Serial Peripheral Interface (SPI)
Ø  Inter-Integrated Circuit (I2C)
- Full Master mode
- Slave mode (with general address call)
The I2C interface supports the following modes in hardware:
Ø  Master mode
Ø  Multi-Master mode
Ø  Slave mode

SPI Mode

The SPI mode allows 8 bits of data to be synchronously transmitted and received simultaneously. All four modes of SPI are supported. To accomplish communication, typically three pins are used:
Ø  Serial Data Out (SDO) – RC5/SDO
Ø  Serial Data In (SDI) – RC4/SDI/SDA
Ø  Serial Clock (SCK) – RC3/SCK/SCL
Additionally, a fourth pin may be used when in a Slave mode of operation:
Ø  Slave Select (SS) – RA5/AN4
When initializing the SPI, several options need to be specified. This is done by programming the appropriate control bits (SSPCON<5:0> and SSPSTAT<7:6>).
These control bits allow the following to be specified:
Ø  Master mode (SCK is the clock output)
Ø  Slave mode (SCK is the clock input)
Ø  Clock Polarity (Idle state of SCK)
Ø  Data Input Sample Phase (middle or end of data output time)
Ø  Clock Edge (output data on rising/falling edge of SCK)
Ø  Clock Rate (Master mode only)
Ø  Slave Select mode (Slave mode only)

I2C Mode

The MSSP module in I2C mode fully implements all master and slave functions (including general call support) and provides interrupts on Start and Stop bits in hardware to determine a free bus (multi-master function). The MSSP module implements the standard mode specifications, as well as 7-bit and 10-bit addressing.

MSSP BLOCK DIAGRAM
(I2C MODE)

Two pins are used for data transfer:
Ø  Serial clock (SCL) – RC3/SCK/SCL
Ø  Serial data (SDA) – RC4/SDI/SDA
The user must configure these pins as inputs or outputs through the TRISC<4:3> bits.
The MSSP module has six registers for I2C operation.
These are:
Ø  MSSP Control Register (SSPCON)
Ø  MSSP Control Register 2 (SSPCON2)
Ø  MSSP Status Register (SSPSTAT)
Ø  Serial Receive/Transmit Buffer Register (SSPBUF)
Ø  MSSP Shift Register (SSPSR) – Not directly accessible
Ø  MSSP Address Register (SSPADD)

SLAVE MODE

In Slave mode, the SCL and SDA pins must be configured as inputs (TRISC<4:3> set). The MSSP module will override the input state with the output data when required (slave-transmitter). The I2C Slave mode hardware will always generate an interrupt on an address match. Through the mode select bits, the user can also choose to interrupt on Start and Stop bits when an address is matched, or the data transfer after an address match is received, the hardware automatically will generate the Acknowledge (ACK) pulse and load the SSPBUF register with the received value currently in the SSPSR register. Any combination of the following conditions will cause the MSSP module not to give this ACK pulse:
Ø  The buffer full bit, BF (SSPSTAT<0>), was set before the transfer was received.
Ø  The overflow bit, SSPOV (SSPCON<6>), was set before the transfer was received.















UNIVERSALSYNCHRONOUSASYNCHRONOUS RECEIVERTRANSMITTER (USART)

The Universal Synchronous Asynchronous Receiver Transmitter (USART) module is one of the two serial I/O modules. (USART is also known as a Serial Communications Interface or SCI.) The USART can be configured as a full-duplex asynchronous system that can communicate with peripheral devices, such as CRT terminals and personal computers, or it can be configured as a half-duplex synchronous system that can communicate with peripheral devices, such as A/D or D/A integrated circuits, serial EEPROMs, etc.

The USART can be configured in the following modes:
Ø  Asynchronous (full-duplex)
Ø  Synchronous – Master (half-duplex)
Ø  Synchronous – Slave (half-duplex)

TXSTA: TRANSMIT STATUS AND CONTROL REGISTER (ADDRESS 98h)




Bit 7 CSRC: Clock Source Select bit
Asynchronous mode: Don’t care.
Synchronous mode:
1 = Master mode (clock generated internally from BRG)
0 = Slave mode (clock from external source)
Bit 6 TX9: 9-bit Transmit Enable bit
1 = Selects 9-bit transmission
0 = Selects 8-bit transmission
Bit 5 TXEN: Transmit Enable bit
1 = Transmit enabled
0 = Transmit disabled
Note: SREN/CREN overrides TXEN in Sync mode.
Bit 4 SYNC: USART Mode Select bit
1 = Synchronous mode
0 = Asynchronous mode
Bit 3 Unimplemented: Read as ‘0’
Bit 2 BRGH: High Baud Rate Select bit
Asynchronous mode:
1 = High speed
0 = Low speed
Synchronous mode:
Unused in this mode.
Bit 1 TRMT: Transmit Shift Register Status bit
1 = TSR empty
0 = TSR full
Bit 0 TX9D: 9th bit of Transmit Data, can be Parity bit

ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE

The Analog-to-Digital (A/D) Converter module has five inputs for the 28-pin devices and eight for the 40/44-pin devices. The conversion of an analog input signal results in a corresponding 10-bit digital number. The A/D module has high and low-voltage reference input that is software selectable to some combination of VDD, VSS, RA2 or RA3. The A/D converter has a unique feature of being able to operate while the device is in Sleep mode. To operate in Sleep, the A/D clock must be derived from the A/D’s internal RC oscillator.
The A/D module has four registers. These registers are:
Ø  A/D Result High Register (ADRESH)
Ø   A/D Result Low Register (ADRESL)
Ø  A/D Control Register 0 (ADCON0)
Ø  A/D Control Register 1 (ADCON1)







Block diagram















MEMORY ORGANIZATION

There are three memory blocks in each of thePIC16F87XA devices. The program memory and data memory have separate buses so that concurrent access can occur and is detailed in this section. The PIC16F876A/877A devices have 8K words x 14 bits of Flash program memory, while PIC16F873A/874A devices have 4K words x 14 bits. Accessing a location above the physically implemented address will cause a wrap around .The Reset vector is at 0000h and the interrupt vector is at 0004h.

PIC16F876A/877APROGRAM MEMORY MAP AND STACK







Data Memory Organization

The data memory is partitioned into four banks which contain the General Purpose Registers and the Special Function Registers. Each bank extends up to 7Fh (128 bytes). The lower locations of each bank are reserved for the Special Function Registers. Above the Special Function Registers are General Purpose Registers, implemented as static RAM. All implemented banks contain Special Function Registers. Some frequently used Special Function Registers from one bank may be mirrored in another bank for code reduction and quicker access.

Chip Configuration Word

This sets up aspects of the chip operation which cannot be sub-sequently changed without reprogramming. A special area of program memory outside the normal range (address 2007h) stores a chip configuration word; the clock type, and other MCU options are set by loading the configuration bits with a suitable binary code

1. Code protection

Normally, the program machine code can be read back to the programming host computer, be disassembled and the original source program recovered. This can be prevented if commercial or security considerations require it.

2. In-Circuit Debugging

In-circuit debugging (ICD) allows the program to be downloaded after the chip has been fitted in the application circuit, and allows it to be tested with the real hardware. With ICD, the chip can be programmed, and reprogrammed during debugging, while avoiding possible electrical and mechanical damage caused by removal from the circuit.

3. Low voltage programming

Normally, when the chip is programmed, a high voltage (12–14 V) is applied to the MCLR pin. To avoid the need to supply this voltage during in-circuit programming (e.g. during remote reprogramming), a low-voltage programming mode is available; however,   option means that RB3 is not then available for general I/O functions during normal operation.

4 .Power-up timer

         When the supply power is applied to the programmed MCU, the start of program execution should be delayed until the power supply and clock are stable, other-wise the program may not run correctly. The power-up timer may therefore be enabled as a matter of routine. It avoids the need to reset the MCU manually at start up, or connect an external reset circuit, as is necessary with some microprocessors. An internal oscillator provides a delay between the power coming on and an internal MCU reset of about 72 ms. this is followed by an oscillator start up delay of 1024 cycles of the clock before program execution starts. At a clock frequency of 4 MHz, this works out to 256 μs.

5. Brown-out reset

Brown out refers to a short dip in the power-supply voltage, caused by mains supply fluctuation, or some other supply fault, which might interrupt the program execution. If the Brown- Out Detect Enable bit (BODEN) is set, a PSU glitch will cause the device to be held in reset until the supply recovers, and then wait for the power-up timer to time out, before restarting.

6. Watchdog timer

The watchdog timer is designed to automatically reset the MCU if the programmable functions, by stopping or getting stuck in loop. This could be caused by an undetected bug in the program, an unplanned sequence of inputs or supply fault. A separate internal oscillator and counter automatically generate a reset, unless this is disabled in the configuration word. If the watchdog timer is enabled, it should be regularly reset by an instruction in the program loop (CLRWDT) to prevent the reset. If the program hangs, and the watchdog timer reset instruction not executed, the MCU will restart.

7. RC oscillator

The MCU clock drives the program along, providing the timing signals for program execution. The RC (resistor–capacitor) clock is cheap and cheerful, requiring only these two external components, operating with the internal clock driver circuit, to generate the clock. The time constant (product of R & C) determines the clock period. A variable resistor cans be used to give a manually adjustable frequency, although it is not very stable or accurate.

8. Crystal oscillator

If greater precision is required, especially if the program uses the hardware timers to make accurate measurements or generate precise output signals, a crystal (XTAL) oscillator is needed .Normally, it is connected across the clock pins with a pair of small capacitors (15 pF) to stabilize the frequency. A convenient value is 4 MHz; this gives an instruction cycle time of 1μs. This is also the maximum frequency allowed for the XT configuration setting. The PIC 16FXXXA series MCU generally run at a maximum clock rate of 20 MHz, using a high-speed (HS) crystal which requires the selection of the HS configuration option.
PIR Sensor

The PIR (Passive Infra-Red) Sensor is a pyro electric device that detects motion by measuring changes in the infrared levels emitted by surrounding objects. This motion can be detected by checking for a high signal on a single I/O pin.
THEORY OF OPERATION

                                 Pyro electric devices, such as the PIR sensor, have elements made of a crystalline material that generates an electric charge when exposed to infrared radiation. The changes in the amount of infrared striking the element change the voltages generated, which are measured by an on-board amplifier. The device contains a special filter called a Fresnel lens, which focuses the infrared signals onto the element. As the ambient infrared signals change rapidly, the on-board amplifier trips the output to indicate motion

Features

·                Single bit output
·                Small size makes it easy to conceal
·                Compatible with all Parallax microcontrollers
Application

·               Alarm Systems
·               Halloween Props
·               Robotics

Pin Definitions and Ratings

Pin                           Name                          Function
-                                GND                           Connects to Ground or Vss
+                               V+                              Connects to +5 VDC or Vdd
OUT                                     Output                         Connects to an I/O pin set to INPUT mode

GSM/GPRS Modem TTL (5V)

GSM/GPRS Modem-TTL (5V) from rhydo LABZ is built with Tri-band GSM/GPRS engine, works on frequencies EGSM 900 MHz, DCS 1800 MHz and PCS 1900 MHz. It is very compact in size and easy to use as plug in module. The Modem is coming with 5V TTL interface, which allows you to connect directly to 5V microcontroller/Arduino. The baud rate is configurable from 9600- 115200 through AT command. The GSM/GPRS TTL Modem is having internal TCP/IP stack to enable you to connect with internet via GPRS. It is suitable for SMS as well as DATA transfer application in M2M interface.

FEATURES

·              High Quality Product (Not hobby grade)
·              Plug and Play Module
·              Tri-Band GSM/GPRS 900/ 1800/ 1900 MHz
·              5V TTL interface for direct connection with MCU/Arduino
·              Configurable baud rate
·              SMA connector with GSM Antenna.
·              Built in SIM Card holder.
·              Built in Network Status LED
·              Inbuilt Powerful TCP/IP protocol stack for internet data transfer over GPRS.
·              Standard 2.54mm Connector Pitch
·              Switch ON/OFF Pin at connector
·              Status LED Pin at connector
·              Hardware Flow controlling pins available at connector

SPECIFICATIONS

·              Tri-Band GSM/GPRS 900/ 1800/ 1900 MHz
·              GPRS multi-slot class 10
·              Compliant to GSM phase 2/2+
·              Class 4 (2W@ 900 MHz)
·              Class 1 (1W@ 1800/1900MHz)
·              Built in Powerful TCP/IP
·              Data Specifications
·              GPRS Class 10 - max 85.6 kbps (downlink)
·              Coding scheme 1, 2, 3, 4
·              CSD up to 14.4 kbps
·              PPP Stack
·              Non transparent mode
·              Normal operation temperature: -20 °C to +55 °C
·               
LCD display
Internal block diagram of LCD display
                                                                                  


INTERFACE PIN CONNECTIONS

SEVEN DARLINGTON ARRAYS
       The ULN2001A, ULN2002A, ULN2003 and ULN2004Aare high voltage, high current darling ton arrays each containing seven open collector darling ton pairs with common emitters. Each channel rated at 500mAand can withstand peak currents of 600mA.Suppressiondiodesare included for inductive load driving and the inputs are pinned opposite the outputs to simplify board layout. The four versions interface to all common logic families.
        
These versatile devices are useful for driving a wide range of loads including solenoids, relays DC motors; LED displays filament lamps, thermal print heads and high power buffers. The ULN2001A/2002A/2003Aand 2004Aare supplied in 16 pin plastic DIP packages with a copper lead frame to reduce thermal resistance.




CRYSTAL OSCILLATOR

                                 A crystal oscillator is an electronic circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around them were called "crystal oscillators".

                                  
                                                Fig: - CRYSTAL OSCILLATOR

OPERATION

                                 A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a regularly ordered, repeating pattern extending in all three spatial dimensions.Almost any object made of an elastic material could be used like a crystal, with appropriate transducers, since all objects have natural resonant frequencies of vibration. For example, steel is very elastic and has a high speed of sound. It was often used in mechanical filters before quartz.

COMMONLY USED CRYSTAL FREQUENCIES

                                 Crystal oscillator circuits are often designed around relatively few standard frequencies, such as 3.58 MHz, 10 MHz, 14.318 MHz, 20 MHz, 33.33 MHz, and 40 MHz. The popularity of the 3.58 MHz and 14.318 MHz crystals is due

to low cost since they are used for television color receivers. Using frequency dividers, frequency multipliers and phase locked loop circuits, it is practical to derive a wide range of frequencies from one reference frequency.

BUZZER
                    
                                 It most commonly consists of a number of switches or sensors connected to a control unit that determines if and which button was pushed or a preset time has lapsed, and usually illuminates a light on the appropriate button or control panel, and sounds a warning in the form of a continuous or intermittent buzzing or beeping sound.

POWER SUPPLY
                     For the proper operation of a circuit a power supply has a main role. The power supply converts AC main supply to regulated DC voltage. A regulated DC power supply refers to the circuit whose output is constant DC voltage which will not change its value when there is a change in the AC main voltage and the load. The detailed block diagram and circuit of the 9v DC regulated power supply.
The DC regulated power supply consists of the following parts
Ø   Step down transformer (9v)
Ø   Rectifier circuit
Ø   Regulator circuit
  STEP DOWN TRANSFORMER
                     A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductors—the transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core, and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF) or "voltage" in the secondary winding.
The step down transformer is used to reduce or step down the main AC voltage to a low value AC supply. The transformer primary winding is connected to mains 230v, 50 Hz AC supply. The voltage across the secondary of this transformer is a 12v AC voltage. The output from the The transformer is based on two principles: firstly, that an electric current can produce a magnetic field (electromagnetism) and secondly that a changing magnetic field within a coil of wire induces a voltage across the ends of the coil (electromagnetic induction). Changing the current in the primary coil changes the magnetic flux that is developed. The changing magnetic flux induces a voltage in the secondary coil.
                             
Current passing through the primary coil creates a magnetic field. The primary and secondary coils are wrapped around a core of very high magnetic permeability, such as iron, so that most of the magnetic flux passes through both primary and secondary coils
Fig:-Step down transformer



RECTIFIER CIRCUIT
                                 The rectifier circuit consists of a full wave bridge rectifier circuit. The rectifier consists of a four diodes D1, D2, D3andD4. IN this circuit, during the positive half cycle of the secondary will forward bias the diodes D2and D4 and load to ground.
       
At this time the diodes D1and D3 is in reverse biased and current does not flow through it. During the negative half cycle of the secondary will forward bias the diodes D1and D2 and load to ground. At this time the diodes D2and D4 is in reverse biased and current does not flow through it.
 REGULATOR CIRCUITS
                                 The DC output from the filter circuit changes according to change in the load values or according in the input AC main supply. To keep this DC output constant irrespective of change in the input AC main voltage and load, a circuit known as regulator circuit is used. In this circuit, a voltage regulator IC 7805 is used to get a +5v regulated DC output voltage.
The7805 is a three pin IC used for voltage regulation at 5v. The first pin of the IC is its input terminal to which unregulated DC voltage is applied. The second pin is its ground terminal and unregulated +5v DC voltage is obtained across the third terminal with respect to the ground. The regulator is the last stage in the power supply.



COMPONENTS LIST

Sl no
components
specifications
quantity

1

Microcontroller


16F877A

1
     
      2

Bridge rectifier


MICW10M

1

3

Regulator IC


LM7805

1

4

Transformer

0-230V/0-15
500Ma

1

5

Crystal


4MHz

1

6

Electrolytic capacitor
1000µf50v
1
10µf16v,4.7µf63v
1

7

Disk capacitor
.1µf
1
22pf
2


8


Resistor
220E
2
10K
4
100E
3
2.2K,3.9K,56E,1.5K
1

9

LED


5mm

4

10

IR sensor                                 


TSOP1738

2

11

Motor


L293DD

2

12

Buzzer



1

13

LCD Display      



1
SOFTWARE DISCRIPTION

        MPLAB IDE


                         MPLAB Integrated Development Environment (IDE), integrated tool set for the development of embedded applications employing Microchip's PIC® and dsPIC® microcontrollers. MPLAB IDE runs as a32-bit application on MS Windows®, is easy to use and includes a host of free software components for fast application development and super- charged debugging. MPLAB IDE also serves as a single, unified graphical user interface for additional Microchip and third party software graphical user interface for additional Microchip and third party


software and hardware development tools. A development system for embedded controllers is a system of program running on desktop pc to help write, read, debug and program code the intelligence of embedded system applications into a microcontroller. MPLAB IDE runs on a pc and contains all the components needed to debug and depoly embedded system applications.
                               MPLAB IDE programmers editor helps write correct code with language tools of choice. The editor is aware of the assembler and compiler programming constructs and automatically colors-keys‟‟ the source code to help ensure it is syntactically correct. The project manager enables you to organize the various files used in your applications: source files, processor description header files and library files. When the code built, you can control how rigorously code will be optimized for size or speed by compiler and where individual variables and program data will be programmed into the device.
                               The MPLAB Editor is an integrated part of the MPLAB IDE Integrated Development Environment. The editor is always available when MPLAB IDE is running. The MPLAB IDE and MPLAB Editor are designed to provide developers with an easy and quick method to develop and debug firmware for Microchip Technology’s PIC micro microcontroller (MCU) and ds PIC digital signal controller (DSC) product families

DESCRIPTION OF AN “EMBEDDED SYSTEM

                         An embedded system is typically a design making use of the power of a small microcontroller, like the Microchip PICmicro® MCU or dsPIC® Digital Signal Controller (DSCs). These microcontrollers combine a microprocessor unit (like the CPU in a desktop PC) with some additional circuits called “peripherals”, plus some additional circuits on the same chip to make a small control module requiring few other external devices. This single device can then be embedded into other electronic and mechanical devices for low-cost digital control.


        
Fig:-PIC programmer

















PROGRAM










MICROCONTROLLER PROGRAM
#include<16f73.h>
#include<string.h>
#fuses HS,NOWDT,PUT,NOBROWNOUT//,NOLVP
#use delay(clock=4M)
#define PIR_Sensor   PIN_C5
#define buzzer      PIN_C4
#define buzzer_on   output_high(buzzer)
#define buzzer_off   output_low(buzzer)
int8 const phno1[]="+919633896565";
//#rom 0x2100={00}
#define device_stat_addr   0
int8 device_status,sms_no,buffer_string[25],PIR_flag,SMS_Flag;
#include"LCD_4bit.c"
#include"sim_300.c"
int8 check_sms()
{
   output_toggle(PIN_A5);
   sms_no++;
   if(sms_no >5)
      sms_no=1;
   delay_ms(100);
   if(get_sms(sms_no))
   {
      strcpy(buffer_string,phno1);
      if(!strcmp(ph_number,buffer_string))
      {
      return 1; 

      }
   }
   return 0;
}
        
  
void test_signal()
{
   int8 strength;
   lcd_send_cmd(lcd_clear);
   while(TRUE)
   {
      output_toggle(PIN_A5);
      //sync();
      delay_ms(2000);
      strength=read_strength();
      if(strength>31)
         strength=0;
      lcd_goto(1,1);
      lcd_send_byte(CUST_CHAR_1);
     
      if(strength==0)
         lcd_send_byte(' ');
      else if(strength<6)
         lcd_send_byte(CUST_CHAR_2);
      else if(strength<15)
         lcd_send_byte(CUST_CHAR_3);
      else if(strength<18)
         lcd_send_byte(CUST_CHAR_4);
      else if(strength<24)
         lcd_send_byte(CUST_CHAR_5);
      else
         lcd_send_byte(CUST_CHAR_6);
      lcd_goto(2,1);
      printf(lcd_send_byte,"%03u",strength);
//     
//      for(strength=0;strength<5;strength++)
//         printf(lcd_send_byte,"%2X,",ph_number[strength]);
    
   }
}     


void init_ports()
{
            int8 count_down,count;
            delay_ms(100);
            buzzer_off;
            setup_adc_ports(NO_ANALOGS);
            output_a(0);
            lcd_init();
            lcd_init_custom_chars();
            welcome_note();
            lcd_goto(1,1);
            count_down=60;
            sync();
            lcd_send_byte("Initializing... ");
            for(count=0;count<30;count++)
            {
                        lcd_goto(2,1);
                        printf(lcd_send_byte,"Wait %02u Sec",count_down);
                        count_down--;
                        delay_ms(1000);
            }
            lcd_send_cmd(lcd_clear);
            sync();
            device_status=0;
//          test_signal();
}
void display_status()
{
            //lcd_send_cmd(lcd_clear);
            lcd_goto(1,1);
            if(device_status==1)
                        lcd_send_byte("S/M Activated   ");
            else
                        lcd_send_byte("S/M Deactivated ");
}         

void process_sms()
{
   SMS_flag=0;
   delay_ms(10);
   strcpy(buffer_string,"ACT");
   if(!strcmp(sms_buffer,buffer_string))
   {
      device_status=1;
      strcpy(sms_buffer,"PIR:ON");
      SMS_flag=1;
   }  
   else
   {  
      strcpy(buffer_string,"DACT");
      if(!strcmp(sms_buffer,buffer_string))
      {
        device_status=0;
         strcpy(sms_buffer,"PIR:OFF");
         SMS_flag=1;
         buzzer_off;
         PIR_flag=0;
         lcd_send_cmd(lcd_clear);
      }  
   }
   if(sms_flag)
            display_status();


}

void test_buzzer()
{
   buzzer_on;
   delay_ms(500);
   buzzer_off;
}                                   

void main()
{
   int8 check_count=0;
   delay_ms(100);
   test_buzzer();
   init_ports();
   display_status();
   delay_ms(2000);
   output_low(PIN_A5);
   sms_no=5;
   PIR_flag=0;
   device_status=0;
   while(TRUE)
   {
                        if(check_count>4)
                        {
                                    check_count=0;
                                    if(check_sms())
                                    {
                                                process_sms();
                                               
                                                if(SMS_flag==1)
                                                {
                                                            delay_ms(2000);
                                                            strcpy(ph_number,phno1);
                                                            //send_sms();
                                                            delay_ms(1000);  
                                                }  
                                    }
                        }  
                        if(device_status)
                        {
                                    if(input(PIR_Sensor) && PIR_flag==0)
                                    {
                                                buzzer_on;
                                                lcd_goto(2,1);
                                                lcd_send_byte("Human Detected  ");
                                                delay_ms(5000);
                                                buzzer_off;
                                                strcpy(ph_number,phno1);
                                                strcpy(sms_buffer,"Human Detected");
                                                //send_sms();
                                                PIR_flag=1;
                                                check_count=0;
                                    }
                        }        
                        delay_ms(1000);  
                        check_count++;
            }  

}  






Lcd program

#define first_line   128
#define second_line   192   
#define third_line   148  
#define fourth_line   212
#define lcd_clear   1
#define cursor_on   15
#define cursor_off   12
#define cursor_left   16
#define cursor_right   20
#define LCD_CGRAM_ADDR 0x40
#define CUST_CHAR_1 0x00
#define CUST_CHAR_2 0x01
#define CUST_CHAR_3 0x02
#define CUST_CHAR_4 0x03
#define CUST_CHAR_5 0x04
#define CUST_CHAR_6 0x05
#define CUST_CHAR_7 0x06
#define CUST_CHAR_8 0x07
int8 i;
struct lcd_pin_map
    {   
       BOOLEAN rs;
       BOOLEAN rw;     
       BOOLEAN enable;
       BOOLEAN unused;
       int     data : 4;
   } lcd;          
       
#locate lcd = getenv("sfr:PORTB")    // This puts the entire structure over the port
#define set_tris_lcd(x) set_tris_B(x)
struct lcd_pin_map const LCD_WRITE = {0,0,0,0,0}; // For write mode all pins are out
struct lcd_pin_map const LCD_READ = {0,0,0,0,15}; // For read mode data pins are in
BYTE const LCD_INIT_STRING[4] = {0x28,0x06,0x0C,0X01};
BYTE const LCD_CUSTOM_CHARS[64] =
{0,0,0,0,31,10,4,4,
0,0,0,0,0,0,16,16,
0,0,0,0,8,8,24,24,
0,0,4,4,12,12,28,28,
2,2,6,6,14,14,30,30,
3,3,7,7,15,15,31,31,
4,4,31,4,4,10,21,27,
27,27,0,27,27,21,10,4};

BYTE lcd_read_byte()
{
      BYTE low,high;
      set_tris_lcd(LCD_READ);
      lcd.rs = 0;
      delay_cycles(1);
      lcd.rw = 1;
      delay_cycles(1);
      lcd.enable = 1;
      delay_cycles(1);
      high = lcd.data;
      lcd.enable = 0;
      delay_cycles(1);
      lcd.enable = 1;
      delay_us(1);
      low = lcd.data;
      lcd.enable = 0;
      set_tris_lcd(LCD_WRITE);
      return( (high<<4) | low);
}

BYTE read_lcd()
 {
      BYTE low,high;
      while ( bit_test(lcd_read_byte(),7) ) ;
      set_tris_lcd(LCD_READ);
      lcd.rs = 1;
      delay_cycles(1);
      lcd.rw = 1;
      delay_cycles(1);
      lcd.enable = 1;
      delay_cycles(1);
      high = lcd.data;
      lcd.enable = 0;
      delay_cycles(1);
      lcd.enable = 1;
      delay_us(1);
      low = lcd.data;
      lcd.enable = 0;
      set_tris_lcd(LCD_WRITE);
      return( (high<<4) | low);
}


void lcd_send_nibble( BYTE nibb ) {
      lcd.data = nibb;
      delay_cycles(1);
      lcd.enable = 1;
      delay_us(2);
      lcd.enable = 0;
}


void lcd_send_byte(BYTE n )
{
      while ( bit_test(lcd_read_byte(),7) ) ;
        delay_ms(1);
       lcd.rs = 1;
      delay_cycles(1);
      lcd.rw = 0;
      delay_cycles(1);
      lcd.enable = 0;
      lcd_send_nibble(n >> 4);
      lcd_send_nibble(n & 0xf);
}
void lcd_send_cmd(BYTE n )
{
      while ( bit_test(lcd_read_byte(),7) ) ;
      delay_ms(1);
      lcd.rs = 0;
      delay_cycles(1);
      lcd.rw = 0;
      delay_cycles(1);
      lcd.enable = 0;
      lcd_send_nibble(n >> 4);
      lcd_send_nibble(n & 0xf);
}


void lcd_out(int8 *_dest_reg)
{
    while(*_dest_reg)
    {
        lcd_send_byte(*_dest_reg);
        _dest_reg++;
    }
   
}

int1 is_lcd_connected()
{
   byte temp=0;
   lcd_send_cmd(0x80);
   lcd_send_byte('B');
   lcd_send_cmd(0x80);
   temp=read_lcd();
   if(temp!='B')
      return 0;
   else
      return 1;

}


void lcd_init() {
    BYTE i;
    set_tris_lcd(LCD_WRITE);
    lcd.rs = 0;
    lcd.rw = 0;
    lcd.enable = 0;
    delay_ms(15);
    for(i=0;i<3;i++) {
       lcd_send_nibble(3);
       delay_ms(5);
    }
    lcd_send_nibble(2);
    for(i=0;i<4;i++)
       lcd_send_cmd(LCD_INIT_STRING[i]);
    while(!is_lcd_connected());
    lcd_send_cmd(lcd_clear); 
}

void lcd_goto(int8 x, int8 y)
{
   int8 address;
   switch(x)
   {
      case 1:
         address = first_line;
         break;
      case 2:
         address = second_line;
         break;
      case 3:
         address = third_line;
         break;
      case 4:
         address = fourth_line;
         break;
      default:
         address = first_line;
         break;
  
   }

   address += (Y-1);
   lcd_send_cmd(address);
}

void lcd_init_custom_chars()
{
   BYTE i;
   lcd_send_cmd(LCD_CGRAM_ADDR);
   for(i=0;i<=63;i++)
   {
      lcd_send_byte(LCD_CUSTOM_CHARS[i]);
      delay_ms(2);
   }
}
void welcome_note()
{
    lcd_send_cmd(lcd_clear);
    lcd_goto(1,1);
    lcd_send_byte("Human Detection ");
    lcd_goto(2,1);
    lcd_send_byte("  And Remote    ");
    delay_ms(1000);
    lcd_goto(1,1);
    lcd_send_byte("  Notification  ");
    lcd_goto(2,1);
    lcd_send_byte("  Using GSM     ");
    delay_ms(1000);
    lcd_send_cmd(lcd_clear);
   
}


SIM CARD PROGRAM


#users232(baud=9600,xmit=pin_C6,rcv=pin_C7,parity=n,bits=8,stop=1,stream=GSM,timeout=500)
 int8 sms_buffer[40],ph_number[15];
 void sync()
 {
   fprintf(GSM,"AT\n\r");
   delay_ms(100);
   fprintf(GSM,"AT\n\r");
   delay_ms(100);
   fprintf(GSM,"AT\n\r");
   delay_ms(100);
   fprintf(GSM,"AT\n\r");
   delay_ms(100);
}

void dial_modem()
{
   int8 i=0;
   fputc('A',GSM);
   fputc('T',GSM);
   fputc('D',GSM);
   fputc(' ',GSM);
  
   while(ph_number[i] !='\0' && i<16)
   {
      fputc(ph_number[i],GSM);
      i++;
   }
   fputc(';',GSM);
   fputc(0x0D,GSM);
   fputc(0x0A,GSM);
}

void hang_call()
{
   fputc('A',GSM);
   fputc('T',GSM);
   fputc('H',GSM);
   fputc(0x0D,GSM);
   fputc(0x0A,GSM);
}
void set_text_mode()
{
   sync();
   fprintf(GSM,"AT+CMGF=1\n\r");
  
}

int1 read_char(int8 check_char)
{
            int8 rx_no,rx_char;
            for(rx_no=0;rx_no<50;rx_no++)
            {
                        rx_char=fgetc(GSM);
                        if(rx_char==check_char)
                                    return 1;
            }
            return 0;
}

int1 get_sms(int8 intex_no)
{
            int8 count=0,success_flag=0;
            set_text_mode();
            delay_ms(100);
            fprintf(GSM,"AT+CMGR=%u\n\r",intex_no);
            //while(fgetc(GSM)!=0x0A);
            if(read_char(0x0A))
            {
                        if(fgetc(GSM)=='+')
                        {  

                                    //while(fgetc(GSM)!='"');
                                    if(read_char('"'))
                                    {
                                                //while(fgetc(GSM)!='"');
                                                if(read_char('"'))
                                                {
                                                            //while(fgetc(GSM)!='"');
                                                            if(read_char('"'))
                                                            {
                                                                        do
                                                                        {
                                                                                    ph_number[count]=fgetc(GSM);
                                                                                    count++;
                                                                        }while(ph_number[count-1] !='"' && count<15);
                                                                        ph_number[count-1]='\0';
                                                                        //while(fgetc(GSM)!=0x0A);
                                                                        if(read_char(0x0A))
                                                                        {
                                                                                    count=0;
                                                                                    do
                                                                                    {
                                                                                                sms_buffer[count]=fgetc(GSM);
                                                                                                count++;
                                                                                    }while(sms_buffer[count-1] !=0x0D && count<24);
                                                                                    sms_buffer[count-1]='\0';
                                                                                    if(count<24)
                                                                                    {
                                                                                                delay_ms(500);
                                                                                                sync();  
                                                                                                fprintf(GSM,"AT+CMGD=%u\n\r",intex_no);//delete sms
                                                                                                success_flag=1;
                                                                                    }         
                                                                        }
                                                            }
                                               
                                                }
                                    } 
                       
                        }
            }
            if(success_flag)
            {
                        return 1;
            }         
            else
            {
                        return 0;  
            }  
     
}
void send_sms()
{
   int8 array_index;
   set_text_mode();
   delay_ms(100);
   fprintf(GSM,"AT+CMGS=");
   fputc('"',GSM);
   array_index=0;
   while(ph_number[array_index] !='\0')
   {
      fputc(ph_number[array_index],GSM);
      array_index++;
   }
   fputc('"',GSM);
   fputc(0x0D,GSM);
//   fputc(0x0A,GSM);
   while(fgetc(GSM) !=' ');
   array_index=0;
   while(sms_buffer[array_index] !='\0')
   {
      fputc(sms_buffer[array_index],GSM);
      array_index++;
   }
   fputc(0x1A,GSM);// Ctrl-Z
   delay_ms(100);
   fgetc(GSM);
}     

//int8 read_strength()
//{
//   int8 rssi[3],rssi_byte;
//   //output_low(PIN_A5);
//   fprintf(GSM,"AT+CSQ\n\r");
//   while(fgetc(GSM) !=' ');
//   //output_high(PIN_A5);
//   rssi[0]=fgetc(GSM) & 0x0F;
//   rssi[1]=fgetc(GSM) & 0x0F;
//   rssi_byte=rssi[0]*10;
//   rssi_byte=rssi_byte+rssi[1];
//   return rssi_byte;
//}  
  
  
int8 read_strength()
{
   int8 rssi[3],rssi_byte=5;
   //output_low(PIN_A5);
   fprintf(GSM,"AT+CSQ\n\r");
   if(read_char(' '))
   {
               //output_high(PIN_A5);
               rssi[0]=fgetc(GSM) & 0x0F;
               rssi[1]=fgetc(GSM) & 0x0F;
               rssi_byte=rssi[0]*10;
               rssi_byte=rssi_byte+rssi[1];
   }
   return rssi_byte;
}  
        






































MPLAB COMPILER
MPLAB COMPILER

In this project software section compiling is done using an MPLAB compiler.

MPLAB ICD 2

The MPLAB ICD 2 is a low-cost in-circuit serial programmer (ICSP). MPLAB ICD 2 is intended to be used as a programming aid in a laboratory environment. The MPLAB ICD 2 offers these features:
• Target Vdd monitor
• Diagnostic LEDs
• MPLAB IDE user interface
• RS-232 serial interface to a host PC

Installing and Configuring MPLAB IDE for MPLAB ICD 2

To install the MPLAB IDE software, first acquire the latest MPLAB IDE installation executable (MPxxxxx.exe, where xxxxx represents the version of MPLAB IDE) from the Microchip web site (www.microchip.com)

Serial Communications

Connect the RS-232 cable to the MPLAB ICD 2 and the PC. The Flow Control and FIFO settings must be set properly for a serial communications port on a PC with a Windows operating system.

Changing Serial Port Settings

Complete the following steps to change the Flow Control and FIFO settings for a serial communications port on a PC running the Windows operating system.

Windows 2000/XP
1.      On your PC, select Start>Settings>Control Panel.
2.      In the Control Panel, double click the System Icon.
3.      In the Systems Properties dialog, click the Hardware tab and click the Device Manager Button.
4.      Double click "Ports (COM & LPT)" to expand the Ports selection.
5.      Double click the I/O port to which the MPLAB ICD 2 is connected.
6.      Select the Port Settings tab.
7.      In the Flow Control field, select Hardware.
8.      Click the Advanced button, deselect the "Use FIFO" box, and click OK.
9.      Reboot the PC to implement the change.
Setup Wizard

1.      Select Programmer
Programmer > Select Programmer > MPLAB ICD 2

 










2. Setup wizard


A setup wizard is available from Programmer>MPLAB ICD 2 Setup Wizard to help walk you through setting up your MPLAB ICD 2.



                                        





3. Setup Wizard – Welcome

The MPLAB ICD2 Setup Wizard will open. Follow the dialogs in the MPLAB ICD 2 Wizard to set up MPLAB ICD 2 for use with MPLAB IDE.








Click Next to continue.


4.      Setup Wizard - Select a Port

COM Port - Select a serial port (COM1-COM4) Baud Rate - For a serial port, select 19200 or 57600

 










Click Next to continue






5. Setup Wizard - Select Target Power

Select target power source - Choose Target has own power supply




Click Next to continue.










  1. Setup Wizard - Enable Auto Connect

Enable auto connection - Set up MPLAB IDE to automatically connect to MPLAB ICD 2 on project start-up.



Click Next to continue.










  1. Setup Wizard - Enable Automatic OS Download
Enable auto download of operating systems - Automatically download the correct OS for the selected device.



Click Next to continue.









  1. Setup Wizard - Summary
Check the summarized information. If anything is incorrect, use Back to return to the dialog you need and change the information.
 























Click Finish when you are satisfied with the MPLAB ICD 2 setup.

















PCB LAYOUT










    






PCB FABRICATION








PCB FABRICATION

A printed circuit board, or PCB, is used to mechanically support and electrically connect electronic components using conductive pathways, tracks or signal traces etched from copper sheets laminated onto a non-conductive substrate. It is also referred to as printed wiring board (PWB) or etched wiring board. A PCB populated with electronic components is a printed circuit assembly (PCA), also known as a printed circuit board assembly (PCBA)
PCBs are inexpensive, and can be highly reliable. They require much more layout effort and higher initial cost than either wire wrap or point-to-point construction, but are much cheaper and faster for high-volume production; the production and soldering of PCBs can be done by totally automated equipment. Much of the electronics industry's PCB design, assembly, and quality control needs are set by standards that are published by the IPC organization.

MANUFACTURING

Materials


Conducting layers are typically made of thin copper foil. Insulating layers dielectric is typically laminated together with epoxy resin prepreg. The board is typically coated with a solder mask that is green in color. Other colors that are normally available are blue, black, white and red. There are quite a few different dielectrics that can be chosen to provide different insulating values depending on the requirements of the circuit. Some of these dielectrics are polytetrafluoroethylene (Teflon), FR-4, FR-1, CEM-1 or CEM-3. Well known prepreg materials used in the PCB industry are FR-2 (Phenolic cotton paper), FR-3 (Cotton paper and epoxy), FR-4 (Woven glass and epoxy), FR-5 (Woven glass and epoxy), FR-6 (Matte glass and polyester), G-10 (Woven glass and epoxy), CEM-1 (Cotton paper and epoxy), CEM-2 (Cotton paper and epoxy), CEM-3 (Woven glass and epoxy), CEM-4 (Woven glass and epoxy), CEM-5 (Woven glass and polyester).

Patterning (etching)

The vast majority of printed circuit boards are made by bonding a layer of copper over the entire substrate, sometimes on both sides, (creating a "blank PCB") then removing unwanted copper after applying a temporary mask (e.g. by etching), leaving only the desired copper traces. A few PCBs are made by adding traces to the bare substrate (or a substrate with a very thin layer of copper) usually by a complex process of multiple electroplating steps. The PCB manufacturing method primarily depends on whether it is for production volume or sample/prototype quantities.
There are three common "subtractive" methods (methods that remove copper) used for the production of printed circuit boards:
  1. Silk screen printing uses etch-resistant inks to protect the copper foil. Subsequent etching removes the unwanted copper. Alternatively, the ink may be conductive, printed on a blank (non-conductive) board. The latter technique is also used in the manufacture of hybrid circuits.
  2. Photoengraving uses a photo mask and developer to selectively remove a photo resist coating. The remaining photo resist protects the copper foil. Subsequent etching removes the unwanted copper. The photo mask is usually prepared with a photo plotter from data produced by a technician using CAM, or computer-aided manufacturing software. Laser-printed transparencies are typically employed for photo tools; however, direct laser imaging techniques are being employed to replace photo tools for high-resolution requirements.
  3. PCB milling uses a two or three-axis mechanical milling system to mill away the copper foil from the substrate. A PCB milling machine (referred to as a 'PCB Proto typer') operates in a similar way to a plotter, receiving commands from the host software that control the position of the milling head in the x, y, and (if relevant) z axis. Data to drive the Proto type is extracted from files generated in PCB design software and stored in HPGL or Gerber file format.
"Additive" processes also exist. The most common is the "semi-additive" process. In this version, the unpatented board has a thin layer of copper already on it. A reverse mask is then applied. (Unlike a subtractive process mask, this mask exposes those parts of the substrate that will eventually become the traces.) Additional copper is then plated onto the board in the unmasked areas; copper may be plated to any desired weight. Tin-lead or other surface plantings are then applied. The mask is stripped away and a brief etching step removes the now-exposed original copper laminate from the board, isolating the individual traces. Some boards with plated through holes but still single sided were made with a process like this. General Electric made consumer radio sets in the late 1960s using boards like these. The additive process is commonly used for multi-layer boards as it facilitates the plating-through of the holes (to produce conductive vias) in the circuit board.

Lamination

Some PCBs have trace layers inside the PCB and are called multi-layer PCBs. These are formed by bonding together separately etched thin boards.

Drilling

Holes through a PCB are typically drilled with small-diameter drill bits made of solid coated tungsten carbide. Coated tungsten carbide is recommended since many board materials are very abrasive and drilling must be high RPM and high feed to be cost effective. Drill bits must also remain sharp to not mar or tear the traces. Drilling with high-speed-steel is simply not feasible since the drill bits will dull quickly and thus tear the copper and ruin the boards. The drilling is performed by automated drilling machines with placement controlled by a drill tape or drill file. These computer-generated files are also called numerically controlled drill (NCD) files or "Excellon files". The drill file describes the location and size of each drilled hole. These holes are often filled with annular rings (hollow rivets) to create vias. Vias allow the electrical and thermal connection of conductors on opposite sides of the PCB. When very small vias are required, drilling with mechanical bits is costly because of high rates of wear and breakage. In this case, the vias may be evaporated by lasers. Laser-drilled vias typically have an inferior surface finish inside the hole. These holes are called micro vias.
It is also possible with controlled-depth drilling, laser drilling, or by pre-drilling the individual sheets of the PCB before lamination, to produce holes that connect only some of the copper layers, rather than passing through the entire board. These holes are called blind vias when they connect an internal copper layer to an outer layer, or buried vias when they connect two or more internal copper layers and no outer layers.
The walls of the holes, for boards with 2 or more layers, are made conductive then plated with copper to form plated-through holes that electrically connect the conducting layers of the PCB. For multilayer boards, those with 4 layers or more, drilling typically produces a smear of the high temperature decomposition products of bonding agent in the laminate system. Before the holes can be plated through, this smear must be removed by a chemical de-smear process, or by plasma-etch. Removing (etching back) the smear also reveals the interior conductors as well.

Exposed conductor plating and coating

PCBs are plated with solder, tin, or gold over nickel as a resist for etching away the unneeded underlying copper After PCBs are etched and then rinsed with water, the solder mask is applied, and then any exposed copper is coated with solder, nickel/gold, or some other anti-corrosion coating.
Matte solder is usually fused to provide a better bonding surface or stripped to bare copper. Treatments, such as benzimidazolethiol, prevent surface oxidation of bare copper. The places to which components will be mounted are typically plated, because untreated bare copper oxidizes quickly, and therefore is not readily solder able. Traditionally, any exposed copper was coated with solder by hot air solder leveling (HASL). The HASL finish prevents oxidation from the underlying copper, thereby guaranteeing a solder able surface.[9] This solder was a tin-lead alloy, however new solder compounds are now used to achieve compliance with the RoHS directive in the EU and US, which restricts the use of lead. One of these lead-free compounds is SN100CL, made up of 99.3% tin, 0.7% copper, 0.05% nickel, and a nominal of 60ppm germanium. It is important to use solder compatible with both the PCB and the parts used. An example is Ball Grid Array (BGA) using tin-lead solder balls for connections losing their balls on bare copper traces or using lead-free solder paste .Other plating’s used are OSP (organic surface protectant), immersion silver (IAg), immersion tin, electro less nickel with immersion gold coating (ENIG), and direct gold plating (over nickel). Edge connectors, placed along one edge of some boards, are often nickel plated then gold plated. Another coating consideration is rapid diffusion of coating metal into Tin solder. Tin forms inter metallic’s such as Cu5Sn6 and Ag3Cu that dissolve into the Tin liquids or solidus (@50C), stripping surface coating and/or leaving voids.
Electrochemical migration (ECM) is the growth of conductive metal filaments on or in a printed circuit board (PCB) under the influence of a DC voltage bias.[10][11] Silver, zinc, and aluminum are known to grow whiskers under the influence of an electric field. Silver also grows conducting surface paths in the presence of halide and other ions, making it a poor choice for electronics use. Tin will grow "whiskers" due to tension in the plated surface. Tin-Lead or Solder plating also grows whiskers, only reduced by the percentage Tin replaced. Reflow to melt solder or tin plate to relieve surface stress lowers whisker incidence. Another coating issue is tin pest, the transformation of tin to a powdery allotrope at low temperature.[12]\

Solder resist

Areas that should not be soldered may be covered with a polymer solder resist (solder mask) coating. The solder resist prevents solder from bridging between conductors and creating short circuits. Solder resist also provides some protection from the environment. Solder resist is typically 20–30 micro meters thick.

Screen printing

Line art and text may be printed onto the outer surfaces of a PCB by screen printing. When space permits, the screen print text can indicate component designators, switch setting requirements, test points, and other features helpful in assembling, testing, and servicing the circuit board. Screen print is also known as the silk screen, or, in one sided PCBs, the red print .Lately some digital printing solutions have been developed to substitute the traditional screen printing process. This technology allows printing variable data onto the PCB, including serialization and barcode information for traceability purposes.

Test

Unpopulated boards may be subjected to a bare-board test where each circuit connection (as defined in a netlist) is verified as correct on the finished board. For high-volume production, a Bed of nails tester, a fixture or a Rigid needle adapter is used to make contact with copper lands or holes on one or both sides of the board to facilitate testing. A computer will instruct the electrical test unit to apply a small voltage to each contact point on the bed-of-nails as required, and verify that such voltage appears at other appropriate contact points. A "short" on a board would be a connection where there should not be one; an "open" is between two points that should be connected but are not. For small- or medium-volume boards, flying probe and flying-grid testers use moving test heads to make contact with the copper/silver/gold/solder lands or holes to verify the electrical connectivity of the board under test. Another method for testing is industrial CT scanning, which can generate a 3D rendering of the board along with 2D image slices and can show details such a soldered paths and connections.

Printed circuit assembly

After the printed circuit board (PCB) is completed, electronic components must be attached to form a functional printed circuit assembly,[13][14] or PCA (sometimes called a "printed circuit board assembly" PCBA). In through-hole construction, component leads are inserted in holes. In surface-mount construction, the components are placed on pads or lands on the outer surfaces of the PCB. In both kinds of construction, component leads are electrically and mechanically fixed to the board with a molten metal solder.There are a variety of soldering techniques used to attach components to a PCB. High volume production is usually done with machine placement and bulk wave soldering or reflow ovens, but skilled technicians are able to solder very tiny parts (for instance 0201 packages which are 0.02 in. by 0.01 in.)[15] by hand under a microscope, using tweezers and a fine tip soldering iron for small volume prototypes. Some parts are impossible to solder by hand, such as ball grid array (BGA) packages.Often, through-hole and surface-mount construction must be combined in a single assembly because some required components are available only in surface-mount packages, while others are available only in through-hole packages. Another reason to use both methods is that through-hole mounting can provide needed strength for components likely to endure physical stress, while components that are expected to go untouched will take up less space using surface-mount techniques.
After the board has been populated it may be tested in a variety of ways:
Ø   While the power is off, visual inspection, automated optical inspection. JEDEC guidelines for PCB component placement, soldering, and inspection are commonly used to maintain quality control in this stage of PCB manufacturing.
Ø   While the power is off, analog signature analysis, power-off testing.
Ø   While the power is on, in-circuit test, where physical measurements (i.e. voltage, frequency) can be done.
Ø   While the power is on, functional test, just checking if the PCB does what it had been designed for.
To facilitate these tests, PCBs may be designed with extra pads to make temporary connections. Sometimes these pads must be isolated with resistors. The in-circuit test may also exercise boundary scan test features of some components. In-circuit test systems may also be used to program nonvolatile memory components on the board. In boundary scan testing, test circuits integrated into various ICs on the board form temporary connections between the PCB traces to test that the ICs are mounted correctly. Boundary scan testing requires that all the ICs to be tested use a standard test configuration procedure, the most common one being the Joint Test Action Group (JTAG) standard. The JTAG test architecture provides a means to test interconnects between integrated circuits on a board without using physical test probes. JTAG tool vendors provide various types of stimulus and sophisticated algorithms, not only to detect the failing nets, but also to isolate the faults to specific nets, devices, and pins.[16]

Protection and packaging

PCBs intended for extreme environments often have a conformal coating, which is applied by dipping or spraying after the components have been soldered. The coat prevents corrosion and leakage currents or shorting due to condensation. The earliest conformal coats were wax; modern conformal coats are usually dips of dilute solutions of silicone rubber, polyurethane, acrylic, or epoxy. Another technique for applying a conformal coating is for plastic to be sputtered onto the PCB in a vacuum chamber. The chief disadvantage of conformal coatings is that servicing of the board is rendered extremely difficult. Many assembled PCBs are static sensitive, and therefore must be placed in antistatic bags during transport. When handling these boards, the user must be grounded (earthed). Improper handling techniques might transmit an accumulated static charge through the board, damaging or destroying components. Even bare boards are sometimes static sensitive. Traces have become so fine that it's quite possible to blow an etch off the board (or change its characteristics) with a static charge. This is especially true on non-traditional PCBs such as MCMs and microwave PCBs.

Design

Ø   Schematic capture or schematic entry is done through an EDA tool.
Ø   Card dimensions and template are decided based on required circuitry and case of the PCB. Determine the fixed components and heat sinks if required.
Ø   Deciding stack layers of the PCB. 4 to 12 layers or more depending on design complexity. Ground plane and Power plane are decided. Signal planes where signals are routed are in top layer as well as internal layers.[18]
Ø   Line impedance determination using dielectric layer thickness, routing copper thickness and trace-width. Trace separation also taken into account in case of differential signals. Microstrip, stripline or dual stripline can be used to route signals.
Ø   Placement of the components. Thermal considerations and geometry are taken into account. Vias and lands are marked.
Ø   Routing the signal trace. For optimal EMI performance high frequency signals are routed in internal layers between power or ground planes as power plane behaves as ground for AC.
Ø   Gerber file generation for manufacturing.

Safety certification (US)

Safety Standard UL 796 covers component safety requirements for printed wiring boards for use as components in devices or appliances. Testing analyzes characteristics such as flammability, maximum operating temperature, electrical tracking, heat deflection, and direct support of live electrical parts

Multiwire boards

Multiwire is a patented technique of interconnection which uses machine-routed insulated wires embedded in a non-conducting matrix (often plastic resin). It was used during the 1980s and 1990s. (Kollmorgen Technologies Corp., U.S. Patent 4,175,816) Multiwire is still available in 2010 through Hitachi. There are other competitive discrete wiring technologies that have been developed (Jumatech [2]).
Since it was quite easy to stack interconnections (wires) inside the embedding matrix, the approach allowed designers to forget completely about the routing of wires (usually a time-consuming operation of PCB design): Anywhere the designer needs a connection; the machine will draw a wire in straight line from one location/pin to another. This led to very short design times (no complex algorithms to use even for high density designs) as well as reduced crosstalk (which is worse when wires run parallel to each other—which almost never happen in Multiwire), though the cost is too high to compete with cheaper PCB technologies when large quantities are needed.

Surface-mount technology

Surface mount components, including resistors, transistors and an integrated circuit Surface-mount technology emerged in the 1960s, gained momentum in the early 1980s and became widely used by the mid 1990s. Components were mechanically redesigned to have small metal tabs or end caps that could be soldered directly on to the PCB surface. Components became much smaller and component placement on both sides of the board became more common than with through-hole mounting, allowing much higher circuit densities. Surface mounting lends itself well to a high degree of automation, reducing labor costs and greatly increasing production and quality rates. Carrier Tapes provide a stable and protective environment for Surface mount devices (SMDs) which can be one-quarter to one-tenth of the size and weight, and passive components can be one-half to one-quarter of the cost of corresponding through-hole parts. However, integrated circuits are often priced the same regardless of the package type, because the chip itself is the most expensive part. As of 2006, some wire-ended components, such as small-signal switch diodes, e.g. 1N4148, are actually significantly cheaper than corresponding SMD versions.









SOLDERING
Soldering
Soldering is a process in which two or more metal items are joined together by melting and flowing a filler metal into the joint, the filler metal having a lower melting point than the work piece. Soldering differs from welding in that the work pieces are not melted. There are three forms of soldering, each requiring higher temperatures and each producing an increasingly stronger joint strength: soft soldering which originally used a tin-lead alloy as the filler metal, silver soldering which uses an alloy containing silver and brazing which uses a brass alloy for the filler. The alloy of the filler metal for each type of soldering can be adjusted to modify the melting temperature of the filler. Soldering appears to be a hot glue process, but it differs from gluing significantly in that the filler metals alloy with the work piece at the junction to form a gas and liquid tight bond.[1]

Applications

Soldering was historically used to make jewelry items, cooking ware and tools. Currently, the two most common uses of soldering are in plumbing and in electronics where it is used to connect electrical wiring and to connect electronic components to printed circuit boards (PCBs). It provides reasonably permanent but reversible connections between copper pipes in plumbing systems as well as joints in sheet metal objects such as food cans, roof flashing, rain gutters and automobile radiators. Jewelry components, machine tools and some refrigeration and plumbing components are often assembled and repaired by the higher temperature silver soldering process. Small mechanical parts are often soldered or brazed as well. Soldering is also used to join lead came and copper foil in stained glass work. It can also be used as a semi-permanent patch for a leak in a container or cooking vessel.

Solders

Soldering filler materials are available in many different alloys for differing applications. In electronics assembly, the eutectic alloy of 63% tin and 37% lead (or 60/40, which is almost identical in performance to the eutectic) has been the alloy of choice. Other alloys are used for plumbing, mechanical assembly, and other applications.
A eutectic formulation has several advantages for soldering; chief among these is the coincidence of the liquidus and solidus temperatures, i.e. the absence of a plastic phase. This allows for quicker wetting as the solder heats up, and quicker setup as the solder cools. A non-eutectic formulation must remain still as the temperature drops through the liquidus and solidus temperatures. Any differential movement during the plastic phase may result in cracks, giving an unreliable joint. Additionally, a eutectic formulation has the lowest possible melting point, which minimizes heat stress on electronic components during soldering.

Flux

The purpose of flux is to facilitate the soldering process. The obstacle to a successful solder joint is an impurity at the site of the union, e.g. dirt, oils or oxidation. The impurities can be removed by mechanical cleaning or by chemical means, but the elevated temperatures required to melt the filler metal (the solder) encourages the work piece (and the solder) to re-oxidize. This effect is accelerated as the soldering temperatures increase and can completely prevent the solder from joining to the work piece. One of the earliest forms of flux was charcoal, which acts as a reducing agent and helps prevent oxidation during the soldering process. Some fluxes go beyond the simple prevention of oxidation and also provide some form of chemical cleaning (corrosion).
For many years, the most common type of flux used in electronics (soft soldering) was rosin-based, using the rosin from selected pine trees. It was ideal in that it was non-corrosive and non-conductive at normal temperatures but became mildly reactive (corrosive) at the elevated soldering temperatures. Plumbing and automotive applications, among others, typically use an acid-based (muriatic acid) flux which provides cleaning of the joint. These fluxes cannot be used in electronics because they are conductive and because they will eventually dissolve the small diameter wires. Many fluxes also act as a wetting agent in the soldering process,[5] reducing the surface tension of the molten solder and causing it to flow and wet the work pieces more easily.

Soldering iron
A soldering iron is a hand tool most commonly used in soldering. It supplies heat to melt the solder so that it can flow into the joint between two work pieces.A soldering iron is composed of a heated metal tip and an insulated handle. Heating is often achieved electrically, by passing an electric current (supplied through an electrical cord or battery cables) through the resistive material of a heating element. Another heating method includes combustion of a suitable gas, which can either be delivered through a tank mounted on the iron (flameless), or through an external flame.
The various steps that are involved in a soldering procedure are given below:
1.Make the layout of the connection of the component in the circuit .plug in the chord of the soldering iron to the main supply to get it heated.
2.Strengthen and clean the component leads using blades or knifes. Apply little flux on the leads. Take a little solder on the soldering iron and apply the molten solder on the leads. Care must be taken to avoid the component getting heated up.
3.Mount the component on the PCB, by bending the leads of the component using the noise pliers.
4.Apply flux on the joints and solder the joints. Soldering must be done in maximum to avoid the dry soldering and heating up the components.
5.wash the residue using and brush













CONCLUSION
GSM technology capable solution has proved to be controlled remotely, provide home security and is cost-effective as compared to the previously existing systems. When live in a dynamic world of fast changing technical frontiers, the conventional systems are being replaced by sophisticated and advanced technologies. Keeping the latest and trends. The designed product is an innovative one to facilitate the automation requirements. The drawbacks of the existing manual system, which involves wastage of electricity due to in efficient operation of fans and lights, can be solved.
                               Security systems today needs to make use of the latest available technological components. In this paper, we present the design and implementation of a remote sensing, control, and home security system based on GSM (Global System for Mobile). This system offers a complete, low cost, powerful and user friendly way of 24 hours real-time monitoring and remote control of a home security.









BIBILIOGRAPHY

There were many sources from where the ideas and materials for preparing this training report were used. The following are worth listing:-

Site referred


Books referred

Ø  ELECTRONICS FOR YOU
Ø  EMBEDDED SYSTEMS
Ø  PCB DESIGN WITH ORCAD: STEVE SINCHAK&DAN HOOPER



3 comments:

  1. can you sent me pdf file of this on my email... vivekchamoli08@gmail.com as sooon as possible

    ReplyDelete
  2. can you sent me pdf file of this on my email
    aanntt2009@gmail.com

    ReplyDelete