new microsoft word document123.docx

Upload: sankalp-shrivastava

Post on 14-Apr-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 New Microsoft Word Document123.docx

    1/27

    1

    TABLE OF CONTENTS

    Chapter 1: Preamble

    1.1 Introduction

    1.2 Problem statement

    1.3 Project overview

    1.4 Scope of the project

    Chapter 2: Theoretical Background

    2.1 Microcontroller Atmega16

    2.1.1 Introduction

    2.1.2 Features of atmega16

    2.1.3 Pin diagram and description

    Chapter3: Block diagram and its description

    3.1 Block diagram of module

    3.2 Components of module

    3.2.1 Power supply

    3.2.2 LCD Display

    3.2.3 Transceiver

    3.2.4 Microcontroller

    3.2.5 GPS

    Chapter 4: Software usage

    4.1 AVR studio

    4.2 Program

  • 7/30/2019 New Microsoft Word Document123.docx

    2/27

    2

    List of figures

    1 2.1 Pin diagram of microcontroller

    2 3.1 Block diagram of module

    3 3.2 9v 6f22 battery

    4 3.3 7605 voltage regulator

    5 3.4 LCD Display

    6 3.5 GPS Module

  • 7/30/2019 New Microsoft Word Document123.docx

    3/27

    3

    .

    ABSTRACT

    Social Security System is used to provide the precise location of a

    happening crime which occurs outdoors against common citizens

    specially women using a GPS to tell the location of the crime in real

    time. Violence against women is a technical term used to collectively

    refer to violent acts that are primarily or exclusively committed

    against women. This type of violence targets a specific group with the

    victim's gender as a primary motive.

    The goal of the project is to provide the security personals the exactlocation of the crime in real time so that they are able to intervene and

    stop it from happening.

    It consists of a microcontroller, GPS, LCD, transmitter and receiver.

    The module and implementation of the

    social security system has been theoretical tested and it can be

    implemented practically to stop the crimes

  • 7/30/2019 New Microsoft Word Document123.docx

    4/27

    4

    ACKNOWLEDGEMENT

    We the batch mates of the project social security system, consider it as a great

    privilege to express our gratitude and respect to all those who guided and inspired us in

    completion of our project.

    No project is complete without the people, who have rendered advice and helped in

    making the project successful. It is difficult for us to express our sense of gratitude and

    appreciation for the help we have received in endeavor. Our effort here is feeble attempt to do so.

    First of all, we acknowledge for the provision of the required infrastructure by our

    esteemed institute Jawaharlal Nehru National College of Engineering, Shivamogga and

    Department of Telecommunication Engineering.

    We would like to thank ourHOD and Associate Prof. S. Amarappa, who stood as our

    guiding spirit and lending us guidance to achieve our aim with added zeal.

    We thank our guide Ashwini S.R, Assistant professor, for her valuable suggestions and

    treasured assistance throughout the course of our project. Her advice and co-operation have been

    the factors that have contributed to achieve our goals.

    Our special thanks to our principal Dr. R. Srinivasa Rao Kunte for providing all

    facilities needed for our project.

    Lastly, we are thankful to our classmates and everyone who have helped us directly or

    indirectly for the successful completion of the project.

    Project Associates:

    Laki Kumar Sinha (4JN09TE024)

    Prakash Sharma (4JN09TE037)

    Sankalp Kumar (4JN09TE045)

    Saurabh Chandra (4JN08TE044)

  • 7/30/2019 New Microsoft Word Document123.docx

    5/27

    5

    Chapter1

    PREAMBLE

    1.1 Introduction

    The objective of this project is to provide safety to citizens especially

    females against crime like sexual harassment by providing real time

    information. This information will be provided by using a QUECTEL L50

    GPS module which will be interfaced with a microcontroller. The moment

    the person in need of help senses some suspicious activity or if the crime

    started happening then the person can switch the module ON. The moment

    the person do so, the GPS will pass the location to the microcontroller (here

    we are using ATMEGA 16) which is interfaced systematically to a

    transmitter. The transmitter sends the coordinates to the nearest police

    control room or some security agencies, from where help arrives in real time

    and the crime is stopped. Sometimes when the victim is in motion then also

    the device will be very helpful in tracking the victim once the distress signal

    has been sent. This device with slight modifications can also be used for

    various other applications like tracking of kids, animals, finding out terrains.

    1.2 Problem Statement

    Incapability to reduce the increasing crime rate despite of having desire to

    do so, and hence despite having resources, our inability to provide security

    and safety to common man specially females in our society.

    1.3 Project Overview

    Sender side:

  • 7/30/2019 New Microsoft Word Document123.docx

    6/27

    6

    It has a switch which once pressed enables the whole system.

    All the components used are interfaced systematically, and the flow of signal

    is from transmitting to receiving side.

    It is a microcontroller based security device which uses Global Positioning

    System (GPS) and radio transceivers.

    We had used AVR studio for programing.

    A battery powered GPS will acquire the location of the person and a

    transceiver will send the location to the security personals.

    The GPS module and the transceiver will be interfaced to an ATmega16

    microcontroller.

    Receiver Side:

    A radio antenna at the receiver side will receive the signals and by using a

    microcontroller interfaced to a 16x2 LCD will display the location of the

    sender.

    Signals can be sent in reverse direction too, in case we want to send

    acknowledgment that the help is coming or the time in which help will be

    available.

    1.4 Scope of the Project

    This system can also be used where the information is not needed so

    frequently and the subject has to be tracked at irregular timeperiods, such as

    monitoring of adolescents by parents, in research to track animals in the

    jungle, coordinating search and rescue efforts, and mapping trails and

    exploring new terrains. This way it will be used for various applications with

    some or no modifications in the original module. It has many other future

    applications which can be achieved or implemented by enhancing the

  • 7/30/2019 New Microsoft Word Document123.docx

    7/27

    7

    module. Can be used with security agencies in spying, can be used in army

    to monitor their vehicles and personnel.

    Apart from other applications, various features can be added to this module

    for providing more services. Services like telling what is the time the

    security personnel will take to reach the location of the victim, for telling

    what kind of crime is happening and what its severity is. For asking for help

    for incidents which is not crime but in which urgency is required like fire or

    some accident. Can also be used for identifying the person from whose

    device the distress message had been sent.

  • 7/30/2019 New Microsoft Word Document123.docx

    8/27

    8

    Chapter 2

    THEORETICAL BACKGROUND2.1 MICROCONTROLLER ATMEGA 16

    2.1.1 Introduction:-

    The main part of the project is microcontroller. Here we are using

    ATMEGA 16 microcontroller.

    Microprocessors and microcontroller are widely used in

    embedded systems products. Microcontroller is a programmable device. A

    microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports

    and a timer embedded all on a single chip. The fixed amount of on-chip ROM,

    RAM and number of I/O ports in microcontroller makes them ideal for many

    applications in which cost and space are critical.ATmega16 is an 8-bit high performance microcontroller of Atmels Mega

    AVR family with low power consumption. Atmega16 is based on enhanced RISC

    (Reduced Instruction Set Computing) architecture with 131 powerful instructions.Most of the instructions execute in one machine cycle. Atmega16 can work on a

    maximum frequency of 16MHz.

    ATmega16 has 16 KB programmable flash memory, static RAM of 1 KB and

    EEPROM of 512 Bytes. The endurance cycle of flash memory and EEPROM is

    10,000 and 100,000, respectively.

    ATmega16 is a 40 pin microcontroller. There are 32 I/O (input/output) lines whichare divided into four 8-bit ports designated as PORTA, PORTB, PORTC and

    PORTD.

  • 7/30/2019 New Microsoft Word Document123.docx

    9/27

    9

    2.1.2 FEATURES OF ATMEGA 16

    8-Bit microcontroller

    1K Byte of internal SRAM

    512 Bytes EEPROM

    16K Bytes of In-system self programmable flash memory

    Boundary-scan capabilities a/c to JTAG standard

    32 programmable I/O lines

    Uses low power

    High performance

    Advanced RISC architecture

    It can process up to 16 MIPS throughput at 16 MHz

    Speed grad:0-8MHz

  • 7/30/2019 New Microsoft Word Document123.docx

    10/27

    10

    2.1.3PIN Diagram of ATMEGA 16

  • 7/30/2019 New Microsoft Word Document123.docx

    11/27

    11

    Pin Descriptions:

    VCC:

    Digital supply voltage.

    GND:Ground.

    Port B (PB7...PB0):Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for

    each bit). The

    Port B output buffers have symmetrical drive characteristics with both high sinkand source

    capability. As inputs, Port B pins that are externally pulled low will source current

    if the pull-upresistors are activated. The Port B pins are tri-stated when a reset conditionbecomes active,

    even if the clock is not running.

    Port C (PC7...PC0):Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for

    each bit). ThePort C output buffers have symmetrical drive characteristics with both high sink

    and source

    capability. As inputs, Port C pins that are externally pulled low will source currentif the pull-up

    resistors are activated. The Port C pins are tri-stated when a reset conditionbecomes active,

    even if the clock is not running.

    Port D (PD7PD0):Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for

    each bit). The

    Port D output buffers have symmetrical drive characteristics with both high sinkand source

    capability. As inputs, Port D pins that are externally pulled low will source current

    if the pull-upresistors are activated. The Port D pins are tri-stated when a reset condition

    becomes active,even if the clock is not running.

  • 7/30/2019 New Microsoft Word Document123.docx

    12/27

    12

    Port E (PE2...0) RESET/ XTAL1/XTAL2:Port E is a 3-bit bi-directional I/O port with internal pull-up resistors (selected for

    each bit). The Port E output buffers have symmetrical drive characteristics with

    both high sink and source capability. As inputs, Port E pins that are externallypulled low will source current if the pull-up resistors are activated. The Port E pins

    are tri-stated when a reset condition becomes active, even if the clock is notrunning.

    If the RSTDISBL Fuse is programmed, PE0 is used as an I/O pin. Note

    that the electrical characteristicsof PE0 differ from those of the other pins of Port

    E. If the RSTDISBL Fuse is unprogrammed, PE0 is used as a Reset input. A lowlevel on this pin for longer than the minimum pulse length will generate a Reset,

    even if the clock is not running.

    Shorter pulses are not guaranteed to generate aReset. Depending on the clock selection fuse settings, PE1 can be used as input to

    the inverting Oscillator Amplifier and input to the internal clock operating circuit.

    Depending on the clock selection fuse settings, PE2 can be used as output from theinverting Oscillator amplifier Port C also serves the functions of special features of

    the ATmega16.

    AVCC:AVCC is the supply voltage pin for the A/D Converter, D/A Converter, Current

    source. It should be externally connected to VCC, even if the ADC, DAC are notused. If the ADC is used, it should be connected to VCC through a low-pass filter.

    AREF:This is the analog reference pin for the A/D Converter.

  • 7/30/2019 New Microsoft Word Document123.docx

    13/27

    13

    3.2 Components of module

    3.2.1 POWER SUPPLY:

    For the functioning of all our electronic circuits we require dc power supply. The

    power supply that comes to our homes is an AC power supply, and we need an AC

    to DC converter to get a DC supply. Here we will be using a battery to supply the

    required power. The power requirement for this module is of 5v. As a battery of

    this output is not available so, we are using a 6F22, 9v battery.

    Fig 3.3:6f22 9v Battery

    Voltage regulator:

    7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixedlinear voltage regulator ICs. The voltage source in a circuit may have fluctuations

  • 7/30/2019 New Microsoft Word Document123.docx

    14/27

    14

    and would not give the fixed voltage output. The voltage regulator IC maintains

    the output voltage at a constant value. The xx in 78xx indicates the fixed outputvoltage it is designed to provide. 7805 provides +5V regulated power supply.

    Capacitors of suitable values can be connected at input and output pins depending

    upon the respective voltage levels.

    Pin

    No Function Name1 Input voltage (5V-18V) Input2 Ground (0V) Ground3 Regulated output; 5V (4.8V-5.2V) Output

  • 7/30/2019 New Microsoft Word Document123.docx

    15/27

    15

    3.2.2 LCD Display:

    LCD (Liquid Crystal Display) screen is an electronic display module and find a

    wide range of applications. A 16x2 LCD display is very basic module and is very

    commonly used in various devices and circuits. These modules are preferredover seven segments and other multi segment LEDs. The reasons being: LCDs are

    economical; easily programmable; have no limitation of displaying special &even custom characters (unlike in seven segments), animations and so on.

    A 16x2 LCD means it can display 16 characters per line and there are 2 such lines.

    In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two

    registers, namely, Command and Data.

    The command register stores the command instructions given to the LCD. A

    command is an instruction given to LCD to do a predefined task like initializing it,

    clearing its screen, setting the cursor position, controlling display etc. The data

    register stores the data to be displayed on the LCD. The data is the ASCII value of

    the character to be displayed on the LCD.

  • 7/30/2019 New Microsoft Word Document123.docx

    16/27

    16

    3.2.3 GPS:

    GPS modem is a device which receives signals from satellite and providesinformation about latitude, longitude, altitude, time etc. The GPS navigator is more

    famous in mobiles to track the road maps. The GPS modem has an antenna whichreceives the satellite signals and transfers them to the modem. The modem in turn

    converts the data into useful information and sends the output in serial RS232 logic

    level format. The information about latitude, longitude etc is sent continuously andaccompanied by an identifier string.

    3.2.4 Transceiver:

    The RF module, as the name suggests, operates at Radio Frequency. The

    corresponding frequency range varies between 30 kHz & 300 GHz. In this RF

    system, the digital data is represented as variations in the amplitude of carrier

    wave. This kind of modulation is known as Amplitude Shift Keying (ASK).

    Transmission through RF is better than IR (infrared) because of many reasons.

    Firstly, signals through RF can travel through larger distances making it suitable

    for long range applications. Also, while IR mostly operates in line-of-sight mode,

    RF signals can travel even when there is an obstruction between transmitter &

    receiver. Next, RF transmission is more strong and reliable than IR transmission. RF

  • 7/30/2019 New Microsoft Word Document123.docx

    17/27

    17

    communication uses a specific frequency unlike IR signals which are affected by

    other IR emitting sources.

    This RF module comprises of an RF Transmitter and an RF Receiver. Thetransmitter/receiver (Tx/Rx) pair operates at a frequency of434 MHz an RF

    transmitter receives serial data and transmits it wirelessly through RF through its

    antenna connected at pin4. The transmission occurs at the rate of 1Kbps -

    10Kbps.The transmitted data is received by an RF receiver operating at the same

    frequency as that of the transmitter.

  • 7/30/2019 New Microsoft Word Document123.docx

    18/27

    18

    Chapter 4

    Software usage

    5.1 AVR Studio

    AVR studio is an Integrated Development Environment (IDE) by ATMEL fordeveloping applications based on 8-bit AVR microcontroller. Prior to installation

    of AVR Studio you have to install the compiler WinAVR.

    5.2 Program

    .include "m16def.inc"

    .def bytlw=r2

    .def bythg=r3

    .def odchk=r4

    .def evchk=r5

    .def sftcnt=r6

    .def vlpos=r7

    .def opval=r8

    .def opdvc=r9

    .def opspd=r10

    .def status=r11

    .def count=r12

    .def endval=r13

    .def togval=r14

    .def temp=r16

    .def temp1=r17

    .def temp2=r18

    .def temp3=r19

    .def temp4=r20

    .def temp5=r21

    .def temp6=r22

    .def temp7=r23

    .def temp8=r24

    .def dcnt1=r25

  • 7/30/2019 New Microsoft Word Document123.docx

    19/27

    19

    .equ lcddprt=porta

    .equ lcdcprt=portc

    .equ lcd_rs=0

    .equ lcd_en=2

    .equ gpsloc=$70

    .equ latloc=$100

    .equ lagloc=$200

    .equ cnt=$10

    .equ brp=143

    .equ latpos=$85

    .equ longpos=$c5

    .org $00rjmp RESET

    .org $30RESET: ldi temp,low(RAMEND)

    out SPL,templdi temp,high(RAMEND)out SPH,templdi temp,$ff

    out ddra,templdi temp,$ffout ddrb,templdi temp,$ffout ddrc,templdi temp,$feout ddrd,templdi temp,$00out porta,temp

    ldi temp,$00out portc,templdi temp,$00out portd,templdi temp,$00out portb,temprcall urtini

  • 7/30/2019 New Microsoft Word Document123.docx

    20/27

    20

    rcall dly6msrcall dly6msrcall dly6msrcall lcdinitrcall init

    here: ;rcall gpsrx;rcall gpsdisrcall sertstldi temp,$14rcall delayrjmp here

    init: ldi zl,low(2*ttl1) ;System initialdisplay

    ldi zh,high(2*ttl1)rcall lcdl1rcall sndmsgldi zl,low(2*ttl2)ldi zh,high(2*ttl2)rcall lcdl2rcall sndmsgclr statusldi temp,$0amov endval,temp

    ldi temp,$01mov togval,templdi temp,$14rcall delayldi zl,low(2*gps1)ldi zh,high(2*gps1)rcall lcdl1rcall sndmsgldi zl,low(2*gps2)

    ldi zh,high(2*gps2)rcall lcdl2rcall sndmsgret

    sertst: rcall lcdl1ldi temp4,$10

  • 7/30/2019 New Microsoft Word Document123.docx

    21/27

    21

    st01: rcall srrcvrcall datdispdec temp4brne st01rcall lcdl2ldi temp4,$10

    st02: rcall srrcvrcall datdispdec temp4brne st02ldi temp,$28rcall delayret

    gpsrx: ldi xh,high(latloc)ldi xl,low(latloc)ldi yh,high(lagloc)ldi yl,low(lagloc)

    gr00: clr countgr01: rcall srrcv

    cpi temp,'$'brne gr01

    gr02: rcall srrcvcpi temp,'G'

    brne gr02gr03: rcall srrcv

    cpi temp,'P'brne gr03

    gr04: rcall srrcvcpi temp,'R'brne gr04

    gr05: rcall srrcvcpi temp,'M'

    brne gr05gr06: rcall srrcvcpi temp,'C'brne gr06ldi temp1,14

    gr07: rcall srrcvdec temp1

  • 7/30/2019 New Microsoft Word Document123.docx

    22/27

    22

    brne gr07ldi temp1,11mov count,temp1

    gr08: rcall srrcvst x+,tempdec countbrne gr08rcall srrcvrcall srrcvldi temp1,12mov count,temp1

    gr09: rcall srrcvst y+,tempdec count

    brne gr09grout: ret

    gpsdis: ldi xh,high(latloc)ldi xl,low(latloc)ldi dcnt1,11ldi temp,latposrcall command

    gd01: ld temp,x+rcall datdisp

    dec dcnt1brne gd01ldi yh,high(lagloc)ldi yl,low(lagloc)ldi dcnt1,12ldi temp,longposrcall command

    gd02: ld temp,y+rcall datdisp

    dec dcnt1brne gd02

    ret

    split: mov temp1,tempandi temp,$0f

  • 7/30/2019 New Microsoft Word Document123.docx

    23/27

    23

    mov bytlw,tempmov temp,temp1andi temp,$f0swap tempmov bythg,tempret

    unsplit:mov temp,bythgswap tempadd temp,bytlwret

    srsnd: nopsd1: sbis ucsra,udre

    rjmp sd1out udr,tempret

    srrcv: nopsr1: sbis ucsra,RXC

    rjmp sr1in temp,udrret

    urtini: ldi temp,high(brp)out ubrrh,templdi temp,low(brp)out ubrrl,templdi temp,(1

  • 7/30/2019 New Microsoft Word Document123.docx

    24/27

    24

    lcdln1: ldi temp,$80rcall commandret

    lcdl2: ldi temp,$c0 ;Forcing LCD cursor toline 1

    rcall commandret

    lcdinit:ldi temp,$38 ;LCD initializationrcall command ;2 line display, 5*7

    matrix displayldi temp,$0e ; Cursor ON and blinking

    rcall commandldi temp,$06 ;Shift to right after

    printingrcall commandldi temp,$01 ;Clear displayrcall commandrcall dly6msret

    command:out lcddprt,temp

    cbi lcdcprt,lcd_rs ;Writing command wordto LCD

    sbi lcdcprt,lcd_encbi lcdcprt,lcd_enrcall dly6msret

    datdisp:out lcddprt,tempsbi lcdcprt,lcd_rs ;Writing a character

    in LCD sbi lcdcprt,lcd_encbi lcdcprt,lcd_enrcall dly6msret

  • 7/30/2019 New Microsoft Word Document123.docx

    25/27

    25

    sndmsg: ldi temp8,$10 ;Sending a fullmessage to LCDsm01: lpm temp,z+

    rcall datdispdec temp8brne sm01ret

    send: ldi zl,low(2*data) ;Sending a number toLCD

    ldi zh,high(2*data)add zl,tempbrcc sn01inc zh

    sn01: lpm temp,zrcall datdispret

    sndbyt: ldi zl,low(2*data) ;Sending one byte ofdata to LCD

    ldi zh,high(2*data)rcall splitmov temp,bythgadd zl,temp

    brcc ckd01inc zh

    ckd01: lpm temp,zrcall datdispldi zl,low(2*data)ldi zh,high(2*data)mov temp,bytlwadd zl,tempbrcc ckd02

    inc zhckd02: lpm temp,zrcall datdispret

    dly20ms:ldi temp1,$4e ;delay for 20ms

  • 7/30/2019 New Microsoft Word Document123.docx

    26/27

    26

    ldi temp3,$20rcall dlyret

    dly6ms: ldi temp1,$8e ;$2eldi temp3,$e0 ;$e0rcall dlyret

    delay: rcall dly50ms ;Custom delaydec tempbrne delayret

    dly50ms:ldi temp4,$04d5: ldi temp1,$b4

    ldi temp3,$d8rcall dlydec temp4brne d5ret

    dly: noplp2: mov temp2,temp3

    lp1: dec temp2brne lp1dec temp1brne lp2ret

    dlylcd: ldi temp2,$dedl1: dec temp2

    brne dl1

    ret

    data: .db "0123456789ABCDEF"ttl1: .db " GPS test board "ttl2: .db "Ready to operate"gps1: .db "Lati- "gps2: .db "Long- "

  • 7/30/2019 New Microsoft Word Document123.docx

    27/27