Top Banner
THE UNIVERSITY OF NAIROBI FACULTY OF ENGINEERING DEPARTMENT OF ELECTRICAL AND INFORMATION ENGINEERING INTELLIGENT KEY FINDER PROJECT INDEX: PRJ 026 BY KIOKO JOSEPH MULWA F17/1449/2011 SUPERVISOR: PROFESSOR H. A. OUMA EXAMINER: DR DHARMA DHIKARY PROJECT REPORT SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE AWARD OF THE DEGREE OF BACHELOR OF SCIENCE IN ELECTRICAL AND ELECTRONIC ENGINEERING OF THE UNIVERSITY OF NAIROBI SUBMISSION DATE: 16 th MAY 2016
74

INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

Apr 03, 2018

Download

Documents

tranphuc
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

THE UNIVERSITY OF NAIROBI

FACULTY OF ENGINEERING

DEPARTMENT OF ELECTRICAL AND INFORMATION ENGINEERING

INTELLIGENT KEY FINDER

PROJECT INDEX: PRJ 026

BY

KIOKO JOSEPH MULWA

F17/1449/2011

SUPERVISOR: PROFESSOR H. A. OUMA

EXAMINER: DR DHARMA DHIKARY

PROJECT REPORT SUBMITTED IN PARTIAL FULFILLMENT OF THE

REQUIREMENT FOR THE AWARD OF THE DEGREE

OF

BACHELOR OF SCIENCE IN ELECTRICAL AND ELECTRONIC ENGINEERING OF

THE UNIVERSITY OF NAIROBI

SUBMISSION DATE: 16th MAY 2016

Page 2: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

ii

DECLARATION OF ORIGINALITY

COLLEGE: Architecture and Engineering

FACULTY/SCHOOL/INSTITUTE: Engineering

DEPARTMENT: Electrical and Information Engineering

COURSE NAME: Bachelor of Science in Electrical and Electronic Engineering

NAME OF STUDENT: KIOKO JOSEPH MULWA

REGISTRATION NUMBER: F17/1449/2011

WORK: Design and build an Intelligent key Finder

1. I understand what plagiarism is and I am aware of the university policy in this regard.

2. I declare that this final year project is my work and has not been submitted elsewhere for examination,

award for degree or publication. Where other people’s work or my work has been used, this has properly

been acknowledged and references in accordance with the University of Nairobi’s requirement.

3. I have not sort or used the services of any professional agencies to produce this work.

4. I have not allowed, and shall not allow anyone to copy my with the intention of passing off it as his/her

own work.

5. I understand that any false claim in respect to this work shall result in disciplinary action, in accordance

with the University anti-plagiarism policy

Signature……………………………………………Date………………………………………

Supervisor’s Signature……………………………..Date……………………………………….

Examiner’s Signature………………………………Date………………………………………..

Page 3: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

iii

DEDICATION

Special dedication to my most loving parents for the moral, financial and unending encouragement and support

they offered to me during my university education. And to my brothers John and Daniel for always being there

for me whenever I need their advice.

Page 4: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

iv

ACKNOWLEDGEMENT

I thank God for the great opportunity He has given me, the protection and good health throughout my university

studies.

My heartfelt gratitude to my supervisor Professor H. A. Ouma for the invaluable guidance, suggestions, much

time offered and support during the entire time of undertaking my project

My deepest appreciation to both my parents and brothers for the support they offered both financially and

morally and most importantly for catering for my entire education.

To my friends Trizah Mburu,Elijah Mugo, Paul, Maggie Wangu, Charles Kariuki and EvalynMwaura for the

brilliant ideas you shared with me concerning the project and for your prayers and encouragement.

I also express my appreciation to the entire staffs of the department for providing a conducive environment to

facilitate our studies. To the lab technicians and the lecturers who shared their knowledge with us.

Finally to my fellow classmates who shared their ideas and support to me throughout the undertaking of my

project. Thank you all.

Page 5: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

v

ABSTRACT

The project is aimed at designing an intelligent key finder to help the user locate the small items commonly

misplaced for example keys within a range of 50 meters. It incorporates use of wireless communication (Radio

Frequency technology) for communication between the tag and the reader.

Everyone has found themselves searching for their keys especially when they are in a hurry but cannot locate

them. This is at times very irritating and also time wasting to try look for them. The project therefore aims to

solve this problem by using cheap Radio Frequency modules where a tag is attached to the keys and one can

locate them using a reader through hearing(sound made by buzzer) and visually if its dark(lighting of an LED).

The project involves both hardware and software design. For the hardware, two microcontrollers are used

Attiny 2313 and Atmega 328p, two RF transceivers (HC1101 433MHz transceivers) were successful used to

design a prototype of a key finder. The range of the transceivers is 100 meters but the range is dependent factors

such as obstacles and the supply voltage. For the software design the coding language used is Arduino. The

prototype was tested and found to be working.

Page 6: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

vi

Contents

DECLARATION OF ORIGINALITY ............................................................................................................... ii

DEDICATION ................................................................................................................................................. iii

ACKNOWLEDGEMENT ................................................................................................................................ iv

Contents ........................................................................................................................................................... vi

LIST OF FIGURES ........................................................................................................................................... x

LIST OF TABLES ....................................................................................................................................... xii

Acronyms ....................................................................................................................................................... xiii

CHAPTER 1 ...................................................................................................................................................... 1

1.0 INTRODUCTION .................................................................................................................................... 1

1.1 Area of project ...................................................................................................................................... 1

1.2 Problem statement ................................................................................................................................ 1

1.3 Justification .......................................................................................................................................... 1

1.4 Objectives ............................................................................................................................................. 2

1.5 Scope of project. ................................................................................................................................... 2

CHAPTER 2 ...................................................................................................................................................... 3

2.0 LITERATURE REVIEW ......................................................................................................................... 3

2.1 Item Tagging ............................................................................................................................................ 3

2.2 Wireless communication .......................................................................................................................... 3

2.2.1 Free space optical............................................................................................................................... 3

2.2.2 Sonic.................................................................................................................................................. 4

Page 7: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

vii

2.2.3 Radio ..................................................................................................................................................... 4

2.2.3.0 Bluetooth ........................................................................................................................................ 4

2.2.3.1 Cellular communication alongside GPS .......................................................................................... 5

2.2.3.2 RFID ............................................................................................................................................... 6

2.3 RF COMMUNICATION ......................................................................................................................... 9

2.4 Microcontrollers ..................................................................................................................................... 11

2.4.1 ADC-Analog-to-Digital Converter ................................................................................................... 12

2.4.2 Timers/Counters .............................................................................................................................. 12

2.4.3 Communication Options: ................................................................................................................. 12

2.4.4 AVR Memories ................................................................................................................................... 14

2.4.4.1 Flash ............................................................................................................................................. 14

2.4.4.2 SRAM .......................................................................................................................................... 14

2.4.4.3 EEPROM ...................................................................................................................................... 14

2.5 USBISP .................................................................................................................................................. 15

2.6 Liquid Crystal Display ........................................................................................................................... 17

2.6.1 Pin diagram ...................................................................................................................................... 18

2.6.2 Pin description ................................................................................................................................. 18

2.7 RF MODULES ...................................................................................................................................... 19

2.7.1 HC-11 to TTL CC1101 Module 433Mhz UART RF transceiver ...................................................... 20

2.8 Voltage Regulator .................................................................................................................................. 23

2.9 Buzzer .................................................................................................................................................... 24

Page 8: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

viii

CHAPTER 3 .................................................................................................................................................... 25

DESIGN AND IMPLEMENTATION ............................................................................................................. 25

3.0 Introduction ............................................................................................................................................ 25

3.1 Hardware design..................................................................................................................................... 29

3.1.0 Microcontrollers .............................................................................................................................. 29

3.1.1 ATTINY 2313 ................................................................................................................................. 29

3.1.1.1 Key features .................................................................................................................................. 30

3.1.1.2Pin description ............................................................................................................................... 31

3.1.2 ATMEGA328P ................................................................................................................................ 32

3.1.2.1 Specifications ................................................................................................................................ 33

3.1.2.2Pin diagram .................................................................................................................................... 33

3.1.3 RF module ....................................................................................................................................... 34

3.1.4 Buzzer ............................................................................................................................................. 34

3.1.5 LEDS ............................................................................................................................................... 35

3.1.6 Push button ...................................................................................................................................... 37

3.1.7 Clock source .................................................................................................................................... 38

3.1.8 Power supply ................................................................................................................................... 38

3.1.9 Voltage regulator ............................................................................................................................. 38

3.1.10 Reset .............................................................................................................................................. 39

3.2 Software design ...................................................................................................................................... 39

3.3 Fabrication ............................................................................................................................................. 42

Page 9: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

ix

3.3.1Actual loading of the HEX code into the MCU ................................................................................. 42

3.3.2 Schematic development. .................................................................................................................. 43

3.3.3 Calculations of power consumption of component used ................................................................... 44

3.3.4 Loading mounting and soldering ...................................................................................................... 47

CHAPTER 4 .................................................................................................................................................... 50

4.0 TESTING, RESULTS AND ANALYSIS .................................................................................................. 50

CHAPTER 5 .................................................................................................................................................... 52

RECOMEDATION AND CONCLUSION ...................................................................................................... 52

REFERENCES ................................................................................................................................................ 53

APPENDIX ..................................................................................................................................................... 55

Arduino Code for transmitter ....................................................................................................................... 55

Arduino code for receiver ............................................................................................................................. 58

BILL OF QUANTITIES .............................................................................................................................. 60

Page 10: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

x

LIST OF FIGURES

Figure 1: RF communication Block diagram [5] .............................................................................................. 10

Figure 2: USBisp cable pin out ........................................................................................................................ 15

Figure 3: USBisp[7] ......................................................................................................................................... 17

Figure 4: LCD pin diagram .............................................................................................................................. 18

Figure 5:RF transceiver and antenna. ............................................................................................................... 20

Figure 6:Pin layout of transceiver .................................................................................................................... 22

Figure 7: LM7805 voltage regulator ................................................................................................................ 23

Figure 8:Buzzer ............................................................................................................................................... 24

Figure 9: Wireless Communication System Block Diagram ............................................................................. 25

Figure 10:Block diagram of transmitter............................................................................................................ 27

Figure 11: Block diagram of receive(Tag) ........................................................................................................ 28

Figure 12: Pin diagram of AT tiny 2313 ........................................................................................................... 31

Figure 13: Atmega 328p pin diagram ............................................................................................................... 33

Figure 14:: Buzzer connection ......................................................................................................................... 35

Figure 15: Led connection ............................................................................................................................... 37

Figure 16: Push button connection ................................................................................................................... 37

Figure 17: LM7805 voltage regulator connection ............................................................................................. 39

Figure 18: Transmitter flow chart.................................................................................................................... 40

Figure 19: Receiver flow chart ......................................................................................................................... 41

Figure 20: Caption of PROGISP ...................................................................................................................... 42

Figure 21: block diagram of transmitter ........................................................................................................... 43

Figure 22: block diagram of receiver................................................................................................................ 44

Figure 23: Transmitter module ......................................................................................................................... 48

Figure 24: Receiver module ............................................................................................................................. 48

Page 11: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

xi

Figure 25: Transmitter Module ........................................................................................................................ 49

Figure 26: Receiver module ............................................................................................................................. 49

Page 12: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

xii

LIST OF TABLES

Table 1 RFID frequency bands .......................................................................... Error! Bookmark not defined.

Table 2 Different forms of wireless communication ........................................................................................... 8

Table 3: Examples of key locators available in market [4] ................................................................................. 9

Table 4: Pin description of USBisp .................................................................................................................. 16

Table 5:LCD pin description ............................................................................................................................ 18

Table 6:Pin description of transceiver .............................................................................................................. 22

Table 7:Buzzer specifications .......................................................................................................................... 24

Table 8:Features of Attiny 2313 ....................................................................................................................... 30

Table 9:Atmega 328p specifications ................................................................................................................ 33

Table 10:Buzzer features ................................................................................................................................. 35

Table 11:Receiver power consumption ............................................................................................................ 45

Table 12:Transmitter power consumption ........................................................................................................ 46

Table 13:Results .............................................................................................................................................. 50

Page 13: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

xiii

Acronyms

GPS- Global Positioning Satellite

RF – Radio Frequency

ISM – Industrial, Scientific and Medical band

RX- Receiver

TX – Transmitter

MCU- Microcontroller

RAM- Radom Access Memory

LCD- Liquid Crystal Display

Page 14: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

1

CHAPTER 1

1.0 INTRODUCTION

1.1 Area of project

In most cases we find ourselves in a rush but can’t trace some of the valuable items that we need to carry with

us such as keys, wallets, porches or even remote controls. As a result, we are forced to start searching for them.

Since they are small it at times becomes difficult to trace them leading to one wasting much time looking for

them. It is in this line that the project is based on to build an intelligent key finder that can help one trace

misplaced objects thereby saving one the much time spent trying to look for them.

1.2 Problem statement

It is common to find ourselves having misplaced small items which are hard to trace. Such items include keys,

wallets, etc. It becomes almost impossible to find them if they have fallen under the couch or are lying

somewhere they cannot be located easily. Everybody has found themselves in such a situation, thus it is of

necessity to try solve the problem by finding a way to help trace such items once they are misplaced.

To do this, we employ the use of wireless communication to design a small gadget that could be attached to

these objects.

1.3 Justification

Successful design and implementation of an intelligent key finder will be invaluable as it will find wide

application in locating small items that are mostly misplaced especially keys, wallets among others. This will

help save the precious time spent looking for these items. The key finder will be implemented using readily

cheap materials and will thereby help save large sums of money that would be used to buy already existing

gadgets.

Page 15: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

2

1.4 Objectives

The main objective of this project is to design and build a working gadget that helps trace misplaced keys

within a range of 50 meters. This will be achieved by

i. Selecting most suitable wireless communication method to help design a small, less

bulky gadget to be attached on the key

ii. Design a microcontroller based key finder using a transmitter/receiver and two

microcontrollers.

iii. To develop software that will help the communication between the transmitter and the

receiver at a specific frequency.

iv. Test the complete gadget built and verify it works.

1.5 Scope of project.

The project will entail building a gadget that could be attached to most commonly misplaced items to help trace

them within a range of 50 meters. This will be divided into two parts. First is the hardware design of the tag and

transmitter, while the second part is the development of the software that will help in the communication

between the transmitter and the receiver at a specified frequency.

Page 16: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

3

CHAPTER 2

2.0 LITERATURE REVIEW

2.1 Item Tagging

Tagging involves attaching a transponder also known as a tag to an item and having a reader to query the tag if

it is within the specified range. This help one locate where the item is or retrieve some information that could be

stored in the tag’s memory. Both the reader and tag have an antenna to help in the conveying of data between

the two.

Different forms of technology have emerged to help locate or connect two items that are separated by a certain

distance. Most of these technologies employ wireless communication which is communication of two modules

which are not directly connected using conductors. Over the past few years the use of RF has been widely used

in tagging of items. RF is an alternating current that if input to an antenna, an electromagnetic field is generated

that can be used for wireless broadcasting and/or communications.

2.2 Wireless communication

Wireless communication involves the communication of two or more points with no conductor connecting the

points. To achieve this, different modes are used which are:[1]

1. Free space optical

2. Sonic

3. Electromagnetic induction

4. Radio

2.2.1 Free space optical

Free-space optical communication (FSO) is an optical communication technology that deploys light propagating

in free space to wirelessly transmit data for telecommunications or computer networking.[1]

Page 17: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

4

It is widely used where physical connection is not applicable eg in cities where laying of cables could be very

expensive.

This technology is used in consumer Infrared devices remote controls.

2.2.2 Sonic

This is short range communication that mostly involves sound eg ultrasonic.

2.2.3 Radio

This is the most common wireless communication. It involves the use of radio waves to carry information, such

as sound, by systematically modulating some property of electromagnetic energy waves transmitted through

space, such as their amplitude, frequency, phase, or pulse width. A radio system

The different forms of technology used are:

2.2.3.0 Bluetooth

Bluetooth technology is a radio frequency standard used for short-range small scale application. It uses a spread,

frequency hopping, full- duplexing signal which was designed to reduce interference between other wireless

technologies thus it provide greater performance even when other wireless technologies are being used.

Bluetooth operates in the unlicensed ISM band 2.4-2.405GHz. The two modules (reader and tag) must be

Bluetooth enabled and have a discovery mode that allows them to function as master and the other as slave.

There are two classes of Bluetooth: Class 1 and class 2. Class 2 Bluetooth works for a short range (10m) and is

the most commonly used especially in mobile devices. Class 1 works for a longer range (100m) and works on

version 4.0.

In selecting the module to use the following parameters are considered.

i. Signal transmission power

As power increases the range increases.

Page 18: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

5

ii. Receiver sensitivity

Directly related to transmission power.

iii. Power consumption

Power consumption for Bluetooth is relatively low.

iv. Size

Bluetooth is suitable for small items.

v. Packaging

Bluetooth can be used in an enclosed module as no antenna is required.

Advantages of Bluetooth

i. Low power consumption

ii. Popular especially due to increase of smartphones

iii. Provide greater performance even when other technologies are being used

iv. Secure as one require a pin to complete connection.

Disadvantages

i. Can only be used for short ranges

ii. In case there are obstacles the receiver sensitivity reduces

2.2.3.1 Cellular communication alongside GPS

The use of GPS helps locate the exact position of the item anywhere in the world. It is widely used when long

range is of great concern, for example; live moving vehicles, aero planes, ships among others. It can also be

used to track small items by attaching a tag on the item and using an application in a mobile device to locate its

position.

Page 19: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

6

Advantages

i. Help with accurate positioning of item.

ii. Is not affected by the presence of obstacles between reader and tag

Disadvantages

i. Expensive

ii. Need to incorporate cellular communication

2.2.3.2 RFID

RFID is a means of storing and retrieving data through electromagnetic transmission to an RF compatible

integrated circuit or antenna. It is a technology that involves gathering of data from an item without the need of

touching or seeing the data carrier, by means of inductive coupling or electromagnetic waves. The data carried

is stored in a microchip/microcontroller attached to a tag/transponder which has an antenna that help transmit

the information to a reader/transceiver within a given range.

RFID is now a generic term used for a variety of technologies that use radio waves to automatically identify

individual item. Just as the name suggest they highly employ radio waves.

RFID can be classified into two categories:

2.2.3.2.1 Active RFIDs

Active tags require a power source. They are thus supplied with power by an integrated battery connected to

some source of power. For this types of tag the battery must be replaced once its lifetime is over. Due to the fact

that a power source must be present to these types of tag, their size is large, cost high and lifetime reduced.

However, they can be used in situations where the range of transmission required is long.

2.2.3.2.2 Passive RFIDs

While the active tags require batteries, the passive RFIDs do not. The reader is responsible for communication

and powering the tags. The tag is either powered through magnetic induction or electronic wave capture. Either

Page 20: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

7

of the design utilizes the electromagnetic properties associated with the RF antenna, that is, near field coupling

or far field emissions.

Passive tags are small, do not require battery maintenance and can stay for a long time. But despite that fact,

they can only be used for small range measurable in centimeters. They are most used in Near Filed Technology

(NFC).

The choice of tag one is to use is greatly dictated by the frequency at which one wants to operate and the range

between the reader and the tag.

Use of radio waves has the following advantages and disadvantages.

Advantages

i. They have high efficiency as one can control signal variation and remove noise.

ii. They are cost effective.

Disadvantages

i. Interference could be an issue, RF due to other RF emitting devices and the wide range of operation of

RF which is 3 kHz-300GHz.

ii. The selection of the bandwidth to be used and range of operation highly depends on the devices being

used.

iii. Radio Frequency devices need to be operated in accordance with the Federal Communications

Commission

RFIDs have widely been used in supply-chain, management, inventory control, and logistics. Another use is

tracking of objects by use of UHF frequencies.

Page 21: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

8

The table below shows different forms of wireless communication with their pros and cons.[3]

Zigbee Infrared Bluetooth RF Transmitter

& Receiver

GSM

Range 10-100 meters Less the 10

meters

10 meters Broad range

(up to 250

meter)

Large distance

Operating

frequency

2.4 GHz 800-900 MHz 2.4 GHz 434 MHz 900MHz

Network

topology

Ad-hoc, peer to

peer

Point to point Ad-hoc, very

small network

Can travel even

when there are

obstacles

between

transmitter &

receiver

By short

message

services

Cost Expensive Low cost Low cost Low cost Expensive

Table 1 Different forms of wireless communication

Some of the technologies discussed have been used to develop key finders. Below is a table showing some

examples of key finders and some of the technologies used.

Page 22: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

9

Name Connectivity Range Approximate

cost

1.BiKN 802.15.4 50-200 feet $129

2.Cobra key

tag

Bluetooth 4 30 feet $42.99

3.hipKey Bluetooth 4 50 meters $89.99

4.Hone Bluetooth 4 100 feet $59.95

5.iAlertTag Bluetooth 4 100 feet $13.95

6. wireless

sensor tag

436Mhz 210 meters $69

Table 2: Examples of key locators available in market [4]

As seen from the table above most of the key finders only work best for short ranges apart from the one using

RF modules of 436 MHZ. According to market value they are also expensive.

2.3 RF COMMUNICATION

RF communication is the most preferred method of data transmission as it is inexpensive and can be used for

long range. There are two ways that the data can be transmitted.

• Parallel transmission

• Serial transmission

RF communication works on the principle of serial communication which is the process of sending data one bit

at time, sequentially, over a communication channel or computer bus. This is in contrast to parallel

communication, where several bits are sent as a whole, on a link with several parallel channels. Thus, we need

something which convert the conventional n-bit (4-bit, 8-bit, 16-bit, etc) data into serial data

There are two options for RF wireless communication;[4]

Page 23: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

10

• With use of a microcontroller (which convert parallel data into serial data)

• With use of encoder and decoder (which convert parallel data into serial data directly

The figure below shows RF communication block diagram.

Figure 1: RF communication Block diagram [5]

Since most of the encoders/decoders/microcontrollers are TTL compatible, most of the inputs by the user will

be given in TTL logic level. Thus, this TTL input is to be converted into serial data input using an encoder or a

microcontroller. This serial data can be directly read using the RF Transmitter, which then performs ASK (in

some cases FSK) modulation on it and transmit the data through the antenna.

On the receiver side, the RF Receiver receives the modulated signal through the antenna, performs all kinds of

processing, filtering, demodulation, and gives out a serial data. This serial data is then converted to a TTL level

logic data, which is the same data that the user has input.[4].The basic building blocks of an RF system are

1. RF-ICs- this include either of the following ICs

• Transmitter

• Receiver

• Transceiver

• System on Chip

• Microcontroller

Page 24: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

11

2. Crystal

• This is used for the local oscillator and the carrier frequency

3. Antenna

4. Filter

• Used to improve selectivity

2.4 Microcontrollers

A microcontroller is a low cost microcomputer on a single chip which usually has the following

• Microprocessor

• Small amount of RAM

• Flash memory

• Parallel and/or serial I/O

• Timers and signal generators

• Analog to digital and/or digital to analog conversion.

Since the microcontroller and the support circuit are mostly built into (embedded) they are referred to as an

embedded systems. They can perform one task or several tasks. Microcontrollers have found wide application

in many fields and in our daily activities we interact with them. Examples are consumer electronics (cell

phones, microwave, smart watches, cameras among many others), automation of industrial processes,

measurement equipment, automated security system robots and many other numerous applications.

Microcontrollers execute programs that instruct them to perform a specific task by interacting with other

hardware devices. These programs are developed using high level language e.g. c, c++, arduino to mention just

a few. High level language is used as it helps in communication between the machine and the microcontroller

since machines can’t understand the human language.

Page 25: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

12

Advantages of High level language

i. One can develop programs easily using high level language

ii. It is easy to debug a program developed in high level language

iii. It is easier to test a program written in high level language

iv. It’s documentation is easy

Disadvantages of high level language

i. Programs written in assembly language are executed faster than those written in high level language

ii. The length of code is longer as compared to one developed in assembly language

For most microcontrollers they possess the following features that are valuable when it comes in design of

remote controllers.

2.4.1 ADC-Analog-to-Digital Converter

In order to have our analog input converted to a digital input for the microcontroller to process it, we have the

ADC interface that performs that conversion. In this project we shall have the push of a button as our analog

input which will be translated to a digital input for it to be processed by the AVR processing core.

2.4.2 Timers/Counters

Timers are used for setting the timings of events. They are also used in PWM application. Counters are used for

counting some external events. Interrupts are used for signaling the microcontroller of some event and

processing the instructions associated with that event. Interrupts may be hardware or software interrupt.

Software interrupts are generated from the peripherals like USART, ADC, TIMERS, and SPI.[5]

2.4.3 Communication Options:

Has three data transfer modules embedded in it.

They are:

• Two Wire Interface

Page 26: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

13

• USART

• Serial Peripheral Interface

USART, SPI and TWI are used for communicating with other devices which have similar interface. These are

serial interface with different speed. SPI is the fastest among all. SPI is a 4 wire serial interface while USART is

three wire and TWI (I2C) is a two wire serial interface.[5]

For the purpose of this project more concentration will be on the USART communication modes as we shall be

transmitting data from one MCU on the transmitter side to another MCU on the receiver end.

2.4.3.0 Using the USART of AVR Microcontrollers

Like many microcontrollers AVR also have a dedicated hardware for serial communication called USART

(Universal Synchronous Asynchronous Receiver Transmitter). This part help in transmission of data using the

standard speeds of serial communication eg (9600, 192000) among others. This speeds are slow compared to

the AVR CPU speed but the USART hardware is able to transmit a byte. USART automatically senses the start

of transmission of RX line and then inputs the whole byte and when it has the byte it informs the CPU to read

that data from one of the registers.

The USART of the AVR is connected to the CPU by the following six registers

2.4.3.1 UDR- USART Data Register

This are two registers. When one reads from it you get data stored in receiver buffer and when one write data to

it, it goes into the transmitter buffer.

2.4.3.2 UCSRA–USART Control and Start Register A.

As the name suggest it is used to configure the USART and also stores some status about the USART. There are

two more of this kind the UCSRB and UCSRC.

Page 27: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

14

2.4.3.3 UBRRH and UBRRL-USART Baud rate register high/low

This is the USART Baud rate register, it is 16BIT wide so UBRRH is the High Byte and UBRRL is the Low

Byte.

2.4.4 AVR Memories

The AVR architecture has two main memory spaces, the Data memory and the Program Memory. In addition

AT tiny features an EEPROM Memory for data storage. All three memories are linear and regular.

2.4.4.1 Flash

This is where the programs complied and uploaded is stored. It is erasable non-volatile memory. Programs in

the microcontroller runs in flash memory.

2.4.4.2 SRAM

Static Random Access Memory (SRAM) is used for transient program state (such as variables) as well as the

program stack and any allocations made by the program. When the program starts, all global variables are

initialized in SRAM by a special routine generated automatically by the compiler. The AVR architecture does

not inherently or automatically reset memory, so without explicit resets by the program (usually automatic) the

memory contents is persistent across resets [6]

2.4.4.3 EEPROM

EEPROM (electrically erasable, programmable, read-only memory) is used for non-volatile persistent storage.

It is a good place to write configuration values (such as baud rates, unique IDs, etc.), to keep track of counters

over a long term, and to keep static data that isn’t needed frequently. Accessing EEPROM memory requires

special instructions and is quite slow compared to SRAM, and can be risky if the device loses power (the data

can be corrupted). Due to the limited number of writes that EEPROM can handle (approximately 100,000)

before failure, care should be taken not to write unnecessarily.[6]

Page 28: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

15

2.5 USBISP

This is a device that allows writing of programs to AVR chips. It is composed of an Atmega88 or Atmega8 and

a few passive components that allow for writing data on the AVR microcontroller.

One end connects into the computer. This allows one to transfer the complied program from the computer to the

USBISP. The other end of the USBISP normally gets connected either to a 6-pin or 10-pin cable, which can

then get hooked to a breadboard through header pins.

Both 6-pin and 10-pin cables are common, so knowing the pin out of these is essential to connecting them.

The 6-pin cable pin out is shown below.

Figure 2: USBisp cable pin out

Page 29: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

16

The table below explains each of the pins and their function

Pin Name Description Comment

MOSI Master Out Slave In This allows the master device (the USBISP) to send data

to the slave (target AVR being programmed).

MISO Master In Slave Out This allows the slave device(target AVR being

programmed) to send information to the master

device(the USBISP programmer)

SCK Serial Clock This is the mutual clock shared between the master and

slave device for synchronized communication.

Reset Target AVR MCU

Reset

The reset pin for the AVR chip being programmed must

be put in active low in order for programming to occur.

Vcc Power The master and the slave device both need power in order

to operate.

GND Common Ground The master and the slave device must share a common

power ground in order to operate.

Table 3: Pin description of USBisp

With this setup, the USBISP is the master device and the AVR microcontroller we are programming is the

target or slave. USBISP is less expensive therefore most suitable for programming AVR microcontrollers. Also

connecting to allow programming is very easy.

Page 30: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

17

Figure 3: USBisp[7]

2.6 Liquid Crystal Display

LCD (Liquid Crystal Display) screen is an electronic display module and finds a wide range of applications. In

the case of this project it was used to display when the tag receives the address from the reader and also the

distance between the two. The reasons being: LCDs are economical; easily programmable; have no limitation of

displaying special & custom characters, 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]

Page 31: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

18

2.6.1 Pin diagram

Figure 4: LCD pin diagram

2.6.2 Pin description

Table 4: LCD pin description

Page 32: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

19

2.7 RF MODULES

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

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). The RF modules perform

the following functions

i. Modulation and demodulation

ii. Up-conversion and down-conversion

iii. Power amplification

Transmission through RF has the following advantages

a) Signals through RF can travel through large distances making it suitable for long range applications

b) RF signals can be transmitted where there are obstructions between the transmitter and the receiver.

c) RF transmission is strong as it use specific frequency thus not interrupted by other signals.

For the project the HC-11 to TTL CC1101 Module 433 MHz UART RF transceiver was selected and its

description is as per its datasheet.[8]

Page 33: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

20

2.7.1 HC-11 to TTL CC1101 Module 433Mhz UART RF transceiver

Figure 5: RF transceiver and antenna.

This is a wireless UART module which is multi-channel embedded wireless data transmission module. It works

at a frequency range of 433.4-473 MHz

The module is encapsulated with stamp hole, can adopt patch welding. There is a PCB antenna pedestal ANT1

on the module, and user can use external antenna of 434 MHz frequency band through coaxial cable; there is

also an antenna solder pad ANT2 on the module, and it is convenient for user to solder spring antenna. User

could select one of these antennas according to use requirements.

There is MCU on the module, and program is needed to utilize the module. In transparent transmission mode,

the module act like normal receiving and sending serial port data, so it is convenient to use. The module adopts

multiple serial port transparent transmission modes, and user could select them by AT command according to

user's requirements. The average working current of three modes FU1, FU2 and FU3 in idle state is 80µa,

3.5mA an 22mA respectively, and the maximum working current is 100mA (in transmitting state).[8]

Page 34: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

21

2.7.1.1 Features

• Long-distance wireless transmission

• Working frequency range (433.4-473.0MHz, up to 100 communication channels)

• Maximum 100mW (2Transmit power: -1dBm to 20dBm0dBm) transmitting power (8 sets of power can

be set)

• Three working modes, adapting to different application situations

• Built-in MCU, performing communication with external device through serial port

• The number of bytes transmitted unlimited to one time

2.7.1.2 Specification [8]

• Working frequency: 433.4MHz to 473.0MHz

• Supply voltage: 3.2V to 5.5 V DC

• Communication distance: 200 m the open space

• Receiving sensitivity: -117dBm to -100dBm

• Interface protocol: UART/TTL

• support serial pass-through mode, replacing serial line (half duplex)

• Operating temperature: -40 to +85

• Dimensions: 27.8 x 14.4 x 4 mm.

Page 35: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

22

2.7.1.3 Pin description

Figure 6:Pin layout of transceiver

Table 5: Pin description of transceiver

Page 36: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

23

2.8 Voltage Regulator

These are electromechanical devices that maintain a consistent output voltage even though its input voltage may

be varying which are units of electromotive force. Voltage regulators keep the voltage within the range that

components can safely accept and use to function properly. Voltage regulators are designed to automatically

maintain a constant voltage level.

A voltage regulator functions by comparing its output voltage to a fixed reference and minimizing this

difference with a negative feedback loop.

The figure below shows an LM7805 voltage regulator.

Figure 7: LM7805 voltage regulator

The main advantage of an LM7805 regulator is that it does not require additional components to work. It has

also built-in protection to prevent the circuit components from damage in case of high voltage.

On the other had its demerit is that the input voltage must be higher than the output by some minimum amount

(typically 2.5 volts). This makes it unsuitable to apply in some circuit designs where the supply voltage and the

output don’t have a difference of 2.5 volts.

Page 37: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

24

2.9 Buzzer

In order to locater the location of the key the tag has a speaker to make some noise one the receiver receives the

transmitted address from the transmitter. This happens when the address transmitted by the transmitter is

matched with that of the receiver. [9]

Figure 8: Buzzer

The buzzer specifications as from the data sheet is as shown below

Table 6: Buzzer specifications

Page 38: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

25

CHAPTER 3

DESIGN AND IMPLEMENTATION

3.0 Introduction

In this section we try to understand the building blocks of the key finder. As was discussed in the literature

review we found out that out gadget will employ the use of wireless communication. The figure below shows

the functional block diagram of the system overview

Figure 9: Wireless Communication System Block Diagram

Input signal

Output

Transducer Amplifier Demodulator

Amplifier Modulator

Communication channel

Page 39: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

26

In this project the communication channel selected was radio waves. In the above block diagram, the first three

blocks (input signal, amplifier and modulator) can be grouped as one block. They are collectively known as the

transmitter. On the other hand the last three blocks (demodulator, amplifier and output transducer) can be

treated as one block known as the receiver. In line of this project the transmitter will comprise push buttons

which act as inputs, a transceiver which act as a modulator as well as an amplifier. An MCU is used to store

some data to be transmitter over to the receiver. Also a liquid crystal display is used to display some

information.

The receiver will comprise of a transceiver which plays the role of a demodulator as well as an amplifier, an

MCU to match the data sent from the transmitter and a LED and buzzer which acts as the output transducers.

The receiver which acts as the tag will be attached to the keys while the transmitter will be in possession of the

owner of the keys. This enables the active communication path between the tag and transmitter within a range

of 50 meters.

The proposed system will be using a microcontroller of the Atmel family and a rectified power supply. The

commands to activate the output transducers are send by the push of a button connected at the transmitter block.

The receiver decodes the matches the address received and the outputs are controlled by the microcontroller

output pins.

At the push of a button, the transmitter sends a unique address through the transceiver and at the same time a

timer is started. The parallel data is converted to serial data which is easily transmitted wirelessly to the receiver

on the tag. The receiver demodulates the data and converts it into parallel data which is fed to the MCU. The

MCU then compares whether the address received is the same as the one stored in its memory using an

algorithm written to its memory. If the address is matched then the output pins of the MCU leads to activation

of the LED, the buzzer. At the same time the receiver also sends some address back to the transmitter which

Page 40: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

27

upon being received and matched to the one stored in the MCU on the transmitter an led lights and the timer

stop. That elapsed time is used to get distance from

∗ /2

The reason we divide by two is because the distance travelled is from and back again to the transmitter.

In order to achieve the main objective of the project, the design work was split into two parts. That is, hardware

design which ensured that the most important components of the project were included and the software design

which was a code written in Arduino language. The purpose of the software is to enable proper communication

between the transceiver on the remote unit (transmitter) and the transceiver on the tag (receiver) and verification

of the transmitted data. If the address received by the tag is found to match with the address sent by the

transmitter then the receiver initiates the MCU to activate the buzzer and led light thereby enabling the user to

locate their lost item.

Figure 10: Block diagram of transmitter

Page 41: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

28

Figure 11: Block diagram of receive(Tag)

As can be seen in figure 10, the transmitter is connected to a microcontroller (AT mega 328P) which is itself

connected to a rectified power supply. The rectification is done using the LM7805 voltage regulator. We also

have two push buttons connected to the microcontroller. These buttons act as the input switches. When they are

pushed a command is sent to locate the lost keys.

In figure 11, we have the receiver connected to a microcontroller (AT tiny 2313). The buzzer and led are

connected to the microcontroller output pins. Their action is controlled by the microcontroller when the right

input is sent from the transmitter.

The first push button acts as the reset switch. When pressed it clears all data in the microcontroller pins.

Page 42: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

29

The second button when pushed activated the buzzer and lights the led. The data transfer from the input is

picked by the RF transceiver (transmitter) and transmits it wirelessly to the receiver. At the receiver end the

transceiver receives the data and feeds it to the inputs of the microcontroller (AT tiny 2313). The

microcontroller then produces corresponding outputs in its output pins.

When the outputs of the microcontroller are activated the buzzer is turned on and it makes some sound which

can be heard. The led also turns on and helps in visual location of the key if it is dark

3.1 Hardware design

3.1.0 Microcontrollers

When selecting the components for the purpose of this project, much consideration was taken into account for

power consumption and the size of component. For the microcontroller selection the AT tiny 2313 was selected

for the tag while the Atmega 328p was selected for the transmitter. Both microcontrollers belong to the Atmel

family.

3.1.1 ATTINY 2313

The AT tiny 2313 is high-performance, low-power Atmel 8-bit AVR RISC-based microcontroller combines

2KB ISP flash memory, 128B ISP EEPROM, 128B internal SRAM, universal serial interface (USI), full duplex

UART, and debugWIRE for on-chip debugging. The device supports a throughput of 20 MIPS at 20 MHz and

operates between 2.7-5.5 volts.

By executing powerful instructions in a single clock cycle, the device achieves throughputs approaching 1

MIPS per MHz, balancing power consumption and processing speed.

Page 43: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

30

It has the following features [10]

Parameter Value

Flash (Kbytes) 2 Kbytes

Pin Count 20

Max. Operating Freq. (MHz) 20 MHz

CPU 8-bit AVR

No of Touch Channels 4

Max I/O Pins 18

Operating Voltage (Vcc) 1.8 to 5.5

I/O Supply Class 1.8 to 5.5

PWM Channels 4

SRAM (Kbytes) 0.12

EEPROM (Bytes) 128

UART 1

TWI (I2C) 1

SPI 2

Table 7:Features of Attiny 2313

3.1.1.1 Key features

• Small(25.984mm L* 8.255mm W)

• Fast and code efficient

• High integration

• Low power consumption

Page 44: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

31

3.1.1.2 Pin description

Figure 12: Pin diagram of AT tiny 2313

VCC: Digital supply voltage.

GND: Ground.

Port A (PA2..PA0) :Port A is a 3-bit bi-directional I/O port with internal pull-up resistors (selected for each

bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source capability.

As inputs, Port A pins that are externally pulled low will source current if the pull-up resistors are activated.

The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.

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 sink and source capability.

As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The

Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running

Port D (PD6..PD0): Port D is a 7-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 sink and source capability.

As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated.

The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running

Page 45: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

32

RESET: Reset input. A low level 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 a reset.

XTAL1 Input to the inverting Oscillator amplifier and input to the internal clock operating circuit. XTAL1 is an

alternate function for PA0.

XTAL2 Output from the inverting Oscillator amplifier. XTAL2 is an alternate function for PA1.

The above features best suits this controller for the tag.

3.1.2 ATMEGA328P

On the other hand Atmega328p belong to the megaAVR series of Atmel family. It has the following

specification that makes it suitable for selection for the project. One of its main advantage for the project is that

is has larger flash memory as compared to the attiny used for the tag and also it has more pin count to help in

the interfacing of the Liquid Crystal display.

Page 46: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

33

3.1.2.1 Specifications

PARAMETERS VALUES

Flash 32 Kbytes

RAM 2 Kbytes

Pin Count 28

Max. Operating Frequency 20MHz

CPU 8-bit AVR

# of Touch Channels 16

Hardware QTouch Acquisition No

Max I/O Pins 26

External Interrupts 24

USB interface No

USB Speed No

Table 8:Atmega 328p specifications

3.1.2.2 Pin diagram

Figure 13: Atmega 328p pin diagram

Page 47: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

34

3.1.3 RF module

In this project the RF module selected should have a range of at least 50 meters. As we chose to use RF

communication, the operating frequency selected was 433MHz in order to increase range. The RF modules

selected must be small as the aim is to make the key finder small and less bulky. The HC-11 to TTL CC1101

Module 433Mhz UART RF transceiver was selected. It possesses the following features that make it suitable

for this project.

• Supply voltage: 3.2 V to 5.5 V

• Communication distance: 200 meters in open space.

• Receiving sensitivity: -117dBm-100dBm.

• Dimensions: 27.8 x 14.4 x 4 mm.

• Working frequency: 433.4MHz to 473.0MHz

The RX pin of the microcontroller was connected to the TX pin of the transceiver.

3.1.4 Buzzer

To locate the place the keys are, a buzzer is required to make sound to alert whoever is looking for their keys.

The buzzer selected has to be small and light and has high loud sound whereas it consumes low power. The

buzzer that was chosen exhibits the following features.

Parameters Values Units

Sound Pressure Level 85 dB

Resonant Frequency 2300+/-300 Hz

Voltage Range 3 ~ 7 Vdc

Current Rating 30 mA

Size / Dimension 12 Diameter* 9.5 Height mm

Tone Continuous 0 pulse/sec

Page 48: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

35

Table 9:Buzzer features

The connection of the buzzer to the microcontroller is as shown in the figure below.

Figure 14: Buzzer connection

The value of resistor R is obtained as follows.

3

30

100

3.1.5 LEDS

To help locate the lost item in a dark environment an led was used so as to blink thereby enabling one locate the

item. The color of the led chosen for this project is light blue. This is because the color can be visible both

during the day and at night.

For these types of led, they have a forward current If = 20 mA and forward voltage drop Vf = 3.2. To obtain the

value of the resistor to be connected between the MCU and the led is as shown below.

Page 49: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

36

=−

Where Vs is the supply voltage. In this case the value is 5 V from the microcontroller pin. Hence the value of R

is

1 =5 − 3.2

20 = 90Ω

According to Ohm’s law the value obtained is 90Ω. The resistor selected is 100Ω as this is the standard value.

By selection of the 100Ω resistor, the value of the forward current of the led is calculated as:

= 1.8100Ω

= 18

This value is within the safe range and cannot lead to damage of the LED. For the receiver circuit, voltage Vs is

3.7V. Hence the value of resistor R2 used is obtained as follows

2 =3.7 − 3.2

20

The value of R2 calculated is 25Ω. The value of resistor selected is 27Ω as it is the standard value. The

selection of this resistor leads to If value of

= 0.527Ω

= 18.51

The value obtained is within a good range and cannot lead to damage of led.

Page 50: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

37

The led connection is as shown below

Figure 15: Led connection

3.1.6 Push button

This is the button when pressed it activates the transmitter to send an address to the receiver upon which when

marched with the address stored in the MCU at the receiver side the buzzer and LED are activated. The

connection of the push button is as shown in the figure below. Contact arising from the push button leads to a

phenomenon known as switch bounce which produce noise to the input. The purpose of the capacitor is to help

eliminate this problem. Once the voltage across the capacitor falls to zero it can only charge through the resistor

R1 with a time constant T= C1 * R1. If T > the period of contact bounce, no noise will be present in the input.

Figure 16: Push button connection

Page 51: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

38

The capacitor acts to smoothen the input within a specific time governed by the equation below.

Τ = RC

Where R is resistance in Ohms and C is capacitance in Farads. T is time in seconds. Therefore the time taken by

switch to register a continuous read value is:

= 10Ω ∗ 10μ

= 10

3.1.7 Clock source

A clock is a device/instrument that help one keep track of time. Frequency is the number of cycles per unit of

time. The microcontroller has an internal clock of 1 – 8 MHz hertz. The internal oscillator was preferred for this

project as the activities undertaken did not require application of an external oscillator. Also since our aim is to

create a small device, elimination of an external oscillator helps to reduce the number of components used in the

circuitry and thereby economizing on space. The only disadvantage of using the internal oscillator is that it not

as accurate as the external oscillator.[10]

3.1.8 Power supply

A 9V Duracell battery was used to power the reader (transmitter) as it requires more power consumption due to

the presence of the LCD. For the tag, a 3.7V lithium battery was used. This was selected so as to facilitate

design of a smaller gadget with a simple circuitry to allow maximum utilization of space.

3.1.9 Voltage regulator

To get a constant output voltage of 5 V from the 9V battery a voltage regulator was used. The LM7805 is used

in this case. Typical connection of LM7805 is a shown in figure 17 below.[7]

Page 52: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

39

Figure 17: LM7805 voltage regulator connection

The value of capacitors C2 and C1 are typically 0.1µF and 0.33µF respectively.[11]

3.1.10 Reset

The reset pin of the At mega 328p is connected as shown in the figure 16. When the push button is pressed the

MCU is reset and the screen of the LCD is cleared. For the At tiny 2313 the reset pin is connected to a 10 kΩ

pull up resistor. The purpose is to eliminate the floating gate scenario in which the status of the pin is undefined.

3.2 Software design

To help the transmitter and the receiver (tag) to communicate efficiently a code was developed. The code is

stored in the microcontrollers memory. It contains a register that must be matched by both the transmitter and

receiver. The programming language used for this project was Arduino. Arduino is easy to understand as

compared to machine language which could be another option.

Page 53: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

40

The flow charts below show the working of the transmitter and the receiver respectively.

Figure 18: Transmitter flow chart

Page 54: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

41

Figure 19: Receiver flow chart

Page 55: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

42

3.3 Fabrication

3.3.1 Actual loading of the HEX code into the MCU

Once the code was written, it was loaded into the microcontroller memory. The HEX file of the code which is

generated by the complier is the one loaded into the MCU. This is the machine language that the

microcontroller can read. For this project a programmer (USBISP ) and PROGISP software were used to burn

the HEX file into the microconrollers.

Figure 20: Caption of PROGISP

Page 56: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

43

3.3.2 Schematic development.

Using proteus 8 software the schematics of both the transmitter and receiver circuit were developed as shown in

the figures below.

Figure 21: block diagram of transmitter

Page 57: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

44

Figure 22: block diagram of receiver

3.3.3 Calculations of power consumption of component used

It is an important know the power consumption of the components used in the design of the key finder. This is

to help the user know when to replace the batteries so as to maintain proper functioning of the finder.

To get power, we use the formula Power (P) = Voltage (V) * Current (I). Some of the components have their

power consumption indicated on the datasheet. Power consumption for the receiver was as calculated below.

Page 58: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

45

Receiver

Name Power

At tiny 2313 1.8-5.5V, max I/O current(total) 200mA

P=VI=200mA*3.7V

0.740 watts

Resistor R1 10 kΩ 0.250 watts

Resistor R2 100Ω 0.250 watts

LED 3.2V, 20mA P=VI, 0.064 watts

Buzzer 3-7V, 30mA, P=VI 0.090 watts

Transceiver 3.2-5.5V, Max 100mA in transmitting state, P=VI 0.320 watts

Total =1.714 watts

Table 10: Receiver power consumption

The lithium battery is designed to supply 3.7V and current rating of 1140 mA. Thus the power supplied is equal

to

=

= 3.7 ∗ 1140

= 4.218

The time in hours for the battery life was calculate as shown below.

=

=4.218 1.714

= 2.4609

Page 59: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

46

Transmitter

Name Values Power

Resistor R1 0.250 watts

Resistor R2 0.250 watts

Resistor R3 0.250 watts

LED 3.2V, 20mA P=VI, 0.064 watts

LCD 5V, 250mA 1.25 watts

Transceiver 3.2-5.5V, Max 100mA in transmitting state, P=VI 0.320 watts

Trimmer 10kΩ 0.100 watts

At mega 328P 1.000 watt

Total = 3.234 watts (i)

Table 11: Transmitter power consumption

The supply has voltage rating of 9V which is rectified to 5V and current of 650 mAH hence the input power can

be calculated as =

= 9 ∗ 650 H (ii)

From the values of obtained in (i) and in (ii) the power consumption and estimate of battery life can be

determined as follows.

=

=5.850ℎ

3.234

Page 60: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

47

= 1.808 hrs.

It can be seen from the above calculation that, the transmitter consumes so much power. This is the reason why

a 9V battery cell is used to power it. The battery life of the receiver and transmitter is 2.4609 hours and 1.808

hours respectively. The calculated time reduces as the gadget is used. Assuming it takes 1.5 minutes to search

for a lost item the tag would make 2.4609 ∗ .

= 99searches before the battery is replaced. On the other

hand the transmitter would make (1.808 ∗ .

= 72). The values calculated could reduce to smaller values as the

power of the garget reduces with time.

3.3.4 Loading mounting and soldering

Once the schematic design was verified and found to be working satisfactory when one the breadboard, the

components were then mounted on a vero board and then soldering was done. The final product is as shown in

the captions below.

Page 61: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

48

Figure 23: Transmitter module

Figure 24: Receiver module

Page 62: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

49

Figure 25: Transmitter Module

Figure 26: Receiver module

Page 63: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

50

CHAPTER 4

4.0 TESTING, RESULTS AND ANALYSIS

Once the final product was ready, it was found to be satisfactory. Test was undertaken to determine the key

finder capabilities. Different environments were used during the test and the following data was obtained.

Condition Range Outcome

Open surrounding 107 meters Sound of buzzer loud but reduced as range increased.

Led would light to show that the receiver was getting

an incoming address

Closed room 63 meters

With obstacles (concrete walls) 35 meters The sound of the buzzer was faintly being heard as

the obstacles increased up to 35 meter

In other room - The buzzer sound was loud and heard easily

Table 12: Results

As it can be seen form the above table, the tags range is greatest when on open surrounding. Once obstacles are

present the range reduces. This is attributed to the fact that the speed of radio waves will be affected for

different materials. Where there is an obstacle the speed tends to be slower. From the test also it was found out

that the loudness of the tag depends on the power of the signals which is dependent on the power supply.

It was not possible to display the distance between the tag and the transmitter. One method that was tried was to

start a counter once the transmitter started sending the address to the receiver. It was found out that irrespective

of the distance the same number of count was displayed on the LCD. For this method the idea of mapping was

implemented where test of a known value of quantity is used to determine the other values that are not known.

Since the same value was obtained for different known distances it was not possible to determine distance.

Page 64: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

51

Another method tried to determine distance was to start timer and stop it once the address was sent and received

back by the transmitter. The value obtained was negligible and the value returned was zero. The microcontroller

on the transmitter clocks at 8MHz. The period of one cycle is thus =

= ∗^

= 0.125μ.The

time taken by transmitter to send address A to the receiver, and the receiver to send back address B to the

transmitter can be calculated as shown below

Using the equation =

. The distance is multiplied by two since the address is sent from the

transmitter to the receiver and back again to the transmitter from the receiver. Therefore the time taken is

= ∗

= 0.167µs. The microcontroller has a 16 bit timer. In 0.167µs the register has not yet changed.

This is the reason we are unable to determine distance.

The above methods failed because RF signals are electromagnetic waves and travel at the speed of light3.0 ∗

10 .

Page 65: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

52

CHAPTER 5

RECOMEDATION AND CONCLUSION

A key finder was designed and used to locate some lost item. This was an achievement as it was the projects

main objective. The dimensions of the tag were found to be 6.5cm(length) by 4 cm(width) while those of the

transmitter were 10 cm by 9.5 cm. It was desired that the project would achieve the calculation of distance and

the direction of the lost key. Unfortunately the parameters were not accomplished. This is as result of the

method chosen for the design of the key finder. RF waves travel at the speed of light which is3 ∗ 10 .

This speed is very fast and to get the time travelled between a ranges of 50m- 100m would be =

= ∗ = 1.66 ∗ 10 for the 50 meters range and =

=

∗ = 3.33 ∗ 10 for

the 100 meters range.

In most cases, RF modules are not suitable in projects where distance is an important parameter to be

determined. Methods such as triangulation can be used which involves use of several transmitters to locate the

position of an object. In the case of this project, this method is not suitable as the above method require

stationary transmitters. For our case this is not so as one moves around with their keys. Other methods used to

determine distance is ultrasonic or GPS.

Another issue is on power consumption and size. Since this was design of a prototype the two issues can be

improved by use of surface mount components. For instance the microcontroller could be replaced with At tiny

2313A and also use of surface mount resistor. The use of these components would lead to design of a tag having

dimensions of 4cm by 2 cm while the transmitter would have dimensions of 9 cm by 5.5 cm. Smaller and

rechargeable batteries would be used so that to help solve the issue of power as one can charge the tag just as

the mobile phone. Mobile application could be used for short range. The mobile application could have more

functionalities like indicating the signal strength and connecting to several tags. In the case of this project the

transmitter can only locate one item which could be a limitation if one had several items.

Page 66: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

53

REFERENCES

[1] "Radio Frequency," [Online]. Available: https://en.wikipedia.org/wiki/Radio-frequency_identification.

[Accessed 27 12 2015].

[2] "wikipedia," [Online]. Available: https://en.wikipedia.org/wiki/Radio-frequency_identification. [Accessed

28 12 2015].

[3] "http://wirelesspatientmonitor.blogspot.co.ke/2012_09_01_archive.html," [Online]. [Accessed 5 1 2016].

[4] "maxembedded.com," [Online]. Available: http://maxembedded.com/2011/09/rf-module-interfacing-

without-microcontrollers. [Accessed 2 1 2016].

[5] "www.electrobucket.com," [Online]. [Accessed 22 12 2015].

[6] "blog.jcole.us," [Online]. Available: https://blog.jcole.us/. [Accessed 22 12 2015].

[7] "www.engineersgarage.com," [Online]. Available: http://www.engineersgarage.com/electronic-

components/16x2-lcd-module-datasheet. [Accessed 6 2 2016].

[8] "www.cytron.com.my," [Online]. Available: http://www.cytron.com.my/p-rf-uart-433-1km?. [Accessed 28

12 2015].

[9] "Elcodis.com," [Online]. Available: . (http://elcodis.com/parts/307/AI-1223-TWT-5V-

R.html#datasheet)(33). [Accessed 20 1 2016].

[10] "www.atmel.com," [Online]. [Accessed 29 1 2016].

[11] "www.engineers garage," [Online]. Available:

Page 67: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

54

http://www.engineersgarage.com/sites/default/files/7805.pdf. [Accessed 15 1 2016].

[12] "postscapes.com/wireless-key-locators," [Online]. Available: http://postscapes.com/wireless-key-locators .

[Accessed 6 1 2016].

[13] Harriis, "Radio Communication in digital Age," vol. Volume 1.

Page 68: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

55

APPENDIX

Arduino Code for transmitter

// the following code sends an address to a receiver which upon being matched with the receiver, the

//buzzer in the receiver sounds and led lights

//distance calculation is calculated using the concept of mapping

#include<SPI.h>

#include <LiquidCrystal.h>

LiquidCrystallcd(2, 3, 4, 5, 6, 7);// initialize the library with the numbers of the interface pins:

#define led 8//define led as pin 8

#define start_button 9 //define start button as pin 9

int count=0;//declare variables

charcomingByte; //declare variables

float start, finished, elapsed,dist;//declare variables

void setup()

pinMode(led,OUTPUT); // initialize push button pin

pinMode(start_button, INPUT);// initialize push button pin

Serial.begin(9600); // initialize serial communication at 9600 bps.

lcd.begin(16, 2); // set up the LCD's number of columns and rows:

Page 69: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

56

lcd.setCursor(3,0); //set cursor (3,0)

lcd.print("KEY FINDER");// Print a message to the LCD.

lcd.setCursor(0,1);

lcd.print(“LOST YOUR ITEM”); //welcome user

delay(100);

lcd.print(“PRESS BUTTON”);

void loop()

int start=digitalRead(start_button); // read state of button

if(start==LOW)

Serial.println("A");//send address “A” to receiver

count++; // start count

if(Serial.available() > 0) //check whether there is anything present on the receive buffer

comingByte = Serial.read();// transmitter check if there is incoming byte from receiver

if(comingByte=='B')

digitalWrite(led,HIGH);// if the byte is received by receiver and sent back to transmitter

lcd.setCursor(0,1);//set cursor (0,1)

int dimension=map(count,0,120 ,0,1); // using value obtained from count to calculated

Page 70: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

57

//mapping is used in this case. By taking known value of

//a unit length which in this case is 120.

lcd.print(dimension);//print on lcd the calculated value of distance

lcd.setCursor(3,1); //set cursor (0,1)

lcd.print("MTR"); //print mtr on lcd

lcd.setCursor(7,1); //set cursor (0,1)

lcd.print("CNT");//print cnt on lcd

lcd.setCursor(11,1); //set cursor (0,1)

lcd.print(count);// print value of count

else

digitalWrite(led ,LOW); //if there is no byte led is off

Page 71: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

58

Arduino code for receiver

//the code used for the receiver. The receiver gets a address and sends back an address to the transmitter.

//upon receiving the address the receiver output pins are activated and the buzzer and led sound and light

//respectively

#define led 8 //define led as connection in pin 8

#define buzzer 9 //define buzzer to as connection in pin 9

charcomingByte; //declare variable cominByte

void setup()

pinMode(led,OUTPUT); // initialize pin 8 as output

pinMode(buzzer,OUTPUT); //initialize pin 9 as output

Serial.begin(9600);// initialize serial communication at 9600 bps.

void loop()

if (Serial.available() > 0) //check serial if there is a incoming address

comingByte=Serial.read(); // read whatever is on serial as the incoming byte

if(comingByte=='A') // check imcoming address match that send by transmitter

Page 72: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

59

Serial.println("B"); //if address match send address B back to transmitter

digitalWrite(buzzer,HIGH); // if incoming address match that send by transmitter

// //buzzer sounds

digitalWrite(led,HIGH); // if incoming address match that send by transmitter light led

else

digitalWrite(buzzer,LOW); //if address does not match buzzer does not sound

digitalWrite(led,LOW); //if address does not match led do not light

Page 73: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

60

BILL OF QUANTITIES

Item Quantity @Kshs TotalKshs

ATtiny 2313 1 150 150

Atmega 328p 1 300 300

Buzzer 1 50 50

Voltage regulator 1 50 50

LCD 1 350 350

9V battery 1 450 450

USBIsp 1 1000 1000

Transceiver 2 1000 2000

Resistors 4 3 12

Capacitors 4 5 20

Switches 3 10 30

Other expenses 250

TOTAL 4662

Page 74: INTELLIGENT KEY FINDER - eie.uonbi.ac.keeie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/INTELLIGENT... · INTELLIGENT KEY FINDER PROJECT INDEX: ... 2.6 Liquid Crystal Display

61