You are on page 1of 42

Table of Contents

Title Page i
Certificate ....................................................................... iii
Acknowledgements iv
Abstract......................................... v
List of Figures . vi
1 Introduction.... 3
1.1 Background...4
1.2 Objective...5
1.2.1

General Objective...5

1.2.2

Technical Objective....5

1.3 Proposed Architecture of the System.....5


1.4 System Flow ......4
1.5 Scope of Work .......................8
1.6 Problem Statement .................8
2

Literature Review .................9

2.1 Radio Frequency ..................10


2.1.1

Electromagnetic wave ...10

2.1.2

Frequency to wavelength conversion ....11

2.2
2.2.1
2.3

RF detector .........................12
Power Levels and their dBm equivalents .13
Factors affecting RF signal .....13

2.3.1

Environmental and physical factors ..13

2.3.2

Equipment factors ....14

2.4 Hardware Literature Review .16


1

2.4.1

AD8307 ...........................16

2.4.1

PT2274 decoder ..........16

2.4.2

Pt2264 encoder ............17

3 Implementation .........19
3.1 Project Implementation Process ..........19
3.1.1

Operation FlowChart .........20

3.1.2

Antenna design.......................................................................................................................................................25

3.2 Transmission side .........27


3.3

Receiving side .................27

3.4

Circuitry for human interface ..............25

4 Results, Conclusion and Future work ...........................................................................................................................30


4.1 Objectives Achieved.........................................................................................................................................................30
4.2 Radiation Pattern ......................................................................................... ..................................................................32
4.3 Conclusion ......................................................................................... ............................................................................33
4.4 Future Work ......................................................................................... ..........................................................................34
References .....................................35
Appendices ...............................36
A. Data Sheet37
B. Code ....41

1. INTRODUCTION
1.1 Background
1.2 Objectives
1.3 Proposed Architecture of the System
1.4 System Flow
1.5 Scope of Work
1.6 Problem Statement

1.1 Background
This work was motivated by a need to find the location of expensive item which has
been lost using RF detector to detect source of radiation attached with that expensive item.
There is an increasing emphasis on using Radio frequency detectors for commercial as well
as military reasons.
Wireless is a term used to describe telecommunications in which electromagnetic waves
(rather than some form of wire) carry the signal over part or all of the communication path.
[1] Some monitoring devices, such as intrusion alarms, employ acoustic waves at frequencies above the range of human hearing; these are also some-times classified as wireless.
Wireless technology is rapidly evolving, and is playing an increasing role in the lives of
people throughout the world. In addition, ever-larger numbers of people are relying on the
technology directly or indirectly and various detection techniques are being used.
Although techniques for detection of source of radiation are well established and practical in
many cases, we envision situations where we need a small size of detector which can easily
be attached with a keychain, like a car remote control.
Using small antennas on both transmitting and receiving sides and setting a particular frequency to
operate our system we detect the radiation, [2] which is totally remote controlled. A coded wireless
signal is transmitted which remotely turns on the other transmitter to send back the signal, Powered
by a battery cell, that is two way radio communication.
The RF detector precisely measures and controls the gain across the transmitter and
receiver signal path within wireless infrastructure equipment to provide accurate,
independent, decibel-scaled voltage outputs.
Radio frequency detection is an important part of any security system [3] where it is
important to detect unauthorized transmissions. A radio frequency detection device can also
be deployed for reasons of safety: there are places such as certain industrial locations where
the use of cell phones, for example, could be a dangerous distraction.

1.2 Objectives:

Objective of the project is to develop a system for detection of RF signals


attached with any expensive item and to program it, so that signal strength and
location can be detected using antenna, and to operate it remotely.
1.2.1 General Objectives:
General objective of the project is to develop an Rf detector which detects a source a
radiation attached with an expensive item.
Develop a remote controlled wireless sytem which is efficient in indoor areas.
To increase the range of detection and to find the direction

1.2.2 Technical Objectives:


Remotely on/off system for transmitter and receiver side.
Microcontroller programing for code detection and interfacing with transmitter.
Design YAGI antenna and Show the radiation pattern at 433 Mhz frequency.
L.C.D interfacing with microcontroller.
Simulation of different circuits.
Integration of entire system.

1.3 Proposed Architecture of the System:


The proposed architecture of the system has been represented in figure . titled as
Communication block diagram of project
Figure shows an RF communication channel with two transistors and two receivers at both
ends.
The receiving side has a small transmitter to transmit signals to other end that is transmitting
side . it has a receiver as well to receive signal from transmitter of other end. This receiver
sends signal to decoder and then microcontroller is attached with it which displays signal
strength as voltage levels, and a buzzer operates when it detects a signal, buzzing is directly
proportional to the signal strength.

The transmitting has a small receiver just to remotely turn on the transmitter. Receiver B
activates Transmitter B which then transmits signal.
both transmitting and receiving sides have small antennas .

Figure 1

1.4 SYSTEM FLOW:


6

A specific code was sent to receiver which matched it with already saved code to turn on the
transmitter B , which radiated radio frequency with the help of antenna. The receiver A
received a signal, decoded it and sent to microcontroller which programmed it and displayed
signal level as a voltage and operated buzzer as well.

Figure 1.1

1.5 Scope of work:


7

The scope of this project is to


i.

Develop a small sized hardware for detecting desired radio frequency radiations.

ii.

Checking the efficiency of RF detector within a specified range

iii.

Using Compass and buzzer to locate the direction of radiating signals

1.6 Problem Statement:


First problem is the development of reliable and small size remote controlled wireless
system which a user can keep attached with a keychain.
Reduce the size of antenna due to size consciousness.
Increase the effective range of communication/detection.
Other problem is to show signal strength using microcontroller.

2. LITERATURE REVIEW
2.1 RADIO FREQUENCY
2.2 RF DETECTOR
2.3 FACTORS AFFECTING RF SIGNAL
2.4 Hardware Literature Review

2.1RADIO FREQUENCY

Radio frequency (RF) is a rate of oscillation in the range of around 3 kHz to 300 GHz, which
corresponds to the frequency of radio waves, and the alternating currents which carry radio signals.
9

2.1.1 Electromagnetic wave


Radio signals are a form of electromagnetic wave, and as they are the way in which radio signals
travel, they have a major bearing on RF antennas themselves and RF antenna design.
Electromagnetic waves are the same type of radiation as light, ultra-violet and infra red rays, differing
from them in their wavelength and frequency. Electromagnetic waves have both electric and magnetic
components that are inseparable. The planes of these fields are at right angles to one another and to
the direction of motion of the wave.

AN ELECTROMAGNETIC WAVE
Figure 2.1

2.1.2 Frequency to Wavelength Conversion


Although wavelength was used as a measure for signals, frequencies are used exclusively today. It is very
easy to relate the frequency and wavelength as they are linked by the speed of light as shown:
lambda = c / f
10

where lambda = the wavelength in metres


f = frequency in Hertz
c = speed of radio waves (light) taken as 300 000 000 metres per second for all practical purposes.
Division Of Radio spectrum

Figure 2.2

2.2 RF detector
An RF detector monitors or samples the output of an RF circuit and develops a dc output voltage proportional to the power (signal strength) at that point.
RF detectors are used primarily to measure and control RF power in wireless systems.[4]
The unit of power is the watt. However, it is com-mon in most RF and wireless applications to
express power in terms of dBm or decibels related to 1 mW:
dBm = 10log [power(mW) / 1 mW]
Transmitter output power measurement is the pri-mary application of Rf detector,
In receivers, power measurement is usually referred to as the received signal strength indicator

11

Figure 2.3

2.2.1 Types of RF detectors


There are two basic types: the logarithmic type and the rms type. The log type converts the input RF power
into a dc voltage proportional to the log of the input, making the output directly related to decibels. The rms
detector creates a dc output pro-portional to the rms value of the signal.

2.3 Factors Affecting an RF Signal


Environmental and equipment factors affect RF propagation Some of these factors include: [5]
Environmental and physical factors
Free-space attenuation
A radio signal behaves like light in free space.As the radio energy expands outward from its source, the
energy is dispersed over an increasingly greater area.However, this dispersion causes the radio waves to
weaken as they travel away from the endpoint.
This weakening, or attenuation, grows rapidly with distance; the signal weakens with the square of the
distance traveled.

Absorption
RF energy is also lost to absorption when radio waves travel through substances.
12

Any non-metallic (non-conducting) objects in the path between the endpoint and receiver will absorb some
of the signal, reducing the signal strength and signal range

Reflection
Metal and other conducting objects reflect RF signals.
Metal structures and materials like aluminum siding and flashing, walls with metal lathe or rebar, chain
link fences, vehicles, water towers, and metal meter vault and pit lids all cause RF reflections . Reflected
signals create multiple paths of the same signal that might be out-of-phase with each other, which can cause
signals to cancel each other out. The result is an undetectable signal at the receiver

Diffraction
Diffraction is a common natural phenomenon that affects light, sound, radio and other coherent waves.
Abrupt changes and sharp edges of path obstructions can lead to signal diffraction, which changes the
signal direction.
Diffraction normally causes signal distortion; however, communications might occur even though the
line of sight is entirely obstructed and the signal is distorted.

Scattering
The direction of radio waves can also be altered through scattering.
An example of scattering is the effect on a beam of light in fog.
Radio waves are similarly scattered when they encounter randomly arranged objects of wavelength size or
smaller, such as water droplets or vegetation

Equipment factors
Receiver Sensitivity
Receiver sensitivity is the minimum signal strength that must be delivered to the receiver before the signal
can be detected and amplified. Receivers that are more sensitive can detect lower strength signals. Receiver
antennas may also differ and affect the signal strengths delivered to the receiver

Transmitter power
13

Transmitter power level is influenced by modern design concepts and regulated by the FCC. In water and
gas applications, the endpoint is typically battery powered, so the design trade-offs of transmitter power,
time interval between transmissions and battery life are major considerations. Mobile systems typically
have lower power endpoints transmitting at short intervals compared to a fixed network endpoint, which
typically transmits less often but at a higher power.

Antenna height
When a fixed network is used, the height of the gateway will limit the absolute maximum range of the
signal paths between the gateway and the endpoints it serves . This is due to the curvature of the earth,
limiting the line-of-sight path between the two radios

Figure 2.4

What does an RF detector do ? [6] lets consider a signal whose input signal strength is
changing in steps as shown in figure. The RF detector quite simply provides a voltage output
that is proportional to the amplitude of the input signal.

To receive radio signals an antenna must be used. However, since the antenna will pick up thousands
of radio signals at a time , a radio tuner is necessary to tune into a particular frequency . this is
typically done via resonator, in Its simplest form from circuit with a capacitor and inductor form a
14

tuned circuit. Resonator amplifies oscillations within a particular frequency band, while reducing
oscillations at other frequencies .
The distance over which radio communication is useful depends significantly on things other than
wavelength such as transmitter power, receiver quality, type ,size and height of antenna, mode of
transmission, noise and interference signals.

2.3 HARDWARE LITERATURE REVIEW:


YAGI ANTENNA :

Gain=11.7 db
f/b ratio=8.933
Director gap=9.5cm
Driven element to Director gap=12.5cm
Reflector to driven Element gap=15cm

2.3.1 AD8307
It is used for Conversion of Signal Level to Decibel Form Transmitter Antenna Power
Measurement Receiver Signal Strength Indication (RS S I) Low Cost Radar and Sonar Signal
Processing Network and Spectrum Analyzers (to 120 dB) Signal Level Determination Down
to 20 Hz True Decibel AC Mode for Multimeters.
FEATURES
Complete Multistage Logarithm ic Amplifier 92 dB Dynamic Range: 75 dBm to +17 dBm
to 90 dBm Using Matching Network Single Supply of 2.7 V Min at 7.5 m A Typical DC
-500 MHz Operation, 61 dB Linearity Slope of 25 m V /dB, Intercept of 84 dBm Highly
Stable Scaling Over Temperature Fully Differential DC -Coupled Signal Path 100 ns PowerUp Tim e, 150 mA Sleep Current

2.3.2 PT2274 decoder:


DESCRIPTION
15

PT2272 is a remote control decoder paired with PT2262 utilizing CMOS Technology. It has
12-bit of tri-state address pins providing a maximum of 531,441 (or 312) address codes;
thereby, drastically reducing any code collision and unauthorized code scanning possibilities.
PT2272 is available in several options to suit every application need: variable number of data
output pins, latch or momentary output type.

Figure 2.5

2.3.3 Pt2264 encoder:


DESCRIPTION
PT2264 is a remote control encoder paired with PT2294 utilizing CMOS Technology. It
encodes data and address pins into a serial coded waveform suitable for RF modulation.
16

PT2264 has a maximum of 12-bit of tri-state address pins providing up to 531,441 (or 312)
address codes; thereby, drastically reducing any code collision and unauthorized code
scanning possibilities.

BLOCK DIAGRAM

Figure 2.6

17

3. IMPLEMENTATION
3.1 PROJECT IMPLEMENTATION PROCESS
3.2 TRANSMISSION SIDE
3.3 RECEIVING SIDE
3.4 CIRCUITRY FOR HUMAN INTERFACE

3.1 Project Implementation process :


18


Dividing the project into plannable stages

When to build the project plan

Who constructs the project plan

Step by step guide to constructing a project plan

Making the project plan visible, getting the project plan used

Independent project plan reviews

Getting resource commitments

Time recording

Tracking progress against the project plan

Revising the project plan during the project


In first phase theory related to project was studied.,Rf signal propogation and electromagnetic wave
properties was covered.
In second phase architetcture and desighn of project was planned and list of equipments were
prepared
In third hase modelling and simulation was done.
In final phase hardware was implemented and then tested .
For RF communication Rf module was used whose operating frequency is 434 Mhz .
The RF module, as the name suggests, operates at Radio Frequency. The corresponding frequency range
varies between 30 kHz & 300 GHz. In this RF system, the digital data is represented as variations in the
amplitude of carrier wave. This kind of modulation is known as Amplitude Shift Keying (ASK).
This RF module comprises of an RF Transmitter and an RF Receiver. The transmitter/receiver (Tx/Rx)
pair operates at a frequency of 434 MHz. An RF transmitter receives serial data and transmits it wirelessly
through RF through its antenna connected at pin4. The transmission occurs at the rate of 1Kbps 10Kbps.The transmitted data is received by an RF receiver operating at the same frequency as that of the
transmitter.
RF MODULE SPECIFICATIONS
Model no:kl-s3
Working voltage:5v
Working frequency:434 mhz.
Working current:4ma
Receiving sensitivity:103dbm
It has low noise figure ,high gain and high sensitivity.

19

Data and transmission


This is very simple. When the transmitter data pin is LO, the transmitter is off, and draws less
than 1uA. (Mine drew 200 nA from the 5v supply when off). When the transmitter data pin is
HI, it is transmitting solid 433 or 315 MHz carrier wave, and with a 5v supply my transmitter
drew about 12mA when transmitting continuous carrier.
The transmitter can be run from a higher voltage (like 12v) which increases the transmitting
power and range. My tests showed a 5v supply was plenty, even for 20 metres range through
multiple house walls. The transmitter is very crude, and all it does is make an RF carrier
wave whenever its data input is HI.
The receiver (when powered up) will crank up its gain untl it starts to receive something. If
no transmitter is working, the receiver will receive some static. If a modulated carrier (a
carrier wave which is turning on and off) is received, the receiver will reduce its gain to
remove lesser signals, and ideally will then output the same modulated digital data as that
which is controlling the transmitter.
It's important to know that the receiver takes a bit of time to adjust its gain, so any "packet"
of data transmitted should start with a "preamble" before the main data and the receiver will
then have time to self-adjust its gain before the important data starts.

20

3.1.1 Operational Function Of Transmitter & Receiver Through Flowchart

Figure 3.1

OPERATION FLOW CHART OF TRANSMITTING CONTINUOUS DATA:

21

Figure 3.2

Operation flow chat explains that while pressing the power on button at user end it enables
the transmitter . if button is unpressed it comes back to standby mode.
Sending four bits of coded data is transmitted continuously for operation, if data is sent
contnuously the system is enabled and command moves to address and enable consecutively,
else if data transmission is stopped command moves to stand by.
so a continuous signal is sent by pressing remote controll to turn on transmitter attached with
that expensive lost item.

22

Figure 3.3

23

3.1.2 ANTENNA DESIGN


The impedance is the relationship between the voltage and the current in their
terminals. It has real part (Ra) and imaginary part (Xa) [7].
Impedance:

Hence, the impedance of the antenna is: Zz = Ra (w) + j Xx (w)


The real part could be divided in the radiation resistance at the antenna and the ohmic
losses resistance at the antenna. Hence, it could be measured the power radiated and the
power dissipated by heat.

Figure 3.4 (a) Antenna parameters

24

Figure 3.4 (b) Antenna Design data

25

3.2 MODEL for transmitter side

Figure 3.5

After the opto-coupler connected in the end of the circuit it is connected to the KL-400
transmitter module. This circuitry is being used to switch on the transmitter which is our
main transmitter whose radiations are detected by the receiver side. In this circuitry it
receives the signal from kl-3sa to switch on the transmitter.
we have used four switches S1, S2, S3 and S4 to give 4-bit parallel data (D0-D3). Since the
switchesare in active low state (i.e. low signal is sent when the switch is pressed), weneed to
add external pull-up resistors as shown, so as to provide a high signalby default. The
Transmiter Enable (TE, pin 14) pin is an actve low pin, [8] Thus,it is permanently grounded,
so as to enable the transistor always. The outputserial data DOUT is fed to the RF Transmiter
Module directly.The most important thing lies in the address pins (A0-A7, pin1-8). Suppose
wehave two wireless devices (A and B) in our house, both have different remotecontrols (AA
and BB) and both implement the same type of RF module (434 MHz). AA is the remote
control of A and BB is of B. Now, we obviousl y wouldnt want AA to control B .

3.3 Model for receiver circuitry:

26

Figure 3.6

The rf input of the circuit is combined with a kl-3sa receiver which receives a signal from
transmitter and the following circuit is used to convert the signal into dbm levels [8] with the
help of analogue to digital converter AD8313 and the output of AD8313 is then connected to
the microcontroller which is programmed for checking the levels of the signals.
The circuit of the receiver is also quite simple. Capacitor C1 is used between Vcc and GND
for noise filtering. Apart from that, all the address pins (A0-A7, pin 1-8) are grounded. This
is to ensure that the transmitted data is being received. Both the transmitter and the receiver
MUST have the same address pins configuration. Pin17 (VT) is enabled whenever the
receiver receives any data. The serial data received by the RF Receiver module is directly fed
to pin 14 (DIN),which is then converted into 4-bit parallel data (D0-D3).

3.4 Circuitry for human interface:


27

Figure 3.7

The micro-controller is getting the input from AD8313 ADC,which is then shown on the L.C.D connected to
the micro-controller.We have used a pic16f877 as we are also having a buzzer whose sound increase with
the decrease in the distance from transmitter side and vice.. A LM7805 Voltage Regulator is a voltage
regulator that outputs +5 volts.
In this panel PIC is used to open and close RF transmitter. Because RF Transmitter affects RF receiver to get
other Transmitters signal, [8]. Thats why transmitter just should be open when a signal wanted to send. PIC
scans signals of MAX232 to find a signal which is aimed to send with RF. When it finds the signal, PIC
supply RF transmitter and signal can be sent.
RF Receiver part receives the signals from the previous transmitter in serial format. These signals are then
fed to the decoder IC which parallelizes the data into 4 bits so that they can be read by the microcontroller to
perform further operations. When a 4 bit data is received by the microcontroller it analyses it and then
displays the corresponding character value on 16X2 LCD.

28

4. RESULTS, CONCLUSION
&
FUTURE WORK
4.1 OBJECTIVES ACHIEVED
4.2 RADIATION PATTERN
4.3 CONCLUSION
4.4 FUTURE RECOMMENDATIONS

4.1 OBJECTIVES ACHEIEVED


29

Transmitter and reciever are designed that are switched on and off remotely.
Microcontroller is programmed and interfaced with receiver for code detection and signal
strength is displayed in voltage levels.
Remotely on/off system for transmitter and receiver side.
Yagi antenna is designed and conneceted with whole module with frequency 433 Mhz.
L.C.D is interfaced with microcontroller
Simulation of different circuits is achieved in proteus software.
Entire system is integrated

Figure 4.1

Figure 4.2
30

4.2 Simulation Result (Radiation Pattern)

Yagi antenna is used for its propagation pattern. Yagi antenna is designed using a
yagi cad software.

Gain=11.7 db
f/b ratio=8.933

Figure 4.3

4.3 CONCLUSION
31

In this thesis we submit a first step towards a goal that would have a profound ramifications
on Radio frequency detection. Our results and hardware picture shows that we have been
very succesfull in achieving our objectives to locate any expensive item that has been lost
and a small box is attached with it which we designed.
Some issues remain that need to be studied before work can continue. In this project was
antenna design, there needs to be much emphasis on antenna design in order to get accurate
results. Similarly the size must be decreased in order to increase the feasibility of user.

4.4 sFuture Recommendations


We would like to recommend the following features to be incorporated in our developed
hardware

Make it on pcb.

Reduce its size

Increase its efficiency.

REFERENCES
32

[1] http://www.radio-electronics.com/info/antennas/basics/emwaves.php
[2] Guillem Arimany, Radio Frequency communication for Modular Robots
University of Southern Denmark Odense, Denmark gucas10@student.sdu.dk
[3] antenna , waves and circuits in radio frequency identification, David M hall
http://autoidlab.cs.adelaide.edu.au/sites/default/files/thesis/davidThesis.pdf
[4] Sakphrom, S.; Thanachayanont, A. "A low-power CMOS RF power detector", Electronics,
Circuits and Systems (ICECS), 2012 19th IEEE International Conference on, On page(s): 177 180
[5] HICKMAN'S ANALOG AND RF CIRCUITS PUBLISHED 1998
[6] http://dkc1.digikey.com/jp/ja/tod/ADI/RF-Detectors_NoAudio/RF-Detectors_NoAudio.html
[7] A.Thiele, Warren L. Stuzman and Gary. Antenna Theory and Design. s.l. : John Wiley & Sons , 1981.
047104458X. Pages 17-40 and 397-421.
[8] http://howstuffworks.com/
[9] http://www.alldatasheet.com/
[10] http://en-us.sennheiser.com/global-downloads/file/1014/SK300G3_529670_0109_US_INT.pdf

33

APPENDICES

APPENDIX A- Data Sheets


APPENDIX B - Coding

APPENDIX A
DATA SHEETS
34

PIC16F84A-20/P - PIC16F84A FLASH 18-PIN 20MHZ 1KB MICROCONTROLLER [7]

FEATURES
High-Performance RISC CPU
- Only 35 single word instructions to learn
- All instructions are single cycle (1s) except for program branches
- Operating speed: DC - 20MHz clock input
- 1 k Bytes Flash Program Memory
- 68 Byte RAM Data Memory
- 68 Byte EEPROM Data Memory
- In-circuit serial programming
- Four Interrupt Sources
Peripheral Features
- High current sink/source for direct LED Drive
- One 8-bit timer/counter(TMR0) with 8-bit programmable prescalar
- One 16 bit timer/counter
- Watchdog Timer (WDT) with separate RC oscillator
Special Microcontroller Features
- Power-On Reset
- Power-up Timer (PWRT) and Oscillator Start-Up Timer (OST)
- 1,000 erase/write cycles Enhanced Flash program memory
- 1,000,000 typical erase/write cycles EEPROM data memory
- Selectable Oscillator Options
CMOS Technology
- Low power, high speed CMOS FLASH technology
- Fully Static Design
- Low Power Consumption
- < 2mA @ 5V, 4MHz
- 15A typical @ 3V, 32kHz
- < 0.5A typical standby current
I/O and Packages
- 13 I/O pins with individual direction control
- 18-pin DIP

35

RF MODULE
36

Pin diagram [7]

Pin Description
RF Transmitter

RF Receiver

37

TRANSMITTER : Sk300 [10]

Antenna Type: External

Modulation Type: Reliable ASK technology

Working Voltage: DC12V

Operating Current: 12mA

RF Output Power (ERP) @433MHz: 3-10mW

Transmitting Distance: 100-200m (320-650 ft.)*

Encoding Type: Fixed Code (2260, 2262, 2264, HT12E, etc.), Learning Code (1527, 527, RT1587, etc.),
Rolling Code (HCS301)**

Encoding Method: Soldering - Fixed Code / Auto code learning - Learning Code and Rolling Code

Frequency: 315MHz / 433MHz, can be customized from 250MHz to 450MHz (SAW filter stabilized)

Channel / Button Number: 1 / 2 / 3 / 4

Battery: 12V 27A Alkaline or 12V 23A Alkaline

Dimension: 58mm x 39mm x 14mm

Operating Temperature: -20 to 72C (-4 to 161.6F)

Enclosure Rating: IP40 (TBC)

Enclosure Material: As shown in product photo, plastic or metallic

Other: Sleek new case with flashing LED transmission indicator, handsome key chain ring provided

Manufacturing: High-quality SMT manufactured

Certificate: CE

APPENDIX B
Coding
//Compiler: mikroC PRO
for PIC v4.60
//Target PIC: PIC16F877A
//sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
38

sbit LCD_RS_Direction at
TRISB2_bit;
sbit LCD_EN_Direction at
TRISB3_bit;
sbit LCD_D4_Direction at
TRISB4_bit;
sbit LCD_D5_Direction at
TRISB5_bit;
sbit LCD_D6_Direction at
TRISB6_bit;
sbit LCD_D7_Direction at
TRISB7_bit;
unsigned long ADRead;
unsigned int vDisp[3];
unsigned char Display[7];
void main() {
PORTA = 0;
TRISA = 0X01;
PORTB = 0;
TRISB = 0;
LCD_Init();
LCD_Cmd(_LCD_CURSO
R_OFF);
LCD_Cmd(_LCD_CLEAR
);
LCD_Out(1, 1, "Field:");
LCD_Out(2, 1,
"Strength");
//Display = "+125 'v";
ADCON1 = 0x0E;
ADC_Init();
while (1){
ADRead =
(ADC_Get_Sample(0) *
500) >> 10;
vDisp[0] = ADRead /
100;
vDisp[1] = (ADRead
/ 10) % 10;
vDisp[2] = ADRead
% 10;
Display[0] =
vDisp[0] + 48;
Display[1] =
39

vDisp[1] + 48;
Display[2] =
vDisp[2] + 48;
LCD_Chr(1, 8,
Display[0]);
LCD_Chr(1, 9,
Display[1]);
LCD_Chr(1, 10,
Display[2]);
LCD_Out(1, 11,
"Volt");
//LCD_Out(1, 8, ); //
'Show temperature
delay_ms(200); //200ms
delay for waiting
}
int freq;
char capacitance[16];
void main()
{
T1CON=0b00110111;
//prescaler 1:8, clock
externo, timer1 ligado
TRISC.F0 = 1;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR
_OFF);
lCD_Out( 1, 3, "" );
Lcd_Out( 2, 7, " );
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
while(1)
{
TMR1L = 0;
TMR1H = 0;
Delay_ms( 1000 );
freq = (TMR1H << 8) |
TMR1L;
if( freq <= 0)
{
Lcd_Cmd(_LCD_CLEAR);
}
else
{
freq = 27050/freq;
//Formula do oscilador
40

IntToStr( freq,
capacitance );
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out_CP( capacitance )
;
}
Delay_ms(1);
}
}
}
//--------------------------------

41

42

You might also like