CERTIFICATION

As the candidate’s supervisor, I have accepted this project report for submission.

Name: Mr. Mbazingwa E. Mkiramweni

Signature: …………………………….

Date: ………………………………….

DECLARATION I declare to the best of my knowledge that, the project presented here as a part of achievement of bachelor of engineering in and course, it is my original work and has not been copied anywhere or presented elsewhere, except where openly indicted otherwise as all sources of knowledge have been duly acknowledged.

Name of the candidate: Onesmo Augustino Signature: ………………………… Date: ………………………………

iii

ABSTRACT The advancement of technology has reduced human intervention on various tasks and operation that involves machines, tools, equipment and other several appliances. Such replacement enhanced both quantity and quality production of goods and services emphasizing a better living standard. Depending on the kind of applications, different systems had been designed. Basing on this project a sub-security alarm system is intended of which the organization is such that; the recorded audible voice command will be played alerting the populaces to leave the seaside specifically the Gymkhanas beach. There should also be a human repellent unit which produces unpleasant to persons who disobeys the command given by this system. Both voice command and disturbing sound are played via the loudspeakers. The aimed system detects the presence or absence of an individual around by using the PIR sensors that are contained by it. Moreover an RF module is attached to every sub-system to ensure security over a large area around the beach by transmitting unique pulse code to another RF unit about 500feets whenever human is detected. All processes are scheduled and performed by the central control unit the PIC16F648A microcontroller. In general the system designed will work in a specified period of time, programmed sequence of operations and by sensing the absence or presence of an individual around the beach place. Bringing together the functions of sensors, RF Modules, Human repellent, the Microcontroller Unit and other components as stated above conclude the named title beach alerting and security system which significantly support the Gymkhanas beach guards to give directive to the people along that place with appropriate voice commands. This can improve the beach safety and security since it will be very effective, save security operation costs as well as good time management.

iv

ACKNOWLEDGMENT I am gratefully just before God almighty for giving me the will power and strength to prepare this project. In particular, I would like to express my sincere appreciation to my supervisor Mr Mbazingwa E. Mkiramweni for the encouragement, guidance, information and motivation. Special thanks to the telecom staff for their valuable advice guidance and their enormous patience through the development of the project.

In addition I would like to appreciate all my classmates and friends for their support and encouragement throughout the project and the four years of studies at Dar es Salaam Institute of Technology. In a nutshell, special thanks to my beloved family for their moral and material support during the whole period of my course work.

v

TABLE OF CONTENTS

CERTIFICATION ...... ii

DECLARATION ...... iii

ABSTRACT ...... iv

ACKNOWLEDGMENT ...... v

TABLE OF CONTENTS…………………………………………………………………………vi

ABBREVIATIONS ...... x

LIST OF FIGURES ...... xi

LIST OF TABLES ...... xii

CHAPTER ONE ...... 1

1 INTRODUCTION ...... 1

1.1 Background...... 1

1.2 Problem Statement...... 1

1.3 Objectives ...... 1

1.3.1 Main Objective...... 2

1.3.2 Specific Objectives ...... 2

1.4 Significance ...... 2

1.5 Scope and Limitation of the Proposal ...... 2

1.6 Chapter Conclusion ...... 2

CHAPTER TWO ...... 3

2 METHODOLOGY ...... 3

2.1 Literature Review ...... 3

2.2 Data Collection ...... 3

2.3 Data Analysis and Design ...... 3

2.4 Programming of programmable devices ...... 4 vi

2.5 Designing the system ...... 4

2.6 Implementation and testing the prototype ...... 4

2.7 Writing the report of project ...... 4

2.8 Chapter Conclusion ...... 4

CHAPTER THREE ...... 5

3 LITERATURE REVIEW ...... 5

3.1 The existing system ...... 5

3.2 Disadvantage of the existing system ...... 5

3.2.1 Tedious ...... 5

3.2.2 It’s time consuming...... 5

3.2.3 Cost fully...... 6

3.2.4 Not very effective ...... 6

3.3 The Proposed system ...... 6

3.3.1 Microcontroller ...... 7

3.3.2 Sensing unit ...... 9

3.3.3 ...... 10

3.3.4 Receivers ...... 13

3.3.5 Power Supply ...... 14

3.3.6 Chapter Conclusion ...... 14

CHAPTER FOUR ...... 15

4 DATA COLLECTION ...... 15

4.1 Response of Tanzanians on Available Security Systems ...... 15

4.2 Technical Data ...... 16

4.2.1 Control Unit ...... 16

4.2.2 Sensing unit ...... 17

vii

4.2.3 Power Supply ...... 18

4.2.4 Chapter Conclusion ...... 18

CHAPTER FIVE ...... 19

5 DATA ANALYSIS AND DESIGN ...... 19

5.1 Design of the Proposed System ...... 19

5.2 Hardware Description ...... 19

5.2.1 Power supply ...... 19

5.2.2 PIR sensor ...... 21

5.2.3 Programmable interface controller (PIC)...... 23

5.2.4 RF Module ...... 25

5.2.5 Repellent Unit ...... 36

5.2.6 Programming Flow Chart ...... 37

5.3 Chapter Conclusion ...... 38

CHAPTER SIX ...... 39

6 CIRCUIT SIMULATION TESING AND RESULTS ...... 39

6.1 Introduction ...... 39

6.2 Receiving End ...... 39

6.3 Human repellent simulation ...... 40

6.4 Transmitting Part ...... 40

6.5 Chapter Conclusion ...... 41

CHAPTER SEVEN ...... 42

7 PROTOTYPE IMPLEMENTATION ...... 42

7.1 Introduction ...... 42

7.2 Printed Circuit Boards Construction ...... 42

7.3 Components Mounting and Connections ...... 43

viii

7.4 Overall working prototype ...... 43

7.5 Prototype Performance Test ...... 44

7.6 Results and Discussion ...... 44

7.7 Chapter Conclusion ...... 45

CHAPTER EIGHT ...... 46

8 CONCLUSION AND RECOMMENDATIONS ...... 46

8.1 Introduction ...... 46

8.1.1 Conclusion ...... 46

8.1.2 Recommendations ...... 46

9 REFERENCES ...... 47

APPENDICES ...... 49

APPENDIX A: Cost Estimation ...... 49

APPENDIX B: Project Schedule ...... 50

ix

ABBREVIATIONS ADC Analog to digital converter CPU Central Processing Unit DAC Digital to Analog Converter EPROM Erasable Programmable Read Only Memory GPS Global Position System I/O Input/output IR Infrared ISECOM Institute for Security and Open Methodologies PCB Printed Circuit Board PIC Programmable Interface Controller PIR Passive Infrared RAM Random Access Memory ROM Read Only Memory USB Universal Serial Bus

x

LIST OF FIGURES

Figure 3-1 The block diagram of the Proposed System ...... 7 Figure 3-2 PIC Microcontroller ...... 8 Figure 3-3 PIR Sensor ...... 10 Figure 3-4 transmitter ...... 11 Figure 3-5 Radio Receiver ...... 13 Figure 5-1 Power supply ...... 21 Figure 5-2 PIR Sensors interfacing with the PIC16F648A ...... 23 Figure 5-3 Shows pin and port of PIC Microcontroller ...... 24 Figure 5-4 RF Module...... 25 Figure 5-5 the 433 MHz RF Transmitter ...... 27 Figure 5-6 433MHz RF receiver module ...... 28 Figure 5-7 Noise power in a 1 Hz ...... 31 Figure 5-8 Noise Figure added to thermal noise (kTB)...... 32 Figure 5-9 Carrier to Noise ratio...... 33 Figure 5-10 Noise Power in the IF Bandwidth...... 33 Figure 5-13 Perfect filter that passes same power...... 34 Figure 5-14 Area under filter response...... 34 Figure 5-15 Integration by summation of rectangles...... 35 Figure 5-16 Audio generator circuit ...... 36 Figure 5-17 Programming flow chart ...... 37 Figure 6-1 Receiver and frequency generator schematic circuit ...... 39 Figure 6-2 Simulation Results ...... 40 Figure 6-3 Transmitter schematic diagram ...... 41 Figure 7-1 PCB layout...... 42 Figure 7-2 PCB layout for the designed system ...... 43 Figure 7-3 Components mounting on PCB ...... 43 Figure 7-4 Working prototype ...... 44

xi

LIST OF TABLES

Table 4-1: Fresher’s response to the proposed system security systems ...... 15 Table 4-2: Average Attendance at different beaches ...... 16 Table 4-3: Microcontrollers available in the market [8],[9] ...... 16 Table 4-4: PIC 16F648A Specification [9] ...... 17 Table 4-5: Infrared sensor maximum rating [1], [7] ...... 18 Table 4-6: Power supply Specifications [10] ...... 18 Table 5-1: RF Transmitter ...... 26 Table 5-2: RF Receiver ...... 26 Table 7-1: Frequencies measured from the sound signal sources...... 44

xii

CHAPTER ONE

1 INTRODUCTION

This entire chapter explains in detail what is going to be done in order to solve the problem. It introduces and gives the background information of the problem to be solved, also explain about the main and specific objectives as well as the significance of the stated problem.

1.1 Background In our daily life security is very important as it ensures safety for both people and their properties. Security is the degree of resistance to or protection from harm. It applies to any vulnerable and valuable asset such as a person, dwelling, community, item, nation or organization. Several security systems have been designed depending on the security necessities of a particular place. As noted by the Institute for Security and Open Methodologies (ISECOM) in the OSSTMM 3, security provides a form of protection where a separation is created between the assets and the threat. These separations are generically called controls and sometimes include changes to the asset or the threat [1]. Most beaches security systems at our country put on the bodily security system, the system that entirely depends on man for tasks on everything towards safety. The most drawbacks of such system are time consuming, tiresome, expensive and not much effective. I proposed to design a system that will alert people to leave the beach when they are requested to leave the beach. The aimed system is comprised of various subsystems which operations together form the system desired.

1.2 Problem Statement For security reasons, the Gymkhanas beach’s security guard walks a long distance from Ferry to Aghakhan hospital forewarning people to leave the seaside which is time consuming and tiresome. The existing system is also not very effective.

1.3 Objectives The objectives of this project are divided into two main classes that are main objective and specific objectives.

1

1.3.1 Main Objective The main objective of this Project proposal is to realize and design a system that will alert the people along the beach in order to improve safety and security as well as saving time and operation costs at the Gymkhanas beach.

1.3.2 Specific Objectives The Specific Objectives are as follows: i. To design the human repellent circuit. ii. To design the power supply. iii. To interface the control unit with other peripherals. iv. To program the control unit.

1.4 Significance This Project will significantly support the Gymkhanas seaside guards to give directives to the people with appropriate voice commands that are played through the loudspeakers in order to ensure safety along the place.

1.5 Scope and Limitation of the Proposal The system proposed will work effectively whenever PIR sensors detect the presence of human around 500 feet’s from where it’s centrifugally situated. Also for the improvement of safety over a wide area, the RF module must be simultaneously transmitting and receiving the unique pulse code from other remotely located RF modules.

1.6 Chapter Conclusion This chapter has discussed about introduction to security, problem descriptions, objectives, significances, scope and limitation of the project. The problem addressed in this chapter is going to be solved after achieving the main objective. Methodological steps are the key procedures to be used in order to come up with the solution to the existing problem. The next chapters discuss these procedural steps towards achieving the main objectives of this project.

2

CHAPTER TWO

2 METHODOLOGY

Methodologies are the methods and procedures which help us to achieve this project. These methods include; literature review, data collection, data analysis, circuit designing and simulation, prototype building with testing and report writing.

2.1 Literature Review In literature review different sources of information based on principles, laws and all scientific verifications have been revised. These are printed Engineering books and online books, various technical reports and professional papers, Institute library and websites from the as they are rich in materials; they have been much helpful to the achievement of this Project. Literature review gives the in-depth discussion on the existing system, and also on the proposed system.

2.2 Data Collection Data collection is the process of gathering and measuring information on variables of interest, in an established systematic fashion that enables one to answer stated research questions, test hypotheses, and evaluate outcomes. Under this I had managed to obtain some relevant information that gave me confidence to carry out this project, that the problem real exists and requires a solution.

2.3 Data Analysis and Design Analysis of data is the process of inspecting, cleaning, transforming, and modeling data with the goal of discovering useful information, suggesting conclusions, and supporting decision making. Data analysis has multiple facets and approaches, encompassing diverse techniques under a variety of names, in different business, business, science, and social science domains. In data analysis, we have most analyzed the details on the gathered information by relating them to the scientific principles that lead to the designing conclusion.

3

2.4 Programming of programmable devices The programming of PIC was done after obtaining the required in input signal, from data analysis for the operation of the programmable integrated circuit (PIC).

2.5 Designing the system After data collection and analysis, different circuits of parts of the proposed system had designed. Firstly the designing done using simulation tools (circuit maker and Proteus), and the next designed the hardware part.

2.6 Implementation and testing the prototype In this part, different parts of the system were intersected. This interconnection was done in simulation tools first, before hardware implementation. The system works well when simulated, then the hardware interconnection were done in the printed circuit board PCB.

2.7 Writing the report of project The report based on the introduction, literature review, methodology, data collected, data analysis and the designing.

2.8 Chapter Conclusion This chapter has described the procedural steps which are undertaken in order to solve the existing problem. In order to develop a new system to solve the existing problem, a lot of information needs to be known in order to provide the awareness on how the previous system works. The next chapter digs deeper in finding and collecting information concerning this project.

4

CHAPTER THREE

3 LITERATURE REVIEW

This chapter describes the operation and limitation of existing system. It also explains about the proposed system. Furthermore it will provide necessary knowledge and information which will help to attain the objective of the project.

3.1 The existing system There are countless safekeeping and alarms systems depending on the security requirements of the specific residence [2]. Mostly the security systems applied at a large part of our country is the one whose two third depends on human operations and control. The current existing security systems are the CCTVs security groups and many other systems for example at Gymkhanas beach people are updated with commands, that is through the word of mouth. It’s the system that needs human intervention in its operation hence time management is not very effective. The guards walk along the beach giving people with the necessary information in order to keep the place safe.

3.2 Disadvantage of the existing system The most drawbacks of this system are:

3.2.1 Tedious It’s tedious to walk five kilometers daily in ensuring safety at any place. The security system of the Gymkhanas beach depends on man power as its main operator. The system requires its guards to walk along the beach which is about four to five kilometers to ensure safety.

3.2.2 It’s time consuming For the effective security the guard has to visit each part effectively to ensure that no any individual hiding within the place. These tasks of inspecting the whole beach manually ingest a lot of time hence time consuming.

5

3.2.3 Cost fully. The manual operation of security is costly compare to the computerized one. For the manual operation the payment of the guards should be done according to their contract and numbers which is expensive compared to the automatic system. The programmed system will incurs initial expenses of buying and installation costs in addition to very low maintenance expenses.

3.2.4 Not very effective An individual may hide within the caves or over the trees along the beach where he/she cannot be gotten by any guard. By means of the automated system any hidden discrete can be detected using sensors hence trustworthy security.

3.3 The Proposed system In this Project proposal, a sub-security alarm system is intended of which the organization is such that the recorded audible voice command will be played alerting populaces to leave the seaside specifically the Gymkhanas beach. There should also be a frequency generator, repellent unit as referred in figure 3-1 below which produces unpleasant sound to persons who disobeys the command given by this system. Both voice command and disturbing sound frequencies are played via the loudspeaker. The aimed system detects the presence or absence of an individual around by using the PIR sensors that are contained by it. Moreover an RF module is attached to each system ensure security over a large area around the beach by transmitting unique pulse code to another RF unit at the maximum of about 500ft (152M) whenever human sensed. All processes are scheduled and performed by the central control unit.

6

Sensing Control Unit Unit Receiver Part

Control Unit

Repellent Unit Transmitter Part

Figure 3-1The block diagram of the Proposed System In general the system designed will work in a specified period of time, programmed sequence of operations and by sensing the absence or presence of an individual at the beach place. Bringing together the functions of sensors, RF Modules, Human repellent, the Microcontroller and Unit and other components as stated above conclude the named title timed alerting system which significantly support the Gymkhanas beach guards to give directive to the people along that place with appropriate voice commands that are played through the loudspeakers. This can improve the beach safety and security as it will be very effective, save security operation costs as well as time.

3.3.1 Microcontroller A Microcontroller is a single integrated circuit small enough to fit in the palm of the hand. Traditional microcontroller circuit contain four or five separate integrated circuits, the microcontroller CPU itself, an EPROM program memory chip, some RAM memory and an input/output interface [3], [4]. With PIC microcontrollers all these functions are included within a one single package, making them cost effective and easy to use. As shown in Figure 3-2(page 8 of this book)PIC are the microcontrollers manufactured by Microchip Inc. Microcontroller can be used as a brain to control a large variety of products. In order to control devices like PIR sensors which are used to detect the presence of human it is necessary to interface them to the

7 microcontroller. A microcontroller is an embedded chip consisting of a powerful CPU tightly coupled with fixed

Figure 3-2 PIC Microcontroller amount of memory (RAM, ROM or EPROM), various devices such as serial port, parallel port, interrupt controller, ADC, DAC, everything integrated on to a single silicon chip [3],[4],[5]. It does not mean that any microcontroller should have all the above said features on chip. Depending on the area of application for which it is designed, the on chip may not include some of the sections.

3.3.1.1 Programmable Interface Controller (PIC) PICs are microcontrollers made by Microchip, Inc[5]. PIC microcontrollers are used mostly in embedded control applications. Microchip offers hundreds of different PIC devices from tiny 6 pin packages up to 121 pin devices. The PIC line is offered in several families, based on an 8 - bit, 16-bit, or 32-bit core processor with various sets of peripheral and interface hardware on the chip. Each PIC has a processor, program memory, on board clock circuitry, timers, input and outputs. Depending on the device chosen, the memory, operating speed and I/O capacity will vary. Additional functions may include A-D converters, serial ports, USB ports, external memory access, pulse width , ports, comparators, voltage reference and more. Because of the small instruction set and free assembler, PIC programmers often use assembly language to write programming. Although some higher-level language tools are available, languages like C are difficult to implement on some PIC devices because of hardware limitations, like a small fixed stack memory [5],[6]. The microcontroller has the program memory called EPROM and is where we store our written program. This kind of memory is non-volatile and is not affected with the absence of power.

8

During execution of the instructions all the manipulation of data is done in the registers. This kind of memory is known as RAM and is volatile memory, meaning that data are lost with the absence of power.

3.3.1.1.1 Factors to consider in the choice of a PIC The following are the factors to be considered when choosing which PIC to use. i. The amount of memory and application needed to run a program. ii. The peripheral which includes serial communication peripheral. iii. Power consumed by the microcontroller and its form factor that the size and characteristics of the physical package that must reside on the target design. iv. Number of interrupts and timer circuits required, for instance, how many number of data EPROM is requested. v. Clock frequency, this determines the speed at which the instructions are executed. With the higher frequency the microcontroller will finish one task and start another. vi. PIC 16F648A belongs to pic18f family of microcontrollers. PIC16F648A is one among the advanced Microcontrollers from the microchip technology. This microcontroller is very famous in between hobbyist and learners due it functionalities and features such as ADC and USB Integration. A typical PIC16F648A comes in various packages like DIP, QPF and QPN. These packages can be selected according to the project requirement.

3.3.2 Sensing unit Sensor is a device that measures the physical quantity and converts it into a signal which can be read by an instrument. There are various types of sensors but in this project, only sensors that are capable of performing human detection are dealt, specifically infrared sensors. Infrared Sensor (IR) is an electronic device that emits and/or detects infrared radiation in order to sense some aspect of its surroundings. Infrared sensors can measure the heat of an object, as well as detect motion [7]. Many of these types of sensors only measure infrared radiation, rather than emitting it, and thus are known as Passive Infrared (PIR) sensors. Figure 3-3 below shows the PIR sensor. All objects emit some form of thermal radiation, usually in the infrared spectrum. This radiation is invisible to human eyes, but can be detected by an infrared sensor that accepts and interprets it.

9

In a typical infrared sensor like a motion detector, radiation enters the front and reaches the sensor itself at the center of the device.

Figure 3-3 PIR Sensor This part may be composed of more than one individual sensor, each of them being made from pyro-electric materials, whether natural or artificial. These are materials that generate an electrical voltage when heated or cooled [7],[ 8].

3.3.2.1 How PIR sensor works

The sensors work when a heat source example a human body, is detected within the first half of the viewing area of the PIR which causes a positive differential change between the two halves. When the warm body leaves the sensing area, the reverse happens, which generates a negative differential change. These change pulses are what is detected. The PIR sensor itself is housed in an airtight metal can to improve protection from noise, temperature and humidity. There is a window made of IR trans-missive material (typically coated silicon) that protects the sensing element. Behind the window are two balanced sensors. The sensor itself also needs another component to function at its best, a lens. The PIR sensor has a Fresnel and convex lens covering the sensor; these components help to provide a larger viewing area as well channeling any incoming signals directly towards the sensor itself.

3.3.3 Transmitter A radio transmitter is an electronic device which, when connected to an , produces an electromagnetic signal such as in radio and , two way communications or [9]. Heating devices, such as a , although of similar design, are not usually

10 called , in that they use the electromagnetic energy locally rather than transmitting it to another location. Figure 3-5 below show the radio transmitter. A radio transmitter design has to meet certain requirements. These include the frequency of operation, the type of modulation, the stability and purity of the resulting signal, the efficiency of power use, and the power level required to meet the system design objectives. High-power transmitters may have additional constraints with respect to radiation safety, generation of X- rays, and protection from high voltages.

Figure 3-4 Radio transmitter Typically a transmitter design includes generation of a carrier signal, which is normally sinusoidal, optionally one or more frequency multiplication stages, a modulator, a power , and a filter and matching network to connect to an antenna. A very simple transmitter might contain only a continuously running oscillator coupled to some antenna system. More elaborate transmitters allow better control over the modulation of the emitted signal and improve the stability of the transmitted frequency. For example the Master Oscillator-Power Amplifier (MOPA) configuration inserts an amplifier stage between the oscillator and the antenna. This prevents changes in the loading presented by the antenna from altering the frequency of the oscillator.

3.3.3.1 How it works A radio transmitter is an electronic circuit which transforms electric power from a battery or electrical mains into a , which reverses direction millions to billions of times per second. The energy in such a rapidly reversing current can radiate off a conductor (the antenna) as electromagnetic waves (radio waves). The transmitter also impresses information such as an audio or video signal onto the radio frequency current to be carried by the

11 radio waves. When they strike the antenna of a radio receiver, the waves excite similar (but less powerful) radio frequency currents in it. The radio receiver extracts the information from the received waves. A practical radio transmitter usually consists of these parts: i. A power supply circuit to transform the input electrical power to the higher voltages needed to produce the required power output. ii. An circuit to generate the radio frequency signal. This usually generates a of constant amplitude often called the , because it serves to "carry" the information through space. In most modern transmitters this is a in which the frequency is precisely controlled by the vibrations of a quartz crystal. iii. A modulator circuit to add the information to be transmitted to the carrier wave produced by the oscillator. This is done by varying some aspect of the carrier wave. The information is provided to the transmitter either in the form of an audio signal, which represents sound, a video signal, or for data in the form of a binary digital signal. iv. In an AM () transmitter the amplitude (strength) of the carrier wave is varied in proportion to the modulation signal. v. In an FM () transmitter the frequency of the carrier is varied by the modulation signal. vi. In an FSK (frequency-shift keying) transmitter, which transmits digital data, the frequency of the carrier is shifted between two frequencies which represent the two binary digits, 0 and 1. Many other types of modulation are also used. In large transmitters the oscillator and modulator together are often referred to as the exciter. An impedance matching () circuit to match the impedance of the transmitter to the impedance of the antenna (or the to the antenna), to transfer power efficiently to the antenna. If these impedances are not equal, it causes a condition called standing waves, in which the power is reflected back from the antenna toward the transmitter, wasting power and sometimes overheating the transmitter. In higher frequency transmitters, in the UHF and microwave range, oscillators that operate stably at the output frequency cannot be built. In these transmitters the oscillator usually operates at a lower frequency, and is multiplied by frequency multipliers to get a signal at the desired frequency. 12

3.3.3.2 Legal restrictions In most parts of the world, use of transmitters is strictly controlled by law because of the potential for dangerous interference with other radio transmissions (for example to emergency communications). Transmitters must be licensed by governments, under a variety of license classes depending on use such as broadcast, marine radio, Air band, Amateur and are restricted to certain frequencies and power levels. In some classes each transmitter is given a unique call sign consisting of a string of letters and numbers which must be used as an identifier in transmissions. The operator of the transmitter usually must hold a government license, such as a general operator license, which is obtained by passing a test demonstrating adequate technical and legal knowledge of safe radio operation. An exception is made allowing the unlicensed use of low-power short-range transmitters in devices such as cell phones, cordless telephones, microphones, walkie-talkies, Wi-Fi and Bluetooth devices, garage door openers, and baby monitors. In the US, these fall under Part 15 of the Federal Communications Commission (FCC) regulations. Although they can be operated without a license, these devices still generally must be type-approved before sale.

3.3.4 Receivers In radio communications, a radio receiver (commonly called a radio) is an electronic device that receives radio waves and converts the information carried by them to a usable form. It is used with an antenna. The antenna intercepts radio waves (electromagnetic waves) and converts them to tiny alternating currents which are applied to the receiver, and the receiver extracts the desired information. The receiver uses electronic filters to separate the desired radio frequency signal from all the other signals picked up by the antenna, an electronic amplifier to increase the power of the signal for further processing, and finally recovers the desired information through demodulation.

Figure 3-5 Radio Receiver 13

The information produced by the receiver may be in the form of sound (an audio signal), images (a video signal) or data (a digital signal). A radio receiver may be a separate piece of electronic equipment, or an electronic circuit within another device as shown in Figure 3-5 above. Devices that contain radio receivers include television sets, radar equipment, two-way , cell phones, wireless computer networks, GPS navigation devices, satellite dishes, radio telescopes, Bluetooth enabled devices, garage door openers, and baby monitors.

3.3.5 Power Supply The primary purpose of a power supply in this system is to supply power to the Control unit, transmitter and receivers, sensors and other auxiliary parts of the system. A requirement for power supply to the system differs in terms of voltage levels used by each component and the form of power used by most of the equipment’s in dc power.

3.3.6 Chapter Conclusion This chapter has described about the current knowledge including substantive findings, as well as theoretical and methodological contributions to this project. The literature review is expected to play a major role in the design of the proposed system as different ideas from previous works can be used to come up with a new and advanced system. The next chapter explains about the proposed system.

14

CHAPTER FOUR

4 DATA COLLECTION

This chapter describes much on the data collected specifically for the blocks that make up the proposed system. Also, it gives some important data for the components and devices that are going to be used in this project .The data have been collected by considering their characteristics and the availability of the particular device. This study is based on both quantitative and qualitative method in gathering data. Qualitative is concerned with view, perceptions, altitudes as well as value system implemented. Quantitative involves collection of data that can be quantified or measured. These data are obtained from existing system sources by means of surveys, observation and questionnaire.

4.1 Response of Tanzanians on Available Security Systems Majority of Tanzanians specifically of Dar es Salaam City gave different response depending on the attendance, surrounding and the nature of existing security system. Table 4-1 below is the summary of responses from Tanzanians on the available systems obtained from various beach’s i.e Gymkhanas beach, Mikadi, Cocobeach and South beach where as Table 4-2 shows an average beach attendance daily at different beaches. Table 4-1: Fresher’s response to the proposed system security systems Agree the Disagree the Neutral to the Beach Respondents proposed system Proposed system Proposed system Mikadi 23 19 2 2 Cocobeach 18 10 7 1 Gymkhanas 34 28 4 2 South beach 10 3 2 5 Mbalamwezi 22 17 1 4

15

Table 4-2: Average Attendance at different beaches Beach Monday Tuesday Wednesday Thursday Friday Saturday Sunday Mikadi 16 12 20 26 42 50 46 Cocobeach 59 62 78 69 80 253 182 Gymkhanas 37 40 54 73 65 113 74 South beach 13 20 18 22 28 54 49 Mbalamwezi 28 30 27 30 47 60 56

4.2 Technical Data This part describes the specifications on the available equipment that build up the proposed system, depending on their availability in the market.

4.2.1 Control Unit Programmable Interface Controller (PIC) is the one used as the Control Unit. Table 4-3 below shows different PIC specifications. The following are the technical data collected for microcontroller available in the market. Table 4-3: Microcontrollers available in the market [8],[9] Features ATMEGA32 PIC18F252 PIC16F648A PIC18F4550 Operating Frequency DC-40MHz DC-40MHz DC-20MHz DC-20MHz Program memory 32k 32k 368 32 Data EEPROM 256 256 256 256 Timers 4 4 3 3 Serial MSSP MSSP MSSP MSSP Communication Addressable Addressable USART USART USSRB USSRB Parallel Communication _ PSP PSP PSP

Analog to digital 5input 8 input 8 input 8input Converter Channels Channels Channels Channels Input voltage 5v 5v -3.4to5.5v 2 to 5.5 Comparators 2 2 2 2

16

4.2.1.1 PIC 16F648A Microcontroller Specification Technical specification for the needed microcontroller is as shown in Table 4-4 below. Table 4-4: PIC 16F648A Specification [9] Parameter Name Value 1 Program Memory Type Flash

2 Program Memory (KB) 32 3 CPU Speed (MIPS) 12 4 RAM Bytes 2,048 5 Data EEPROM (bytes) 256

6 Timers 1 x 8-bit, 3 x 16-bit 7 ADC 13 ch, 10-bit 8 Comparators 2 9 USB (ch, speed, compliance) 1, Full Speed, USB 2.0 10 Temperature Range (C) -40 to 85

11 Operating Voltage Range (V) 2 t0 5.5

12 Pin Count 18

12 Digital Communication Peripherals 1-UART, 1-A/E/USART, 1-SPI, 1-I2C1-MSSP(SPI/I2C) 13 Capture/Compare/PWM Peripherals 1 CCP, 1 ECCP

14 Oscillator / clock input frequency 8MHz

4.2.2 Sensing unit The sensors desired under this project are Passive Infrared Sensors, PIR. Table 4-5 below shows PIR sensor specifications.

17

Table 4-5: Infrared sensor maximum rating [1], [7] Parameter Symbol Rating Unit

Supply Voltage VCC -0.3 to +10 V

Input Terminal Voltage VIN -0.3 to +3 V

Output Terminal BVQ -0.3 to +10 V Voltage o Operating Temperature Topr -10 to +60 C

o Storage Temperature Tstg -40 to +70 C

4.2.3 Power Supply The table 4-6 below summarizes the voltage values required by basic components in the system. Table 4-6: Power supply Specifications [10] Component(s) Voltage required (V) PIC16F648A +5

Loudspeaker +12Vac

Transmitter Receiver +12

4.2.4 Chapter Conclusion This chapter has described about data collected from different sources. These data have shown the existence of the problem. The data collected will also act as a guide towards designing of the beach alerting and security system. The technical data collected in this chapter are going to be analyzed in order to design the proposed system. The next chapter contains the data analysis and the design of the system.

18

CHAPTER FIVE

5 DATA ANALYSIS AND DESIGN

The data analysis explains much on the procedures which were taken to choose the devices and program software tools used in building the circuit and other subsystem so as to achieve objectives.

5.1 Design of the Proposed System The proposed system included the design of the sensing circuit, audio generation circuit and switching relay circuit with their respective DC power supplies.

5.2 Hardware Description The hardware part included power supplies that provide power of 5Vdc and 12Vdc to the circuit as described in Table 4–6 above, PIR sensors, relays, loudspeaker, PIC microcontroller and MAX232.

5.2.1 Power supply Figure 5–1 below shows ac to dc converter which was used for powering the microcontroller section and PIR sensor section. The transformer is used to step down the 220/240V ac main supply to 12V ac supply. Current handling capacity of the transformer is 500mA [10],[11]. The 12V ac output is given at the power supply regulation stage. It consists of bridge rectifier using D1 up to D4 each of 1N4007. The current handling capacity of this diode is 1A and voltage handling capacity is 1000V. These 4 are used to rectify the low voltage, i.e. 12V ac into 12V dc[12]. The output of this stage is given to the to remove electro-magnetic induction noises. Regulator of IC 7805 is used to regulate the unregulated dc power, where by current carrying capacity of this IC is 1A. Turns Ratio

퐼 푉 푁 1⁄ = 2⁄ = 2⁄ 퐼2 푉1 푁1

19

V 12⁄ = 2⁄ = 0.05 240 V1

Bridge Rectifier

Let Vp (out) be Rectifier output,

Then ,

Vp(sec) = 1.414Vrms ∗ 12V ~ 16.96a. c

Vp(out) = Vp(sec) − 1.4V = 16.96 − 1.4 = 15.55V PIV for each diode will be

푉푝(표푢푡) + 0.7푉 = 16.25푉 Filter

Unfiltered dc Vp (rect) Vp(rect) = Vpsec − 1.4V = 15.55 − 1.4 = 14.15V Taking ripple factor of 3.97%, then capacitor will be

퐶 = 1⁄ 4푓훾푅 × √3

= 20uF,

where γ = 0.0397, f = 50Hz, R = 3.6K Pure dc (filtered dc) 1 Vdc = (1 − ( ⁄2fRC)) ∗ Vp(rect) Frequency for full wave rectified is 100Hz, let capacitor be 20μF, Rl be 3.6kΩ 1 Vdc = (1 − ( ⁄100Hz ∗ 3.6KΩ ∗ 20uF)) ∗ 14.15V = 12.18V

20

Figure 5-1 Power supply

With this voltage, regulators LI7805 will be useful where by output of LM7805 of 5V will be used to power the micro controller, PIR as well as MAX 232[13],[ 14].

5.2.2 PIR sensor A passive infrared sensor, PIR sensor is an electronic sensor that measures infrared light radiating from objects in its field of view. They are most often used in PIR-based motion detectors. The following reasons make it suitable for this project leaving other types of sensors. i. Longer detection range (max 20 ft, 70o x 110o ), selectable by on-board jumper. ii. Wider supply voltage, from 3 to 6 VDC. iii. Higher output current provides for direct control of an external load. iv. Mounting holes included for permanent projects.

5.2.2.1 How PIR sensor works

The sensors work when a heat source i.e. a human body is detected within the first half of the viewing area of the PIR which causes a positive differential change between the two halves. When the warm body leaves the sensing area, the reverse happens, which generates a negative differential change. These change pulses are what is detected [7], [11].

21

The PIR sensor itself is housed in an airtight metal can to improve protection from noise, temperature and humidity. There is a window made of IR trans-missive material (typically coated silicon) that protects the sensing element. Behind the window are two balanced sensors. Figure 5-2 below shows working principle of PIR sensor.

Figure 5-2 Working principle of PIR sensor

The sensor itself also needs another component to function at its best, a lens. The PIR sensor has a Fresnel and convex lens covering the sensor; these components help to provide a larger viewing area as well channeling any incoming signals directly towards the sensor itself.

5.2.2.2 Sensing Mechanism PIR sensors output only a digital signal; to achieve this, three separate push buttons were used to either block or allow current passing through it. Pushing the button the PIC to High while releasing it to Low voltage. As shown in Figure 5-2 below each sensor is represented by single push button.

22

Figure 5-2 PIR Sensors interfacing with the PIC16F648A The aimed system will comprise of three similar PIR sensors each working broadly at an angle equivalent to 1200, hence use of three sensors for the effective and efficient operations.

5.2.3 Programmable interface controller (PIC) There are number of PICs are available in the industry depending on the advancement of technology. They are useful in electronics design due to their ability to perform all other operation as PC can do though this is for a specific task. The PIC used in this project is PIC 18F4550, this is an 8-bit processor that runs up to 20 MHz with external crystal and powerful (200 nanosecond instruction execution) yet easy to program (only 35 single word instructions) CMOS FLASH based 8-bit microcontroller packs Microchip’s powerful PIC architecture into an 40- or 44-pin package and is upwards compatible with the PIC16C5XXX, PIC12CXX and PIC16C7XXX devices.

5.2.3.1 Features of PIC16F648A [6] The following are the features of PIC 16F648A i. Operating Speed: DC – 20 MHz oscillator/clock input, DC – 200 ns instruction cycle Interrupt Capability ii. Precision Internal Oscillator: Factory calibrated to ±1%,Software selectable frequency range of 8 MHz to 31 kHz, Software tunable, Two-Speed Start-up mode, Crystal fail detect for critical applications, Clock mode switching during operation for power savings iii. Power-Saving Sleep mode, Wide Operating Voltage Range (2.0V-5.5V) 23

iv. Industrial and Extended Temperature Range v. Power-on Reset (POR),Power-up Timer (PWRT) and Oscillator Start-up Timer (OST) vi. Enhanced Low-Current Watchdog Timer (WDT) with On-Chip Oscillator (software selectable nominal 268 seconds with full presale) with software enable vii. High Endurance Flash/EEPROM Cell:100,000 write Flash endurance,1,000,000 write EEPROM endurance, Flash/Data EEPROM retention: > 40 years viii. Program Memory Read/Write during run time In-Circuit Debugger (on board) ix. Low-Power Features: Standby Current: 50 nA @ 2.0V, typical, Operating Current: 11μA @ 32 kHz, 2.0V, typical. x. A/D Converter:10-bit resolution and 11/14 channels, Dedicated low-power 32 kHz oscillator xi. Enhanced USART Module: Supports RS-485, RS-232, and LIN 2.0, Auto-Baud Detect Auto-Wake-Up on Start bit. Figure 5-3 below shows port and pin description in microcontroller, as follows.

Figure 5-3 Shows pin and port of PIC Microcontroller

5.2.3.2 For the operations PIC16F648A requires A precise clock input provided by a crystal oscillator with an input frequency of 20 MHz connected to pins 13 (CLKI) and 14 (CLKO) [4], [5], [7].

24

This chip uses a Phase Lock Loop (PLL) frequency multiplier boost the operating frequency of the chip to 48 MHz. The crystal oscillators used in this project were 8MHz frequency, and the two used were 22pF each as seen from the schematic in Figure 3-5 above. Higher capacitances increase the stability of oscillator but also increase the start up time.

5.2.3.3 Advantages of PIC16F648A The following are the advantages of PIC16F648A i. It has more I/O ports, program memory, data memory, and EEPROM data memory than the other PIC18FXXXX family. ii. It has large number of pins availability, also with an internal module supporting UART interface for interfacing with peripherals. iii. It operate over a wide range of voltage ( +2V to +5V)

5.2.4 RF Module The RF module, as the name suggests, operates at Radio Frequency. The corresponding frequency range varies between 30 kHz & 300 GHz [16]. 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).

Figure 5-4 RF Module

25

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 communication uses a specific frequency unlike IR signals which are affected by other IR emitting sources. Figure 5-4 above shows the RF module. Table 5-1: RF Transmitter Pin No Function Name 1 Ground(0V) Ground 2 Serial data input pin Data 3 Supply voltage; 5V Vcc 4 Antenna output pin Antenna

Table 5-2: RF Receiver Pin No Function Name 1 Ground(0V) Ground 2 Serial data output pin Data 3 Linear output pin, not NC connected 4 Supply voltage; 5V Vcc 5 Supply voltage; 5V Vcc 6 Ground(0V) Ground 7 Ground(0V) Ground 8 Antenna input pin Antenna

This RF module comprises of an RF Transmitter and an RF Receiver. The transmitter/receiver (Tx/Rx) pair operates at a frequency of 434 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

26 operating at the same frequency as that of the transmitter. Table 5-1 and 5-2 above shows the pin names of the RF modules. The project uses RF technology to implement this application. The transmitting part will be fixed with the RF transmitter and the RF receiver will be fixed with the remote loudspeaker(s) at the receiving end. This transmitter transmits a unique code continuously into air. The controlling unit, after receiving the data from the RF receiver operates the loudspeaker so as to give out the necessary command. That is the audible command played through the speaker either alert an individual to leave the place or discomfort him by generating disturbing signals. This disturbing signal will be given until the output of the RF receiver changes. The output changes when the RF receiver does not receive any input from the transmitter.

5.2.4.1 The 433 MHz Transmitter This is only the 433MHz transmitter. This will work with the RF Links at 434MHz at either baud rate. Only one 433MHz transmitter will work within the same location.

Use these components to transmit position data, temperature data, and even current program register values wirelessly to the receiver. These modules have up to 500 ft range in open space. The transmitter operates from 2-12V. The higher the Voltage, the greater the range - see range test data in the documents section. Shown in Figure 5-5 is the 433 MHz transmitter.

We have used these modules extensively and have been very impressed with their ease of use and direct interface to an MCU. The theory of operation is very simple. What the transmitter ‘sees’ on its data pin is what the receiver outputs on its data pin. If you can configure the UART module on a PIC, you have an instant wireless data connection. The typical range is 500ft for open area.

Figure 5-5 The 433 MHz RF Transmitter 27

This is an ASK transmitter module with an output of up to 8mW depending on power supply voltage [7], [16]. The transmitter is based on SAW resonator and accepts digital inputs, can operate from 2 to 12 Volts-DC, and makes building RF enabled products very easy.

5.2.4.2 RF Transmitter Features: Below are the stated features of the RF transmitter. i. Operating voltage: DC12V ii. Operating Current: ≤ 10mA iii. Operating frequency:433MHz iv. Transmission Distance: 150 ~ 200m (open area)- Dependent on Transmitter Power Supply v. Encoding type: fixed code; pad code vi. 2400 or 4800bps transfer rate vii. Low cost viii. Extremely small and light weight

5.2.4.3 The 433MHz Receiver The Receiver ASK is an ASK Hybrid receiver module. It is an effective low cost solution for using 433 MHz. The TX-ASK is an ASK hybrid transmitter module. TX-ASK is designed by the saw resonator, with an effective low cost, small size and simple to use for designing [7], [16]. Please note that this device will not support direct UART communication when connected to PC or microcontrollers as there is a lot of noise always available on these frequencies.

Figure 5-6 The 433MHz RF receiver module If you are looking for Serial Communication see RF 2.4Ghz Serial Link instead of this product. We will not be providing any support for serial communications after sales. For remote control applications please use Encoder and Decoder ICs. 28

5.2.4.4 RF Receiver Features The RF receivers have the following features; i. Operating voltage: DC12V ii. Receiver sensitivity:>-105dB iii. Decoding type: fixed code; pad code iv. RX Frequency Range : 433.92 MHz v. Range in open space(Standard Conditions) : 100-150 Meters vi. RX Receiver Frequency : 433 MHz vii. RX Typical Sensitivity : 105 Dbm viii. RX Supply Current : 3.5 mA ix. RX IF Frequency : 1MHz x. Low Power Consumption xi. Easy For Application

5.2.4.4.1 Receiver Sensitivity Receiver sensitivity is a measure of the ability of a receiver to demodulate and get information from a weak signal [16]. We quantify sensitivity as the lowest signal power level from which we can get useful information. In an Analog FM system the standard figure of merit for usable information is SINAD, a ratio of demodulated audio signal to noise. In digital systems receive signal quality is measured by calculating the ratio of bits received that are wrong to the total number of bits received. This is called Bit Error Rate (BER). Most Land Mobile radio systems use one of these figures of merit to quantify sensitivity. To measure sensitivity, we apply a desired signal and reduce the signal power until the quality threshold is met.

SINAD

SINAD is a term used for the Signal to Noise and Distortion ratio and is a type of audio signal to noise ratio [7], [16]. In an analog FM system, demodulated audio signal to noise ratio is an indication of RF signal quality. In order to measure the audio signal to noise ratio, typically test equipment measures total audio power (Signal plus Noise plus Distortion) and then notch filters the audio signal tone (typically 1 kHz) and measures the audio power again (Noise plus Distortion) and takes the ratio in decibels.

29

푆𝑖𝑔푛푎푙+푁표𝑖푠푒+퐷𝑖푠푡표푟푡𝑖표푛 SINAD (dB) = 10×log10( ) 푁표𝑖푠푒+퐷𝑖푠푡표푟푡𝑖표푛

Land Mobile radio industry standards typically use 12 dB SINAD for the measurement of reference sensitivity.

BER

Bit Error Rate is a measure of signal to noise ratio in a digital modulation system [18], [19]. In order to calculate the BER, a known repeating pattern must be transmitted to the radio. The receiver must demodulate the data and compare it to the known data pattern and determine the number of bits that are errors. The BER is then the ratio of bits in error to total bits received. The industry standard for Land Mobile radio is typically 5% BER for reference sensitivity.

Calculate Receiver Sensitivity The sensitivity of a receiver can be calculated if one knows the following performance parameters: the noise figure (NF), the ENBW, and the carrier to noise ratio (C/N) required to achieve the desired quality signal. The sensitivity is as follows: Sensitivity=10×log10 (kTB)+NF+C⁄N This equation defines the signal power in dBw that is present at the demodulator for a desired carrier to noise ratio. Let’s explain each of the terms in this equation.

Thermal Noise Power (kTB)

The total thermal noise power (kTB) is a function of three quantities, 1) Boltzmann’s constant “k” in Joules/˚K, 2) temperature in ˚Kelvin, and 3) the overall bandwidth of the channel selective filtering in the receiver [7], [18], [19]. This is referred to as “Thermal Noise” because of the dependency on temperature. Thermal Noise floor=k(Joules⁄˚K)×T(˚K)×B(Hz)

30

The resulting noise is in Joules/Second or . To convert the noise power to dBw use 10 times the log of the noise power in watts. If we look at the normalized (B = 1 Hz bandwidth), Figure 5-7 noise floor equation, Noise floor =10×log10 (k×T×B) =10×log10 (1.38×〖10-23×290˚×1 Hz) = -203.9 dBW⁄Hz Next, to convert from dBWatts to dB mill watts (dBm) increase this value by 30 dB: –203.9 dBW⁄Hz+30 dB= -173.9 dBm⁄Hz This is the amount of noise power in a 1 Hz bandwidth.

Figure 5-7 Noise power in a 1 Hz bandwidth Noise Figure The Noise figure is the amount of noise power added by the electronic circuitry in the receiver to the thermal noise power from the input of the receiver. The thermal noise at the input to the receiver passes through to the demodulator. This noise is present in the receive channel and cannot be removed. The noise figure of circuits in the receiver such as and mixers, adds additional noise to the receive channel. This raises the noise floor at the demodulator.

Carrier to Noise Ratio (C/N) In order to achieve the desired quality of demodulated signal, the signal power must be higher than the noise floor. The required ratio of signal power to noise floor is known for certain types of modulation. For an analog FM land mobile radio system using 25 kHz channels, the receiver 31 must have approximately 4 dB more signal power than noise power. This represents a carrier to noise ratio 4 dB.

Figure 5-8 Noise Figure added to thermal noise (kTB) Bit Error Rate (BER) is the sensitivity benchmark for digital modulation systems. Eb/No is the ratio of the Energy per bit (Eb) to the noise spectral density (No - the noise power present in 1 Hz). The carrier to noise ratio required for a certain BER is a function of the Eb/No of the signal. This is a digital system representation of signal to noise ratio. Each digital modulation type has aEb/No curve (Eb/No vs. BER). Figure 5-8 describes noise figure added to thermal noisewhereas Figure 5-9 shows carrier to noise ratio. In order to determine sensitivity, use the appropriate curve and find desired bit error rate to determine the necessary Eb/No. Then calculate the Carrier to noise ratio by the following relationship:

퐸푏 퐹푏 Carrier/Noise dB = 10×log10( ) + 10×log10( ) 푁표 퐹표

Where Fb is the bit rate and B is the receiver equivalent noise bandwidth.

32

Figure 5-9 Carrier to Noise ratio Equivalent Noise Bandwidth A filter’s equivalent noise bandwidth (ENBW) is defined as the bandwidth of a perfect rectangular filter that passes the same amount of power as the cumulative bandwidth of the channel selective filters in the receiver.

Figure 5-10 Noise Power in the IF Bandwidth At this point we would like to know the noise floor in our receiver, which is the noise power in the receiver (IF) filter bandwidth that comes from kTB. Since the units of kTB are Watts/ Hz, calculate the noise floor in the channel bandwidth by multiplying the noise power in a 1 Hz bandwidth by the overall equivalent noise bandwidth in Hz. Figure 5-11 shows noise Power in the IF Bandwidth. For a receiver with a 10 kHz ENBW, we calculate the noise floor in dB mill watts (dBm) as follows: Noise floor =10×log1(1.38×〖10-23×290˚×1 Hz×10000)+30 = –134.0 dBm

33

Next we see how the bandwidth of a perfect rectangular filter compares to the actual filter response of the channel selective filters in the receiver. Figure 5-12 below show the perfect filter that passes same power.

Figure 5-13 Perfect filter that passes same power We use the bandwidth of the equivalent ideal rectangular filter (ENBW) to calculate the thermal noise floor. We may specify the equivalent noise bandwidth for design purposes but in practice, it is the composite bandwidth of all of the filters in front of the demodulator. The power that a filter can pass is a function of the area under the filter curve. The filter plot is in dB.

Figure 5-14 Area under filter response

Calculating ENBW from Measured Data

Ideally, we calculate the 2-sided ENBW by integrating the normalized filter power frequency response curve from -infinity to infinity (–fs/2 to fs/2 for a digital filter sampled at a rate of fs). For practical purposes the -60 dB BW values of the normalized filter response can be used as the

34 limits of integration. Since we are looking for bandwidth in , we do not need to know the absolute power under the curve. The above Figure 5-12 describe the area under filter response. The integration must be done in linear terms of watts or mill watts not dB. Scattering parameters or S-parameters are a measurement of how radio frequency (RF) voltage propagates through an RF network. S-parameters of an RF filter can easily be measured using a network analyzer. We then calculate the bandwidth using the measured S-parameter data. Since S-parameters are voltage related measurements, we can convert them to a power quantity by the relationship:

푉표푙푡푎𝑔푒2 Power = 푅푒푠𝑖푠푡푎푛푐푒

Figure 5-15 Integration by summation of rectangles We can use the magnitude of the through response (S21) as the voltage term and normalize the impedance to 1 Ohm to substitute into the Power equation as shown in Figure 5-13 above. This will give us a linear power term. For our case we choose S parameters where the magnitude is in dB. The power must be converted to a linear term for our calculations. (푆21푑퐵) |S21| linear = 10 20 For the overall ENBW, we want a rectangle where the height of the rectangle is equal to the maximum power (|S21|2). The area of the rectangular filter is equal to the area under the filter curve. Calculate the area of the under the IF filter response curve by using numerical integration by uniform rectangles. Find the area of each uniform rectangle by multiplying |S21|2 (power) by the frequency step size used in the S parameter data. 35

2 Area under the filter curve = ∑ (|S21| ×Freq step) For a simple rectangle: 푎푟푒푎 Width = ℎ푒𝑖𝑔ℎ푡 Therefore, the ENBW is: ∑ (|푆21|2 ×퐹푟푒푞 푠푡푒푝) Bandwidth (Hertz) = 푚푎푥𝑖푚푢푚 |푆21|2

Since the S21 terms are unit-less we now have a result that is frequency in Hertz. The result is the bandwidth of a rectangular filter with infinite stop band rejection that passes the same amount of power as the filter that we measured (S parameters). It is this bandwidth that we will use in our calculation of the receiver noise floor (kTB).

5.2.5 Repellent Unit The commands that are played via loudspeakers demand the people recently at the beach to leave the place. The system generates unpleasant frequency to the audience who disobeys the order given. An 8 pin 555 timer were used to generate a frequency in a range suitable for repelling the populaces as shown in Figure 5-14 below.

Figure 5-16 Audio frequency generator circuit The signal generated is between 2 to 5 KHz and voltage supply is between 2 to 5 Volts. The formula for the frequency of the output pulse is

36

Frequency, f 1.4 f= [19],[20] (푅1+2푅2)∗푐1

R1=100kΩ, R2=100k Ω and C1=1n f=4.6 KHz. The pulse width of the trigger signal must be a minimum of 2.5 milliseconds. The voltage supply is between 9 and 20Volts.This circuit consumes about 2mA or less.

5.2.6 Programming Flow Chart After the design is accomplished, next is programming the control unit. The control unit is responsible for scheduling and performance of tasks as per system requirements. Figure 5-15 is the programming flow chart for the desired system.

Figure 5-17 Programming flow chart

37

The language used for programming is language C. Language C is a medium level suitable and mostly used for programming a number of PIC’s. Mikro C is the assembler that’s frequently used to compile the codes for language C.

5.3 Chapter Conclusion This chapter has described about data analysis and system design. It has shown how the blocks of the proposed system have been opened and how component values have been calculated by using suitable design equations. It has also described about how different system parts have been designed and integrated to form overall system. The simulation of the designed system and its results are explained in the next chapter.

38

CHAPTER SIX

6 CIRCUIT SIMULATION TESING AND RESULTS

6.1 Introduction This chapter gives out results of simulations that were obtained during the process of analysis and discussing about these results and feasibility of the designed circuit diagram. This chapter also discuss if the results of the designed circuit meets both general and specific objectives of the project.

6.2 Receiving End The frequency generator and RF receiver are both comprised in the same circuit. Figure 6-1 below shows the schematic circuit for the receiver end which plays a vital role in receiving RF signal input and activates the frequency generator to produce unpleasant frequency.

Figure 6-1 Receiver and frequency generator schematic circuit

39

6.3 Human repellent simulation The frequency of a wave is the number of times per second that a wave repeats its shape. We cannot directly measure the frequency on the oscilloscope, but we can measure a closely related parameter period; the period of a wave is the amount of time it takes to complete one full cycle. Figure 6-2 below is the captured square waveform generated by the 555 timer.

Figure 6-2 Simulation Results As indicated in the image above, one cycle is completed in 2 horizontal grid divisions. I've set time/div to 0.11ms, so 2 divisions equals to 0.22ms Using the relationship frequency = 1/period, I calculated the period of the signal to be or 4500Hz which is very close to the desired frequency of 46 KHz.

6.4 Transmitting Part With the 5V supply and the RF transmitter module, a signal is transmitted to the remote RF receiver in order to activate the control unit which is monitoring and executing all the tasks and operations at the receiving end. Figure 6-3 shows the transmitter’s schematic diagram.

40

Figure 6-3 Transmitter schematic diagram

6.5 Chapter Conclusion This chapter has described about the simulation of the designed system. This includes descriptions about simulation tools used, simulation constraints, performance testing parameters and performance testing procedures. It has also presented the results and their discussions. From the simulation results the prototype has to be built in order to see if the simulation results agree with the results from the actual working prototype. The next chapter gives the details on how the prototype is realized.

41

CHAPTER SEVEN

7 PROTOTYPE IMPLEMENTATION

7.1 Introduction This chapter gives the details about the implementation from the design to realization of the prototype. It also describes about performance testing parameters, testing procedures, results and discussions of the overall performance of the prototype itself.

7.2 Printed Circuit Boards Construction The circuit layouts of the designed system were prepared in Proteus software and translated into Printed circuit board (PCB). Then, the etching process was done by using acidic solution. Figures7-1 and 7-2 below shows the PCB layout for the designed system.

Figure 7-1 PCB layout

42

Figure 7-2 PCB layout for the designed system

7.3 Components Mounting and Connections After the preparations of the PCB the components are mounted to their respective places and soldered. Figure 7-3 shows component mounted on PCB.

Figure 7-3 Components mounting on PCB

7.4 Overall working prototype Figure 7-4 shows the complete diagram of the working prototype. This prototype is obtained after mounting components and solders them in their respective places and integrating them in a single entity.

43

Figure 7-4 Working prototype

7.5 Prototype Performance Test The following are the performance testing parameters of the prototype i. Frequency of the output signal from the fixed frequency sound source ii. Output voltage power supply circuit. iii. Frequency of the output signal from audio amplifier

7.6 Results and Discussion The tables 7-1 shows the results of the measurements from working prototype Table 7-1: Frequencies measured from the sound signal sources SOUND SIGNAL SOURCE FREQUENCY (Hz) Fixed frequency 4500 Audio amplifier output 102 / 143

The results in Table 7-1 shows the results for frequency measured from generator fixed frequency sound source and audio amplifier. Based on the design requirements, the results in the table agree with the required frequency to repel human. Therefore, it is evidence that the obtained results are capable to repel human as well as giving audible sound (command) given.

44

7.7 Chapter Conclusion This chapter has explained the prototype implementation and testing. The results from prototype show that all the specific objectives have been achieved and hence main objective of the project. This implies that the prototype implemented has performed as expected. The next chapter concludes the project, it gives the overall summary of what have been done and achieved throughout the project.

45

CHAPTER EIGHT

8 CONCLUSION AND RECOMMENDATIONS

8.1 Introduction This is the last chapter in this report. It gives out the overall summary of the project done. It includes conclusion and recommendations about the project.

8.1.1 Conclusion This report has provided all basic information concerning the existence of the problem and the procedures towards solving it. Using these procedures, the system has been designed and realized in hardware part. Moreover, the system has been tested and appeared to give the expected results. Considering these results obtained after prototype testing, the overall performance of the designed system is good. Therefore, it can be concluded that the designed system is expected to solve the existing problem. The success in the design of this system will help beach guards in their daily security operations. The designed system will then eliminate the problems such as wastage of time and unnecessary cost incurred by the beach management. The achievement in the design of this system will now create a chance for other technician and engineers to improve the design and implement the new timed alerting system.

8.1.2 Recommendations The designed system has used the analog methods at large in the generation of sound signals for alerting people. For the productions of precise and high quality sound signals for informing the audience, other methods can also be used in generation of these . Some of this methods can be based on software and other digital methods. Moreover, the system can be further modified to detect the number of people remained unresponsive to the system by using different sensors and sending the notification to guards about the status of the system through wireless networks.

46

9 REFERENCES

[1] Raj, S.V., “Implementation of pervasive computing based high-secure smart home system “,IEEE International Conference on Computational Intelligence & Computing Research (ICCIC), Page(s): 1 – 8 [2] Graf, R. F. & Oliver, W. (1963).Modern dictionary of electronics. 7th ed. Slough [etc.]: Foulsham [3] Milan (2008).Microcontroller Inputs and Output ports: Belgrade, MikroElektronika: [4] Han-Way Huang (Year). “PIC microcontroller-An introduction to software and hardware interfacing”. [5] www.microchip.com, 10 January 2016 [6] What Is PIC microcontroller, 2014 [7] Thomas L.F (2005). Electronic Devices .Pearson Education Ltd. Singapore [8] Bestmicrocontrollerproject.com.[Online].http://www.best-microcontroller- projects.com/frequency-counter.html [Accessed: 18 Nov 2015]. [9] http://www.tutorialspoint.com/gsm/gsm_mobile_station.htm, 30 December 2015 [10] Theraja B.L and TherajaAK, Electrical technology, 2002 S.Chad& Company LtdIndia [11] Rams haw, R.S. (1993). “Power Electronics Switches” London Champ & Hall [12] H. W. Beaty, D. G. Fink(ed) Standard Handbook for Electrical Engineers Fifteenth Edition, McGraw-Hill, ISBN 0-07-144146-8. [13] William D. Stevenson(2007), Jr. Elements of Power System Analysis Third Edition, McGraw-Hill, New York. ISBN 0-07-061285-4 [14] DIT project report (2015). Overload and Overheating Monitoring System of the TransformerbyMachuche C Marwa [15] Luis A. Oqedo Class, Kenneth M. Hopkinson (2010) A robust communication based- special protection systemize transaction on power delivery, vol. 25, no. 3 [16] Electronics tutorials (online). http://www.electronics- tutorials.ws/waveforms/555_oscillator.html March 2015. [17] Frequency generator(online) www.ryanmcginty.com/orgone/freqgentutorial.htmaccesed 19th October 2015 47

[18] Lihakanga (2015).”Microprocessor applications lecture notes for BEng 13” Dar essalaam institute of technology. [19] Dogan I. (2008). “Advanced PIC microcontroller projects in C”,Sabre Foundation: page 60-115 [20] Milan, V (2009).Microcontroller-Programming in C Programming Microcontrollers: [21] Barnet C (2002).“Embedded C programming and PIC micro-chip”, Forth Edition, Executive Woods [22] www.developershome.com/sms/GSMModemIntro.asp, 31 December 2015 [23] Mazidi. A.M, The Microcontroller and Embedded system, National Cheng Kung University, 2005. [24] GSM Boards. MikroElektronika. http://www.mikroe.com/add-on-boards/gsm/ 30/12/2015 [25] PSC Visual basic 6.0 third party components for modern standards. Planet Source Code [26] Dogan I. (2010). “Advanced PIC microcontroller projects in C”, Sabre Foundation [27] Violent, ken [2014]“Vk controls:16 GRAPHICALS USER control” PSC. [28] Dr. P. S Bimbhra(1999)Power Electronics [29] Charles B (2006).“Embedded C programming and PIC micro-chip”, Fifth Edition, Executive Woods [30] Frequency generator(online) www.ryanmcginty.com/orgone/freqgentutorial.htmaccesed 19th October 2015

48

APPENDICES

APPENDIX A: Cost Estimation

This cost estimation was the random estimation of the total listed expenses although it can be lower or higher than the typed cost for each expense. Table A Cost estimation COMPONENTS QUANTITY PRICE/ QUANTITY TOTAL 555 TIMER 1 1,500 1,500

AUDIO PLAYER 1 20,000 20,000

CAPACITORS 10 300 3,000

CRYSTAL OSCILLATOR 2 1,000 2,000

CONNECTORS 24 200 4,800

LOUDSPEAKER 1 2,000 2,000

PCB 1 25,000 25,000

PIC 2 20,000 40,000

PIR SENSOR 3 15,000 45,000

RESISTORS 8 500 4,000

RF MODULE 2 12,500 25,000

LED 2 1,000 2,000

INTERNET 40,000 40,000

214,300

49

APPENDIX B: Project Schedule

Table B1 Senior Project I

ACTIVITIES DURATION OF PROJECT IN WEEKS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A B C D E F

KEY: A. Selection of project title B. Title defending C. Problem statement and methodology D. Literature review E. Data collection F. Proof reading and submission of project proposal for marking.

50

Table B2 Senior project II

ACTIVITIES DURATION OF PROJECT IN WEEKS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A B C D E

KEY: A. Data analysis B. Design the circuit and simulation of the design circuit C. Building of circuit and testing of prototype D. Project report writing E. Proof reading and submission of project proposal for marking.

51

52