Professional Documents
Culture Documents
Visitor Counter1
Visitor Counter1
Visitor Counter1
INTRODUCTION
This project titled Microcontroller based Bidirectional Visitor Counter is designed
and presented in order to count the visitors of auditorium, Hall, offices, malls, sports venue
etc. The system counts both the entering and exiting visitor of the auditorium or hall or
other place, where it is placed. Depending upon the interrupt from the sensors, the system
identifies the entry and exit of the visitor. On the successful implementation of the system,
it displays the number of visitor present in the auditorium or hall.
Here we use the term Bi-Directional, it means we use sensor for both entering and
exit and count the total person in the area where we placed it. It means it counts when the
person enter in the room and decrease the count when the person exit the room. This logic
is implemented with the source code with the help of Hi-Tech Compiler.
This system can be economically implemented in all the places where the visitors
have to be counted and controlled. Since counting the visitors helps to maximize the
efficiency and effectiveness of employee, floor area and sales potential of an organization,
etc. A primary method for counting the visitors involves hiring human auditors to stand
and manually tally the number of visitors who pass by a certain location. But humanbased data collection comes at great expense.
Two IR transmitter-receiver pairs are used at the passage: one pair comprising IR
transmitter IR TX1 and receiver phototransistor T1 is installed at the entry point of the
passage, while the other pair comprising IR transmitter TX2 and phototransistor T2 is
installed at the exit of the passage. The IR signals from the IR LEDs or LASER should
continuously fall on the respective phototransistors, so proper orientation of the
transmitters and phototransistors is necessary.
For bidirectional visitor counter we use the PIC16F73 microcontroller IC which is the
heart of this project. This project uses the basic electronics components such as resistors,
capacitors, voltage regulator, bridge rectifier, led, quard Op-Amp, LCD (16*2) etc.
Here we use the concept of light sensors and count the person of entering. But we
extended our logic and use the L293D for motor control for gate open and close and
modem to send data to a particular number.
1
Chapter-2
METHODOLOGY
Methodology adopted for the project consists of the following activities:
ACTIVITY 1: SURVEY
SURVEY is also called as feasibility analysis or the initial business study. It
begins with a request from the user for a new system. It involves the following:
Identify the responsible user for the system.
Identify deficiencies in the current system.
Establish goals and objective for the new system.
Determine feasibility for the new system.
Prepare a project charter that will be used to guide the remainder of the project.
ACTIVITY 2: SYSTEM ANALYSIS
The objective of system analysis activity is to develop structured system
specification for the proposed system. The structured system specification should describe
what the proposed system will do, independent of the technology which will be used to
implement these requirements. This activity includes making list of the components
needed in the project. Thus, this step also includes the designing of circuits according to
need. For example, for an opamp in inverting mode with a required gain of 100, values of
resistances should be chosen accordingly.
ACTIVIYT 3: COMPONENT SEARCH
The objective of this activity is to search the components present in the
component list and other apparatus, which will be required during the project. Once the
components are arranged the apparatus required for PCB manufacturing is arranged.
ACTIVITY 4: PRELIMIRY DESIGN
The primary objective of this step is to transform the functional specification of
the user requirement into the physical specification. The physical specification of the
2
system defines the appearance of the system for the user. This step also includes the
testing of the given i.e. designed circuit on breadboard.
ACTIVITY 5: IMPLEMENTATION
This activity involves PCB manufacturing and component mounting on that PCB.
Thus this involves soldering; integration of various components. The output of this
activity is the complete integrated system.
ACTIVITY 6: QUALITY ASSURANCE
The objective of this activity is to check whether the desirable output is produced
for given set of inputs. Thus this test aims at ensuring that the functional requirements of
the user are being met. Thus the output of this system is the accepted system. The new
system will be acceptable only if it produces satisfactory result on test data.
ACTIVITY 7: PROCEDURE DESCRIPTION
The objective of this activity is to produce a manual, which may be used as a
guide for using or operating the system. In fact, there may be several manuals catering to
the needs of different types of person. A manual should describe the manual procedures as
well as the interface with the automated portion of the system.
Chapter-3
COMPONENTS DESCRIPTION
3.1 LCD
DMC series is the name given to the dot matrix character LCD display modules
that have been developed by OPTREX CORPORATION. The modules consist of high
contrast and large viewing angle TN and STN type LC (liquid crystal) panels. Each
module contains a CMOS controller and all necessary drivers which have low power
consumption. The controller is equipped with an internal character generator ROM, RAM
and RAM for display data. All display functions are controllable by instructions making
interfacing practical. Both display data RAM and character generator RAM can be read
making it possible to use any part not used for display as general data RAM. The products
of this series therefore have wide application possibilities in the field of terminal display
or display for measuring devices.
It is an electronically modulated optical device made up of any number of
segments filled with liquid crystals and arrayed in front of a light source (backlight) or
reflector to produce images in color or monochrome. The most flexible ones use an array
of small pixels.
Each pixel of an LCD typically consists of a layer of molecules aligned between
two transparent electrodes, and two polarizing filters, the axes of transmission of which
are (in most of the cases) perpendicular to each other. With no actual liquid crystal
between the polarizing filters, light passing through the first filter would be blocked by
the second (crossed) polarizer.
The surfaces of the electrodes that are in contact with the liquid crystal material
are treated so as to align the liquid crystal molecules in a particular direction. This
treatment typically consists of a thin polymer layer that is unidirectional rubbed using, for
example, a cloth. The direction of the liquid crystal alignment is then defined by the
direction of rubbing. Electrodes are made of a transparent conductor called Indium Tin
Oxide (ITO). The Liquid Crystal Display is intrinsically a passive device, it is a simple
4
light valve. The managing and control of the data to be displayed is performed by one or
more circuits commonly denoted as LCD drivers.
Before applying an electric field, the orientation of the liquid crystal molecules
is determined by the alignment at the surfaces of electrodes. In a twisted nematic device
(still the most common liquid crystal device), the surface alignment directions at the two
electrodes are perpendicular to each other, and so the molecules arrange themselves in a
helical structure, or twist. This reduces the rotation of the polarization of the incident
light, and the device appears grey. If the applied voltage is large enough, the liquid crystal
molecules in the center of the layer are almost completely untwisted and the polarization
of the incident light is not rotated as it passes through the liquid crystal layer. This light
will then be mainly polarized perpendicular to the second filter, and thus be blocked and
the pixel will appear black. By controlling the voltage applied across the liquid crystal
layer in each pixel, light can be allowed to pass through in varying amounts thus
constituting different levels of gray.
3.2 L293D IC:L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as
current amplifiers since they take a low-current control signal and provide a highercurrent signal. This higher current signal is used to drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its common mode of
operation, two DC motors can be driven simultaneously, both in forward and reverse
direction. The motor operations of two motors can be controlled by input logic at pins 2 &
7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10
will rotate it in clockwise and anticlockwise directions, respectively.
6
Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to
start operating. When an enable input is high, the associated driver gets enabled. As a
result, the outputs become active and work in phase with their inputs. Similarly, when the
enable input is low, that driver is disabled, and their outputs are off and in the highimpedance state.
3.3 DC motor
While controlling the speed of a DC motor with a single transistor has many
advantages it also has one main disadvantage, the direction of rotation is always the same,
its a "Uni-directional" circuit. In many applications we need to operate the motor in both
directions forward and back. One very good way of achieving this is to connect the motor
into a Transistor H-bridge circuit arrangement and this type of circuit will give us "Bi
directional" DC motor control as shown below.
Then, by applying opposite logic levels "1" or "0" to the inputs A and B the motors
rotational direction can be controlled as follows.
Table 3.3 - H-bridge Truth Table
It is important that no other combination of inputs are allowed as this may cause
the power supply to be shorted out, ie both transistors, TR1 and TR2 switched "ON" at
the same time, (fuse = bang!).
As with uni-directional DC motor control as seen above, the rotational speed of
the motor can also be controlled using Pulse Width Modulation or PWM. Then by
combining H-bridge switching with PWM control, both the direction and the speed of the
motor can be accurately controlled. Commercial off the shelf decoder IC's such as the
SN754410 Quad Half H-Bridge IC or the L298N which has 2 H-Bridges are available
with all the necessary control and safety logic built in are specially designed for H-bridge
bi-directional motor control circuits.
This type of circuit uses a bipolar Transistor (A Darlington transistor may also be
used were a higher current rating is required) to control the motor from a single power
supply. By varying the amount of base current flowing into the transistor the speed of the
motor can be controlled for example, if the transistor is turned on "half way", then only
half of the supply voltage goes to the motor. If the transistor is turned "fully ON"
(saturated), then all of the supply voltage goes to the motor and it rotates faster. Then for
this linear type of control, power is delivered constantly to the motor as shown below.
10
3.4 LM324 IC
LM324 is a 14pin IC consisting of four independent operational amplifiers (op-amps)
compensated in a single package. Op-amps are high gain electronic voltage amplifier with
differential input and, usually, a single-ended output. The output voltage is many
timeshigher than the voltage difference between input terminals of an op-amp.
These op-amps are operated by a single power supply LM324 and need for a dual supply
is eliminated. They can be used as amplifiers, comparators, oscillators, rectifiers etc. The
conventional op-amp applications can be more easily implemented with LM324.
This circuit demonstrates the principle of operation of opamp (operational amplifier) as
comparator. A comparator is a device which compares two voltages or currents and
switches its output to indicate which is larger. A standard op-amp operating without
negative feedback is used as a comparator. When the non-inverting input (V+) is at a
11
higher voltage than the inverting input (V-), the high gain of the op-amp causes it to
output the most positive voltage it can. When the non-inverting input (V+) drops below
the inverting input (V-), the op-amp outputs the most negative voltage it can. Since the
output voltage is limited by the supply voltage.
Inputs
Output
->+
Negative
+>-
Floating
12
3.5 LM317 IC
The LM317T is a adjustable 3 terminal positive voltage regulator capable of
supplying in excess of 1.5 amps over an output range of 1.25 to 37 volts. The device also
has built in current limiting and thermal shutdown which makes it essentially blow-out
proof.
Output voltage is set by two resistors R1 and R2 connected as shown below. The
voltage across R1 is a constant 1.25 volts and the adjustment terminal current is less than
100uA. The output voltage can be closely approximated from Vout=1.25 * (1+(R2/R1))
which ignores the adjustment terminal current ``but will be close if the current through R1
and R2 is many times greater. A minimum load of about 10mA is required, so the value
for R1 can be selected to drop 1.25 volts at 10mA or 120 ohms. Something less than 120
ohms can be used to insure the minimum current is greater than 10mA. The example
below shows a LM317 used as 13.6 volt regulator. The 988 ohm resistor for R2 can be
obtained with a standard 910 and 75 ohm in series.
When power is shut off to the regulator the output voltage should fall faster than
the input. In case it doesn't, a diode can be connected across the input/output terminals to
protect the regulator from possible reverse voltages. A 1uF tantalum or 25uF electrolytic
capacitor across the output improves transient response and a small 0.1uF tantalum
13
14
The 7805 and LM317 ICs have been around for a long time, and they still work.
However, they have a minimum Vdrop of about 1.7V across them, which means they
consume power and generate heat. "Low dropout voltage" it means that the difference
between the input and output voltage is lower than the typical 1.7V. Those regulators use
a more efficient scheme to pass current through than traditional linear regulators.
3.6 Regulator IC(7805):The 7805 voltage regulators employ built-in current limiting, thermal shutdown,
and safe-operating area protection which make them virtually immune to damage from
output overloads. 7805 is a three-terminal positive voltage regulator.
With adequate heat sinking, it can deliver in excess of 0.5A output current. Typical
applications would include local (on-card) regulators which can eliminate the noise and
degraded performance associated with single-point regulation.
7805 regulator comes from the 78xx family of self-contained fixed linear voltage
regulator integrated circuits. The 78xx family is a very popular choice for many electronic
circuits which require a regulated power supply, due to their ease of use and relative
cheapness. When specifying individual ICs within this family, the xx is replaced with a
two-digit number, which indicates the output voltage the particular device is designed to
provide (for example, the 7805 voltage regulator has a 5 volt output, while the 7812
produces 12 volts). The 78xx lines are positive voltage regulators, meaning that they are
designed to produce a voltage that is positive relative to a common ground. There is a
related line of 79xx devices which are complementary negative voltage regulators. 78xx
and 79xx ICs can be used in combination to provide both positive and negative supply
voltages in the same circuit, if necessary.
7805 ICs have three terminals and are most commonly found in the TO220 form
factor, although smaller surface-mount and larger TO3 packages are also available from
some manufacturers. These devices typically support an input voltage which can be
anywhere from a couple of volts over the intended output voltage, up to a maximum of 35
or 40 volts, and can typically provide up to around 1 or 1.5 amps of current (though
smaller or larger packages may have a lower or higher current rating).
15
The 7805 series has several key advantages over many other voltage regulator circuits
which have resulted in its popularity:
7805 series ICs do not require any additional components to provide a constant,
regulated source of power, making them easy to use, as well as economical, and also
efficient uses of circuit board real estate. By contrast, most other voltage regulators
require several additional components to set the output voltage level, or to assist in the
regulation process. Some other designs (such as a switching power supply) can require
not only a large number of components but also substantial engineering expertise to
implement correctly as well.
7805 series ICs have built-in protection against a circuit drawing too much power.
They also have protection against overheating and short-circuits, making them quite
robust in most applications. In some cases, the current-limiting features of the 7805
devices can provide protection not only for the 7805 itself, but also for other parts of the
circuit it is used in, preventing other components from being damaged as well.
3.7 Preset
A preset is a three legged electronic component which can be made to offer varying
resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The
adjustment can be done by using a small screw driver or a similar tool. The resistance
does not vary linearly but rather varies in exponential or logarithmic manner. Such
variable resistors are commonly used for adjusting sensitivity along with a sensor.
16
external crystal/clock.
Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.
Two Capture, Compare, PWM modules.
Capture is 16-bit, max. resolution is 12.5 ns.
Compare is 16-bit, max. resolution is 200 ns.
PWM max. resolution is 10-bit.
8-bit, up to 8-channel Analog-to-Digital converter.
Synchronous Serial Port (SSP) with SPI(Master mode) and I2C(Slave).
Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI).
Parallel Slave Port (PSP), 8-bits wide with external RD, WR and CS controls
(40/44-pin only).
Brown-out detection circuitry for Brown-out Reset (BOR).
17
18
19
20
Fig. 3.11 -
PIC16F73
3.8.3 Special
function registers
3.8.3.1 STATUS
Register
The STATUS
arithmetic status
RESET status
can be the
instruction, as
If the STATUS
register is the
destination for
an instruction that
affects the Z, DC, or C bits, then the write to these three bits is disabled. These bits are set
or cleared according to the device logic. Furthermore, the TO and PD bits are not
22
writable, therefore, the result of an instruction with the STATUS register as destination
may be different than intended.
For example, CLRF STATUS will clear the upper three bits and set the Z bit. This leaves
the STATUS register as 000u u1uu (where u = unchanged). It is recommended, therefore,
that only BCF, BSF, SWAPF and MOVWF instructions are used to alter the STATUS
register, because these instructions do not affect the Z, C, or DC bits from the STATUS
register.
3.8.3.2 OPTION_REG Register
The OPTION_REG register is a readable and writable register, which contains
various control bits to configure the TMR0 prescaler/WDT postscaler (single assignable
register known also as the prescaler), the External INT Interrupt, TMR0 and the weak
pull-ups on PORTB.
3.8.3.3 INTCON Register
The INTCON register is a readable and writable register, which contains various
enable and flag bits for the TMR0 register overflow, RB Port change and External
RB0/INT pin interrupts.
3.8.3.4 PIE1 Register
The PIE1 register contains the individual enable bits for the peripheral interrupts.
24
The PIR1 register contains the individual flag bits for the peripheral interrupts. Interrupt
flag bits are set when an interrupt condition occurs, regardless of the state of its
corresponding enable bit
26
The program memory allows word reads. Program memory access allows for checksum
calculation and reading calibration tables. When interfacing to the program memory
block, the PMDATH:PMDATA registers form a two-byte word, which holds the 14-bit
data for reads. The PMADRH:PMADR registers form a two-byte word, which holds the
13-bit address of the FLASH location being accessed. These devices can have up to 8K
words of program FLASH, with an address range from 0h to 3FFFh. The unused upper
bits in both the PMDATH and PMADRH registers are not implemented and read as 0s.
3.8.4.1 PMADR
The address registers can address up to a maximum of 8K words of program
FLASH. When selecting a program address value, the MSByte of the address is written to
the PMADRH register and the LSByte is written to the PMADR register. The upper
MSbits of PMADRH must always be clear.
3.8.4.2 PMCON1 Register
PMCON1 is the control register for memory accesses. The control bit RD initiates
read operations. This bit cannot be cleared, only set, in software. It is cleared in hardware
at the completion of the read operation.
microcontroller can read and execute instructions out of the internal FLASH program
memory, regardless of the state of the code protect configuration bits.
29
A mismatch condition will continue to set flag bit RBIF. Reading PORTB will end
the mismatch condition and allow flag bit RBIF to be cleared. The interrupt-on-change
feature is recommended for wake-up on key depression operation and operations where
PORTB is only used for the interrupt-on-change feature. Polling of PORTB is not
recommended while using the interrupt-on-change feature.
This interrupt on mismatch feature, together with software configurable pull-ups
on these four pins, allow easy interface to a keypad and make it possible for wake-up on
key depression. RB0/INT is an external interrupt input pin and is configured using the
INTEDG bit (OPTION_REG<6>). Four of the PORTB pins (RB7:RB4) have an
interrupt- on-change feature. Only pins configured as inputs can cause this interrupt to
occur (i.e., any RB7:RB4 pin configured as an output is excluded from the interrupt- onchange comparison). The input pins (of RB7:RB4) are compared with the old value
latched on the last read of PORTB. The mismatch outputs of RB7:RB4 are ORed
together to generate the RB Port Change Interrupt with flag bit RBIF (INTCON<0>).
31
3.8.7 TIMERS
3.8.7.1 TIMER0 MODULE
The Timer0 module timer/counter has the following features:
8-bit timer/counter
Readable and writable
8-bit software programmable prescaler
Internal or external clock select
Interrupt on overflow from FFh to 00h
Edge select for external clock
33
34
The operating mode is determined by the clock select bit, TMR1CS (T1CON<1>). In
Timer mode, Timer1 increments every instruction cycle. In Counter mode, it increments
on every rising edge of the external clock input. Timer1 can be enabled/disabled by
setting/clearing control bit TMR1ON (T1CON<0>). Timer1 also has an internal RESET
input. This RESET can be generated by either of the two CCP modules as the special
event trigger When the Timer1 oscillator is enabled (T1OSCEN is set), the
RC1/T1OSI/CCP2 and RC0/T1OSO/T1CKI pins become inputs. That is, the
TRISC<1:0> value is ignored and these pins read as 0.
initialized to FFh upon RESET. The match output of TMR2 goes through a 4-bit
postscaler (which gives a 1:1 to 1:16 scaling inclusive) to generate a TMR2 interrupt
(latched in flag bit TMR2IF, (PIR1<1>)). Timer2 can be shut-off by clearing control bit
TMR2ON (T2CON<2>) to minimize power consumption.
These devices have a Watchdog Timer, which can be enabled or disabled, using a
configuration bit. It runs off its own RC oscillator for added reliability. There are two
timers that offer necessary delays on power-up. One is the Oscillator Start-up Timer
(OST), intended to keep the chip in RESET until the crystal oscillator is stable. The other
is the Power-up Timer (PWRT), which provides a fixed delay of 72 ms (nominal) on
36
power-up only. It is designed to keep the part in RESET while the power supply
stabilizes, and is enabled or disabled, using a configuration bit. With these two timers onchip, most applications need no external RESET circuitry. SLEEP mode is designed to
offer a very low current power-down mode. The user can wake-up from SLEEP through
external RESET, Watchdog Timer Wake-up, or through an interrupt. Several oscillator
options are also made available to allow the part to fit the application. The RC oscillator
option saves system cost while the LP crystal option saves power. Configuration bits are
used to select the desired oscillator mode.
3.8.8.2 RESET
The PIC16F7X differentiates between various kinds of
RESET:
Power-on Reset (POR)
MCLR Reset during normal operation
MCLR Reset during SLEEP
WDT Reset (during normal operation)
WDT Wake-up (during SLEEP)
37
38
o The Power Control/Status Register, PCON, has two bits to indicate the type of RESET
that last occurred. Bit0 is Brown-out Reset Status bit, BOR. Bit BOR is unknown on a
Power-on Reset. It must then be set by the user and checked on subsequent RESETS to
see if bit BOR cleared, indicating a Brown-out Reset occurred. When the Brown-out
Reset is disabled, the state of the BOR bit is unpredictable. Bit1 is POR (Power-on
Reset Status bit). It is cleared on a Power-on Reset and unaffected otherwise. The user
must set this bit following a Power-on Reset.
Interrupts
o The PIC16F7X family has up to 12 sources of interrupt. The interrupt control register
(INTCON) records individual interrupt requests in flag bits. It also has individual and
global interrupt enable bits. A global interrupt enable bit, GIE (INTCON<7>) enables
(if set) all unmasked interrupts, or disables (if cleared) all interrupts. When bit GIE is
enabled and an interrupts flag bit and mask bit are set, the interrupt will vector
immediately. Individual interrupts can be disabled through their corresponding enable
bits in various registers. Individual interrupt bits are set, regardless of the status of the
GIE bit. The GIE bit is cleared on RESET.
o The return from interrupt instruction, RETFIE, exits the interrupt routine, as well as
sets the GIE bit, which re-enables interrupts. The RB0/INT pin interrupt, the RB port
change interrupt and the TMR0 overflow interrupt flags are contained in the INTCON
register. The peripheral interrupt flags are contained in the Special Function Registers,
PIR1 and PIR2. The corresponding interrupt enable bits are contained in Special
o Function Registers, PIE1 and PIE2, and the peripheral interrupt enable bit is contained
in Special Function Register, INTCON. When an interrupt is responded to, the GIE bit
is cleared to disable any further interrupt, the return address is pushed onto the stack
and the PC is loaded with 0004h. Once in the Interrupt Service Routine, the source(s)
of the interrupt can be determined by polling the interrupt flag bits. The interrupt flag
bit(s) must be cleared in software before re-enabling interrupts to avoid recursive
interrupts.
o For external interrupt events, such as the INT pin or PORTB change interrupt, the
interrupt latency will be three or four instruction cycles. The exact latency depends
when the interrupt event occurs, relative to the current Q cycle. The latency is the same
39
for one or two-cycle instructions. Individual interrupt flag bits are set, regardless of the
status of their corresponding mask bit, PEIE bit, or the GIE bit.
The PIC16 instruction set is highly orthogonal and is comprised of three basic categories:
Byte-oriented operations
Bit-oriented operations
Literal and control operations
Each PIC16 instruction is a 14-bit word divided into an opcode, which specifies
the instruction type and one or more operands, which further specify the operation of the
instruction. For byte-oriented instructions, f represents a file register designator and d
represents a destination designator. The file register designator specifies which file
register is to be used by the instruction. The destination designator specifies where the
result of the operation is to be placed. If d is zero, the result is placed in the W register.
If d is one, the result is placed in the file register specified in the instruction.
For bit-oriented instructions, b represents a bit field designator, which selects
the bit affected by the operation, while f represents the address of the file in which the
bit is located.
For literal and control operations, k represents an eight- or eleven-bit constant
or literal value One instruction cycle consists of four oscillator periods; for an oscillator
frequency of 4 MHz, this gives a normal instruction execution time of 1 s. All
instructions are executed within a single instruction cycle, unless a conditional test is true,
or the program counter is changed as a result of an instruction. When this occurs, the
execution takes two instruction cycles, with the second cycle executed as a NOP.
MOVF Move f
Syntax: [ label ] MOVF f,d
Operands: 0 f 127 d [0,1]
Operation: (f) (destination)
Status Affected: Z
Description: The contents of register f are moved to a destination dependant upon
the status of d. If d = 0, destination is W register. If d = 1, the destination is file register f
itself. d = 1 is useful to test a file register, since status flag Z is affected.
41
NOP No Operation
Syntax: [ label ] NOP
Operands: None
Operation: No operation
Status Affected: None
Description: No operation.
42
43
MOVWF Move W to f
Syntax: [ label ] MOVWF f
Operands: 0 f 127
Operation: (W) (f)
Status Affected: None
Description: Move data from W register to register 'f'.
INCF Increment f
Syntax: [ label ] INCF f,d
Operands: 0 f 127 d [0,1]
Operation: (f) + 1 (destination)
Status Affected: Z
Description: The contents of register f are incremented. If d is 0, the result is
placed in the W register. If d is 1, the result is placed back in register f.
The PICmicro microcontrollers are supported with a full range of hardware and
software development tools:
Integrated Development Environment
- MPLAB IDE Software
Assemblers/Compilers/Linkers
- MPASMTM Assembler
- MPLAB C17 and MPLAB C18 C Compilers
- MPLINKTM Object Linker/
MPLIBTM Object Librarian
Simulators
- MPLAB SIM Software Simulator
Emulators
- MPLAB ICE 2000 In-Circuit Emulator
- ICEPIC In-Circuit Emulator
In-Circuit Debugger
- MPLAB ICD
Device Programmers
- PRO MATE II Universal Device Programmer
- PICSTART Plus Entry-Level Development Programmer
Low Cost Demonstration Boards
- PICDEMTM 1 Demonstration Board
- PICDEM 2 Demonstration Board
- PICDEM 3 Demonstration Board
- PICDEM 17 Demonstration Board
- KEELOQ Demonstration Board
RECTIFIER
A bridge rectifier can be made using four individual diodes, but it is also available
in special packages containing the four diodes required. It is called a full-wave rectifier
because it uses all the AC wave (both positive and negative sections). 1.4V is used up in
the bridge rectifier because each diode uses 0.7V when conducting and there are always
two diodes conducting, as shown in the diagram below.
Bridge rectifiers are rated by the maximum current they can pass and the
maximum reverse voltage they can withstand (this must be at least three times the supply
RMS voltage so the rectifier can withstand the peak voltages). Please see the Diodes
page for more details, including pictures of bridge rectifiers.
Alternate pairs of diodes conduct, changing over the connections so the alternating
directions of AC are converted to the one direction of DC.
47
FEATURES
Output Current up to 1A
Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
Thermal Overload Protection
Short Circuit Protection
Output Transistor Safe Operating Area Protection
49
Two audio channels include two microphones inputs and two speaker outputs.
This can be easily configured by AT command.
SIM300 provide RF antenna interface with two alternatives: antenna connector
and antenna pad. The antenna connector is MURATA MM9329-2700. And customers
antenna can be soldered to the antenna pad. The SIM300 is designed with power saving
technique, the current consumption to as low as 2.5mA in SLEEP mode.
The SIM300 is integrated with the TCP/IP protocolExtended TCP/IP AT
commands are developed for customers to use the TCP/IP protocol easily, which is very
useful for those data transfer applications.
3.10.3 Power supply
The power supply of SIM300 is from a single voltage source of VBAT=
3.4V...4.5V. In some case, the ripple in a transmit burst may cause voltage drops when
current consumption rises to typical peaks of 2A, So the power supply must be able to
provide sufficient current up to 2A.
For the VBAT input, a local bypass capacitor is recommended. A capacitor (about
100F, low ESR) is recommended. Multi-layer ceramic chip (MLCC) capacitors can
provide the best combination of low ESR and small size but may not be cost effective. A
lower cost choice may be a 100 F tantalum capacitor (low ESR) with a small (1 F to
10F) ceramic in parallel, which is illustrated as following figure. And the capacitors
should put as closer as possible to the SIM300 VBAT pins. The following figure is the
recommended circuit.
3.10.4 SIM card interface
SIM card application
You can use AT Command to get information in SIM card.The SIM interface supports the
functionality of the GSM Phase 1 specification and also supports the functionality of the
new GSM Phase 2+ specification for FAST 64 kbps SIM (intended for use with a SIM
application Tool-kit).
Both 1.8V and 3.0V SIM Cards are supported. The SIM interface is powered from an
internal regulator in the module having nominal voltage 2.8V. All pins reset as outputs
driving low. Logic levels are as described in table
50
AT+<x>=?
Read Command
AT+<x>?
Write Command
AT+<x>=<>
Execution Command
AT+<x>
AT<command name>=?
ATD=?
2) Read command - used to get mobile phone or MODEM settings for an operation.
SYNTAX:
AT<command name>?
For example:
AT+CBC?
3) Set commands - used to modify mobile phone or MODEM settings for an operation.
SYNTAX:
AT<command name>=value1, value2, , valueN Some
values in set commands can be optional.
For example:
AT+CSCA=+9876543210, 120
4) Execution commands - used to carry out an operation.
SYNTAX:
AT<command name>=parameter1, parameter2, ,
parameter The read commands are not available to get value of last parameter assigned
in execution commands because parameters of execution commands are not stored.
For example:
AT+CMSS=1,+ 9876543210, 120
Testing:
Command
Description
52
AT
Description
ATI
Identification
ATS
Select an S-register
ATZ
AT&F
AT&V
AT&W
AT&Y
AT+CLCK
AT+COLP
AT+GCAP
AT+GMI
AT+GMM
AT+GMR
AT+GSN
Description
AT+CSMS
AT+CPMS
AT+CMGF
Message format
53
AT+CSCA
AT+CSMP
AT+CSDH
AT+CSCB
AT+CSAS
Save settings
AT+CRES
Restore settings
AT+CNMI
AT+CMGL
List messages
AT+CMGR
Read message
AT+CMGS
Send message
AT+CMSS
AT+CMGW
AT+CMGD
Delete message
Chapter 4
PCB FABRICATION
54
There are a number of different processes, which are used to manufacture a PCB,
which is ready for component assembly, from a copper clad base material. These
processes are as follows
Preprocessing: - This consists of initial preparation of a copper clad laminate
ready for subsequent processing. Next is to drill tooling holes. Passing a board
through rollers performs cleaning operation.
Photolithography: - This process for PCBs involves the exposure of a photo resist
material to light through a mask. This is used for defining copper track and land
patterns.
Etching: - The etching process is performed by exposing the surface of the board
to an etchant solution which dissolves away the exposed copper areas .The
different solutions used are: FeCl, CuCl, etc.
Drilling: - Drilling is used to create the component lead holes and through holes in
a PCB .The drilling can be done before or after the track areas have been defined.
Solder Masking: - It is the process of applying organic coatings selectively to
those areas where no solder wettings is needed .The solder mask is applied by
screen-printing.
Metal Plating: - The plating is done to ensure protection of the copper tracks and
establish connection between different layers of multiplayer boards. PCBs are
stacked before being taken for final assembly of components .The PCB should
retain its solder ability.
Bare-Board Testing: - Each board needs to ensure that the required connections
exist, that there are no short circuits and holes are properly placed .The testing
usually consists of visual inspection and continuity testing
1) Single sided PCB: - In this, copper tracks are on one side of the board, and are the
simplest form of PCB. These are simplest to manufacture thus have low
production cost.
2) Double sided PCB:- In this, copper tracks are provided on both sides of the
substrate. To achieve the connections between the boards, hole plating is done,
which increase the manufacturing complexity.
3) Multilayered PCB: - In this, two or more pieces of dielectric substrate material
with circuitry formed upon them are stacked up and bonded together. Electrically
connections are established from one side to the other and to the layer circuitry
by drilled holes, which are subsequently plated through copper.
4) Flexible PCB: - Flexible circuit is basically a highly flexible variant of the
conventional rigid printed circuit board theme.
Chapter 5
CIRCUIT DESCRIPTION
5.1 Block Diagram
5.2 Basic Principle:When somebody enters into the room then the counter is incremented by one. The
total number of persons inside the room is displayed on LCD .The microcontroller does
the above job, it receives the signals from the sensors, and these signals operated under
the control of software which is stored in ROM.
Microcontroller PIC16F73 continuously monitors the sensor, when any object or
person passes through the sensor then the light rays falling on the sensor are obstructed,
this obstruction is sensed by the Microcontroller. When sensor is obstructed, then the
Microcontroller will increment the counter by 1 in the display.
57
58
5.3 Sensors :-
The block shows the sensor arrangement at the entrance cum exit passage. Here a
pair of IR transmitter-receiver is used as sensor. Photo transistors are used as IR receiver,
since it has sensitivity to receive IR rays.
5.3.1 IR Transmitter (IR LED) :-
59
60
5.3.2 Phototransistor:There is a wide selection of photosensitive devices that are available to the
electronic designer. Whilst photo-diodes fulfil many requirements, phototransistors or
photo transistors are also available, and are more suitable in some applications. Providing
high levels of gain and standard devices are low cost, these phototransistors can be used
in many applications.
The idea of the photo transistor has been known for many years. William
Shockley first proposed the idea in 1951, not long after the ordinary transistor had been
discovered. It was then only two years before the photo transistor was demonstrated.
Since then phototransistors have been used in a variety of applications, and their
development has continued ever since.
Phototransistor structure
Although ordinary transistors exhibit the photosensitive effects if they are exposed
to light, the structure of the phototransistor is specifically optimised for photo
applications. The photo transistor has much larger base and collector areas than would be
used for a normal transistor. These devices were generally made using diffusion or ion
implantation.
Homojunction planar phototransistor structure
Early photo transistors used germanium or silicon throughout the device giving a homojunction structure. The more modern phototransistors use type III-V materials such as
gallium arsenide and the like. Heterostructures that use different materials either side of
the p-n junction are also popular because they provide high conversion efficiency. These
are generally fabricated using epitaxial growth of materials that have matching lattice
structures. These photo transistors generally use a mesa structure. Sometimes a Schottky
(metal semiconductor) junction can be used for the collector within a phototransistor,
although this practice is less common these days because other structures offer better
levels of performance.
Phototransistor operation
Photo transistors are operated in their active regime, although the base connection
is left open circuit or disconnected because it is not required. The base of the photo
transistor would only be used to bias the transistor so that additional collector current was
flowing and this would mask any current flowing as a result of the photo-action. For
operation the bias conditions are quite simple. The collector of an n-p-n transistor is made
positive with respect to the emitter or negative for a p-n-p transistor.
61
The light enters the base region of the phototransistor where it causes hole
electron pairs to be generated. This mainly occurs in the reverse biased base-collector
junction. The hole-electron pairs move under the influence of the electric field and
provide the base current, causing electrons to be injected into the emitter.
Phototransistor symbol
62
Fig5.8:- Phototransistor
Chapter 6
By using this circuit and proper power supply we can implement various
applications Such as fans, tube lights, etc.
Chapter 7
CONCLUSION
Bi-Directional visitor counter is a very useful device where in a building or in a
room, seminar room persons counting are needed.
So that by using this project we can reduce the human effort in counting the
number of persons entering and number of persons staying in an enclosed area. The cost
of implementing is reasonable and all the components required are readily available in the
market and the circuit is easy to build.
Human may commit errors in counting the number of persons. But by using this
circuit these errors can be rectified. The power consumption of this circuit is also very
less.
64
APPENDIX-A
Usart_Write('G');
Usart_Write('S');
Usart_Write('=');
Usart_Write('"');
Usart_Write('9');
Usart_Write('8');
Usart_Write('8');
Usart_Write('7');
Usart_Write('1');
Usart_Write('0');
Usart_Write('3');
Usart_Write('0');
Usart_Write('7');
Usart_Write('3');
Usart_Write('"');
Usart_Write(34);
Usart_Write(0x0D);
Usart_Write(0);
Delay_ms(1000);
Usart_Write('N');
Usart_Write('o');
Usart_Write('.');
Usart_Write(' ');
Usart_Write('o');
Usart_Write('f');
Usart_Write(' ');
Usart_Write('P');
Usart_Write('e');
Usart_Write('r');
Usart_Write('s');
Usart_Write('o');
Usart_Write('n');
Usart_Write('s');
Usart_Write(' ');
66
Usart_Write('E');
Usart_Write('n');
Usart_Write('t');
Usart_Write('e');
Usart_Write('r');
Usart_Write('e');
Usart_Write('d');
Usart_Write(' ');
Usart_Write('=');
Usart_Write(' ');
Usart_Write(y);
Usart_Write(x);
Usart_Write(0x1A);
Usart_Write(0);
delay_ms(1000);
}
void CLOSE()
{
PORTC.F3= 1;
PORTC.F4= 0;
Delay_ms(1000);
PORTC.F3= 0;
}
void OPEN()
{
PORTC.F3= 0;
PORTC.F4= 1;
Delay_ms(1000);
PORTC.F4= 0;
}
void main()
67
{
int a,b,c;
Lcd_Init(&PORTB);
// Initialize LCD
Lcd_Cmd(Lcd_CLEAR);
Lcd_Cmd(Lcd_CURSOR_OFF);
Usart_Init(9600);
delay_ms(500);
Lcd_Out(1, 1, " Bidirectional ");
Lcd_Out(2, 1, "Visitor Counter ");
delay_ms(30000);
Lcd_Cmd(Lcd_CLEAR);
// PORTA = 0x00;
i=0;
Lcd_Out(1, 1, "No. of. Persons ");
Lcd_Out(2, 1, "Entered
");
b=0;
c=0;
while(1)
{
a=i;
b=a/5;
if (a%5==0 && b!=c)
{
c=b;
gsm_sms(i) ;
}
if (PORTA.F0)
{
Lcd_Out(2, 9,"<<");
OPEN();
68
while(PORTA.F1==0)
{
}
CLOSE();
i++;
Delay_ms(700);
}
if (PORTA.F1)
{
Lcd_Out(2, 9, ">>");
OPEN();
while(PORTA.F0==0)
{
}
CLOSE();
if(i>0)
{
i--;
}
Delay_ms(700);
}
Display(i);
}
}
69
REFERENCES
www.betaengineers.net
www.kitsnspares.com
www.scribd.com/doc/47054137/Some-Innovative-Ideas
www.datasheets4u.com
www.electronics-tutorials.ws/io/io_7.html
www.engineersgarage.com
http://datasheetreference.com
70