Some Importantant links below with reports.just view the lik below.just search any project on our search box
Arduino interesting projects:
Arduino 30 simple and good projects
Atmega projects lists
Android Electronics projects lists
Rf based Projects with report
engineering study notes
GSM GPS based projects with report
Bluetooth based projects with reports
1. INTRODUCTION
PLEASE use image yourself or down load the full report...searchin in the searech box
1.1 DEFINITION
The term “virtual” has been defined in philosophy as "that which is not real" but may display the salient qualities of the real. In general, fencing refers to a boundary; both the words put together it virtual fencing refers to a boundary, which doesn’t exist physically.
1.2 VIRTUAL FENCING
The purpose the project “GPS based virtual fencing” is to construct a virtual fencing that functions similar to physical fencing. A virtual fence is a barrier that uses electric shock to deter animals or people from crossing a boundary. The voltage of the shock may have effects ranging from uncomfortable, to painful or even lethal (capable of causing death). Mostly used today for agricultural fencing and other forms of animal control purposes, though it is frequently used to enhance security of sensitive areas, and there exist places where lethal voltages are used. Virtual fencing for the wild animals is meant to restrict animals to move in only few areas.
For example in recent days we can find the elephants coming in to the villages and damaging their lands, houses, and even their lives in this case we can restrict the elephants to the forest itself, not only elephants it may be any other wild animals we can stop them from coming out of the forest. In the other case we generally find our pet animals missing from home, even in this case we can stop our pet animal from going outside the home. In both the above cases we can make use of the virtual fencing project to restrict the movement of the animals beyond particular location.
For this purpose we make use of the current location of the animal which can be known with the help of the GPS and whenever it was about to cross its area it will have a shock which forces it to stay in the location to which it was restricted. The device consists of a micro controller which receives the information from the GPS and monitors the shock providing circuit.
2. OBJECTIVE OF THE PROJECT
Construction of virtual fencing.
Restricting animals/people to a particular area.
GPS interfacing with microcontroller.
Creating the fencing dynamically at any location on the earth irrespective of hill, slope, steep areas etc.,
Ability to increase the boundary distance dynamically if needed.
2.1 BLOCK DIAGRAM
Fig 2.1.1: Block Diagram of the project
2.2 BLOCK DIAGRAM DESCRIPTION
In this project we are making use of a GPS receiver to find the location of the animal/person to which we are creating the fence. The receiver gives the exact location where on the earth that particular animal is present in terms of latitudes and longitudes. We make use of the PIC 16F876A Microcontroller which has got 22 pins. This is used to control the operation of the fencing according to the GPS input and the predefined fence input. The LCD is used for display purpose which gives the details like latitudes, longitudes, distance, and radius etc., Several LEDs are used to indicate the status of the components and main power supply.
Once the operation of the circuit starts and when the location of animal/person is beyond the predefined fence value then the circuit generates shock using the muscle stimulator circuit. Also gives sound through a buzzer. The power supply is used to give power to all the above components of the circuit. As the main purpose of this project is in remote places and is not constant in location we opt for DC power supply rather than AC supply.
3. POWER SUPPLY
Power supply is the major concern for every electronic device. Since the controller and other devices used are low power devices there is a need to step down the voltage and as well as rectify the output to convert the output to a constant dc.
3.1 BLOCK DIAGRAM
Fig 3.1.1: Block Diagram of Regulated Power Supply
3.2 COMPONENTS OF POWER SUPPLY
Transformer
Transformer is a device used to increment or decrement the input voltage given as per the requirement. The transformers are classified into two types depending upon there functionality
Step up transformer
Step down transformer
Here we use a step down transformer for stepping down the house hold ac power supply i.e. the 230-240v power supply to 5V. We use a 5-0-5 v center tapped step down transformer.
Rectifier
The output of the transformer is an ac and should be rectified to a constant dc for this it is necessary to feed the output of the transformer to a rectifier.
The rectifier is employed to convert the alternating ac to a constant dc. There are many rectifiers available in the market some of them are
Half wave rectifier
Full wave rectifier
Bridge rectifier
The rectification is done by using one or more diodes connected in series or parallel. If only one diode is used then only first half cycle is rectified and it is termed as half wave rectification and the rectifier used is termed as half wave rectifier.
If two diodes are employed in parallel then both positive and negative half cycles are rectified and this is full wave rectification and the rectifier is termed as full wave rectifier.
If the diodes are arranged in the form of bridge then it is termed as Bridge rectifier, it acts as a full wave rectifier. In our project we make use of the rectifiers which are readily available in the market in the form of integrated chips (I.Cs).
Voltage Regulator
The voltage regulator is used for the voltage regulation purpose. We use IC 7805 voltage regulator.
The IC number has a specific significance. The number 78 represents the series while 05 represent the output voltage generated by the IC.
Light Emitting Diode
We employ a light emitting diode for testing the functionality of the power supply circuit. Here we use a 5 volts LED which is connected in series with the power supply circuit it verifies the functioning of the power supply.
LED’s are also employed in other areas for many purposes. The fallowing are the advantages of using LED’s.
It helps us while troubleshooting the device i.e. when the device is malfunctioning it would be easy to detect where the actual problem a raised.
LED employed with microcontroller verifies whether data is being transmitted.
It verifies the functionality of the power supply.
4. MICROCONTROLLER
4.1 INTRODUCTION
The PIC16F876A CMOS FLASH-based 8-bit microcontroller is upward compatible with pin PIC16CXXX and PIC16FXXX devices. It features 200 ns instruction execution, 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital(A/D) converter, 2 capture/compare/ PWM functions, a synchronous serial port that can be configured as either 3-wire SPI or 2-wire I2C bus, a USART, and a Parallel Slave Port.
High-Performance RISC CPU
Only 35 single-word instructions to learn.
All single-cycle instructions except for program branches, which are two-cycle.
Operating speed: DC – 20 MHz clock input.
DC – 200 ns instruction cycle.
Up to 8K x 14 words of Flash Program Memory.
Up to 368 x 8 bytes of Data Memory (RAM).
Up to 256 x 8 bytes of EEPROM Data Memory.
Pin out compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX.
Peripheral Features
Timer0: 8-bit timer/counter with 8-bit prescaler.
Timer1: 16-bit timer/counter with prescaler, can be incremented during Sleep via external crystal/clock.
Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.
Two Capture, Compare, PWM modules.
o Capture is 16-bit, maximum resolution is 12.5 ns.
o Compare is 16-bit, maximum resolution is 200 ns.
o PWM maximum resolution is 10-bit.
Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™ (Master/Slave).
Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address detection.
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).
Analog Features
10-bit, up to 8-channel Analog-to-Digital Converter (A/D).
Brown-out Reset (BOR).
Analog Comparator module with:
o Two analog comparators.
o Programmable on-chip voltage reference (VREF) module.
o Programmable input multiplexing from device inputs and internal voltage reference.
o Comparator outputs are externally accessible.
Special Microcontroller Features
100,000 erase/write cycle Enhanced Flash program memory typical.
1,000,000 erase/write cycle Data EEPROM memory typical.
Data EEPROM Retention > 40 years.
Self-reprogrammable under software control.
In-Circuit Serial Programming™ (ICSP™) via two pins.
Single-supply 5V In-Circuit Serial Programming.
Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation.
Programmable code protection.
Power saving Sleep mode.
Selectable oscillator options.
In-Circuit Debug (ICD) via two pins.
CMOS Technology
Low-power, high-speed Flash/EEPROM technology.
Fully static design.
Wide operating voltage range (2.0V to 5.5V).
Commercial and Industrial temperature ranges.
Low-power consumption.
Program memory (FLASH)
It is used for storing a written program. Since memory made in FLASH technology can be programmed and cleared more than once, it makes this microcontroller suitable for device development.
EEPROM
Data memory that needs to be saved when there is no supply. It is usually used for storing important data that must not be lost if power supply suddenly stops.
For instance, one such data is an assigned temperature in temperature regulators. If during a loss of power supply this data was lost, we would have to make the adjustment once again upon return of supply. Thus our device looses on self-reliance.
RAM
Data memory used by a program during its execution. In RAM are stored all inter-results or temporary data during run-time.
Ports
Ports are physical connections between the microcontroller and the outside world. PIC16F876A has 22 Input/output pins.
Free-Run Timer
This is an 8-bit register inside a microcontroller that works independently of the program. On every fourth clock of the oscillator it increments its value until it reaches the maximum (255), and then it starts counting over again from zero. As we know the exact timing between each two increments of the timer contents, timer can be used for measuring time which is very useful with some devices.
Central Processing Unit
CPU has a role of connective element between other blocks in the microcontroller. It coordinates the work of other blocks and executes the user program. It is the brain of a microcontroller. This part is responsible for finding and fetching the right instruction which needs to be executed, for decoding that instruction, and finally for its execution. Central processing unit connects all parts of the microcontroller into one whole. Surely, its most important function is to decode program instructions.
When programmer writes a program, instructions have a clear form like MOVLW 0x20. However, in order for a microcontroller to understand that, this 'letter' form of an instruction must be translated into a series of zeros and ones which is called an 'opcode'.
This transition from a letter to binary form is done by translators such as assembler translator (also known as an assembler). Instruction thus fetched from program memory must be decoded by a central processing unit. We can then select from the table of all the instructions a set of actions which execute a assigned task defined by instruction. As instructions may within themselves contain assignments which require different transfers of data from one memory into another, from memory onto ports, or some other calculations, CPU must be connected with all parts of the microcontroller. This is made possible through a data bus and an address bus.
Arithmetic logic unit is responsible for performing operations of adding, subtracting, moving (left or right within a register) and logic operations. Moving data inside a register is also known as 'shifting'. PIC16F876A contains an 8-bit arithmetic logic unit and 8-bit work registers.
Fig 4.1.1: Harvard vs. Von-Neuman Block Architectures
In instructions with two operands, ordinarily one operand is in work register (W register), and the other is one of the registers or a constant. By operand we mean the contents on which some operation is being done, and a register is any one of the GPR or SFR registers. GPR is an abbreviation for 'General Purposes Registers', and SFR for 'Special Function Registers'. In instructions with one operand, an operand is either W register or one of the registers.
As an addition in doing operations in arithmetic and logic, ALU controls status bits (bits found in STATUS register). Execution of some instructions affects status bits, which depends on the result itself.
Depending on which instruction is being executed, ALU can affect values of Carry (C), Digit Carry (DC), and Zero (Z) bits in STATUS register.
CISC, RISC
It has already been said that PIC16F876A has RISC architecture. This term is often found in computer literature, and it needs to be explained here in more detail. Harvard architecture is a newer concept than von-Neumann. It rose out of the need to speed up the work of a microcontroller. In Harvard architecture, data bus and address bus are separate. Thus a greater flow of data is possible through the central processing unit, and of course, a greater speed of work. Separating a program from data memory makes it further possible for instructions not to have to be 8-bit words. PIC16F876A uses 14 bits for instructions which allows for all instructions to be one word instructions. It is also typical for Harvard architecture to have fewer instructions than von-Neumann's, and to have instructions usually executed in one cycle.
Microcontrollers with Harvard architecture are also called "RISC microcontrollers". RISC stands for Reduced Instruction Set Computer. Microcontrollers with von-Neumann's architecture are called 'CISC microcontrollers'. The title CISC stands for Complex Instruction Set Computer.
Since PIC16F876A is a RISC microcontroller, that means that it has a reduced set of instructions, more precisely 35 instructions. (Ex. Intel's and Motorola's microcontrollers have over hundred instructions) All of these instructions are executed in one cycle except for jump and branch instructions. According to what its maker says, PIC16F876A usually reaches results of 2:1 in code compression and 4:1 in speed in relation to other 8-bit microcontrollers in its class.
4.2 PIN DIAGRAM
Pipelining
Instruction cycle consists of cycles Q1, Q2, Q3 and Q4. Cycles of calling and executing instructions are connected in such a way that in order to make a call, one instruction cycle is needed, and one more is needed for decoding and execution. However, due to pipelining, each instruction is effectively executed in one cycle. If instruction causes a change on program counter, and PC doesn't point to the following but to some other address (which can be the case with jumps or with calling subprograms), two cycles are needed for executing an instruction. This is so because instruction must be processed again, but this time from the right address. Cycle of calling begins with Q1 clock, by writing into instruction register (IR). Decoding and executing begins with Q2, Q3 and Q4 clocks.
Fig 4.2.3: Instruction Pipeline Flow
Clock generator – Oscillator
Oscillator circuit is used for providing a microcontroller with a clock. Clock is needed so that microcontroller could execute a program or program instructions.
Reset
Reset is used for putting the microcontroller into a 'known' condition. That practically means that microcontroller can behave rather inaccurately under certain undesirable conditions. In order to continue its proper functioning it has to be reset, meaning all registers would be placed in a starting position. Reset is not only used when microcontroller doesn't behave the way we want it to, but can also be used when trying out a device as an interrupt in program execution, or to get a microcontroller ready when loading a program.
In order to prevent from bringing a logical zero to MCLR pin accidentally (line above it means that reset is activated by a logical zero), MCLR has to be connected via resistor to the positive supply pole. Resistor should be between 5 and 10K. This kind of resistor, whose function is to keep a certain line on a logical one as a preventive, is called a pull up.
Microcontroller PIC16f876a knows several sources of resets
a) Reset during power on, POR (Power-On Reset)
b) Reset during regular work by bringing logical zero to MCLR microcontroller's pin.
c) Reset during SLEEP regime
d) Reset at watchdog timer (WDT) overflow
e) Reset during at WDT overflow during SLEEP work regime.
The most important reset sources are a) and b). The first one occurs each time a power supply is brought to the microcontroller and serves to bring all registers to a starting position initial state. The second one is a product of purposeful bringing in of a logical zero to MCLR pin during normal operation of the microcontroller. This second one is often used in program development.
During a reset, RAM memory locations are not being reset. They are unknown during a power up and are not changed at any reset. Unlike these, SFR registers are reset to a starting position initial state. One of the most important effects of a reset is setting a program counter (PC) to zero (0000h) , which enables the program to start executing from the first written instruction. Reset at supply voltage drop below the permissible (Brown-out Reset).
Impulse for resetting during voltage voltage-up is generated by microcontroller itself when it detects an increase in supply Vdd (in a range from 1.2V to 1.8V). That impulse lasts 72ms which is enough time for an oscillator to get stabilized. These 72ms are provided by an internal PWRT timer which has its own RC oscillator. Microcontroller is in a reset mode as long as PWRT is active. However, as device is working, problem arises when supply doesn't drop to zero but falls below the limit that guarantees microcontroller's proper functioning. This is a likely case in practice, especially in industrial environment where disturbances and instability of supply are an everyday occurrence. To solve this problem we need to make sure that microcontroller is in a reset state each time supply falls below the approved limit.
4.3 MEMORY ORGANIZATION
PIC16F876A has two separate memory blocks, one for data and the other for program. EEPROM memory with GPR and SFR registers in RAM memory make up the data block, while FLASH memory makes up the program block.
Program memory
Program memory has been carried out in FLASH technology which makes it possible to program a microcontroller many times before it's installed into a device, and even after its installment if eventual changes in program or process parameters should occur. The size of program memory is 1024 locations with 14 bits width where locations zero and four are reserved for reset and interrupt vector.
Data memory
Data memory consists of EEPROM and RAM memories. EEPROM memory consists of 256 eight bit locations whose contents are not lost during loosing of power supply. EEPROM is not directly addressable, but is accessed indirectly through EEADR and EEDATA registers. As EEPROM memory usually serves for storing important parameters (for example, of a given temperature in temperature regulators) , there is a strict procedure for writing in EEPROM which must be followed in order to avoid accidental writing. RAM memory for data occupies space on a memory map from location 0x0C to 0x4F which comes to 68 locations. Locations of RAM memory are also called GPR registers which is an abbreviation for General Purpose Registers. GPR registers can be accessed regardless of which bank is selected at the moment.
Program Counter
Program counter (PC) is a 13-bit register that contains the address of the instruction being executed. It is physically carried out as a combination of a 5-bit register PCLATH for the five higher bits of the address, and the 8-bit register PCL for the lower 8 bits of the address.
By its incrementing or change (i.e. in case of jumps) microcontroller executes program instructions step-by-step.
Stack
PIC16f876a has a 13-bit stack with 8 levels, or in other words, a group of 8 memory locations, 13 bits wide, with special purpose. Its basic role is to keep the value of program counter after a jump from the main program to an address of a subprogram. In order for a program to know how to go back to the point where it started from, it has to return the value of a program counter from a stack. When moving from a program to a subprogram, program counter is being pushed onto a stack (example of this is CALL instruction). When executing instructions such as RETURN, RETLW or RETFIE which were executed at the end of a subprogram, program counter was taken from a stack so that program could continue where was stopped before it was interrupted. These operations of placing on and taking off from a program counter stack are called PUSH and POP, and are named according to similar instructions on some bigger microcontrollers.
In System Programming
In order to program a program memory, microcontroller must be set to special working mode by bringing up MCLR pin to 13.5V, and supply voltage Vdd has to be stabilized between 4.5V to 5.5V. Program memory can be programmed serially using two 'data/clock' pins which must previously be separated from device lines, so that errors wouldn't come up during programming.
6. MUSCLE STIMULATOR
7. LIQUID CRYSTAL DISPLAY (LCD)
CLICK HERE FOR LCD
7.2 BASIC 16x 2 CHARACTERS LCD – BLACK ON GREEN 5V
This is a basic 16 character by 2-line display. Black text on Green background. Utilizes the extremely common HD44780 parallel interface chipset. Interface code is freely available. We will need ~11 general I/O pins to interface to this LCD screen.
Fig 7.2.1: A 16/2 character LCD display
The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 characters, whereas LCDs supporting more than 80 characters make use of 2 HD44780 controllers.
Fig 7.2.2: 2 Pin Description of LCD
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are extra in both for back-light LED connections). Pin description is shown in the table below.
Fig 7.2.3: Character LCD type HD44780 Pin diagram
Pin description of character LCD:
Pin No. Name Description
Pin no. 1 VSS Power supply (GND)
Pin no. 2 VCC Power supply (+5V)
Pin no. 3 VEE Contrast adjust
Pin no. 4 RS 0 = Instruction input
1 = Data input
Pin no. 5 R/W 0 = Write to LCD module
1 = Read from LCD module
Pin no. 6 EN Enable signal
Pin no. 7 D0 Data bus line 0 (LSB)
Pin no. 8 D1 Data bus line 1
Pin no. 9 D2 Data bus line 2
Pin no. 10 D3 Data bus line 3
Pin no. 11 D4 Data bus line 4
Pin no. 12 D5 Data bus line 5
Pin no. 13 D6 Data bus line 6
Pin no. 14 D7 Data bus line 7 (MSB)
Table 7.2.1: Character LCD pins with 1 Controller
Pin No. Name Description
Pin no. 1 D7 Data bus line 7 (MSB)
Pin no. 2 D6 Data bus line 6
Pin no. 3 D5 Data bus line 5
Pin no. 4 D4 Data bus line 4
Pin no. 5 D3 Data bus line 3
Pin no. 6 D2 Data bus line 2
Pin no. 7 D1 Data bus line 1
Pin no. 8 D0 Data bus line 0 (LSB)
Pin no. 9 EN1 Enable signal for row 0 and 1 (1stcontroller)
Pin no. 10 R/W 0 = Write to LCD module
1 = Read from LCD module
Pin no. 11 RS 0 = Instruction input
1 = Data input
Pin no. 12 VEE Contrast adjust
Pin no. 13 VSS Power supply (GND)
Pin no. 14 VCC Power supply (+5V)
Pin no. 15 EN2 Enable signal for row 2 and 3 (2ndcontroller)
Pin no. 16 NC Not Connected
Table 7.2.2: Character LCD pins with 2 Controller
7.3 LCD BACKGROUND
Frequently, an 8051 program must interact with the outside world using input and output devices that communicate directly with a human being. One of the most common devices attached to an 8051 is an LCD display. Some of the most common LCDs connected to the 8051 are 16x2 and 20x2 displays. This means 16 characters per line by 2 lines and 20 characters per line by 2 lines, respectively.
Interfacing Example - 16 Characters x 2 Lines LCD
This is the first interfacing example for the Parallel Port. We will start with something simple. This example doesn't use the Bi-directional feature found on newer ports, thus it should work with most, if no all Parallel Ports. It however doesn't show the use of the Status Port as an input. A 16 Character x 2 Line LCD Modules to the Parallel Port. These LCD Modules are very common these days, and are quite simple to work with, as all the logic required running them is on board.
Schematic
Fig 7.3.1: Schematic Diagram of 2 line 16 character LCD display
Circuit Description
Above is the quite simple schematic. The LCD panel's Enable and Register Select is connected to the Control Port. The Control Port is an open collector / open drain output. While most Parallel Ports have internal pull-up resistors, there is a few which don't. Therefore by incorporating the two 10K external pull up resistors, the circuit is more portable for a wider range of computers, some of which may have no internal pull up resistors. We make no effort to place the Data bus into reverse direction. Therefore we hard wire the R/W line of the LCD panel, into write mode.
This will cause no bus conflicts on the data lines. As a result we cannot read back the LCD's internal Busy Flag which tells us if the LCD has accepted and finished processing the last instruction. This problem is overcome by inserting known delays into our program.
The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. As with all the examples, I've left the power supply out.
We can use a bench power supply set to 5v or use an onboard +5 regulator. Remember a few de-coupling capacitors, especially if we have trouble with the circuit working properly.
16 x 2 Alphanumeric LCD Module Features
Intelligent, with built-in Hitachi HD44780 compatible LCD controller and RAM providing simple interfacing 61 x 15.8 mm viewing area.
5 x 7 dot matrix format for 2.96 x 5.56 mm characters, plus cursor line.
Can display 224 different symbols.
Low power consumption (1 mA typical).
Powerful command set and user-produced characters.
TTL and CMOS compatible.
Connector for standard 0.1-pitch pin headers.
16 x 2 Alphanumeric LCD Module Specifications
Pin Symbol Level Function
1 VSS - Power, GND
2 VDD - Power, 5V
3 Vo - Power, for LCD Drive
4 RS H/L Register Select Signal
H: Data Input
L: Instruction Input
5 R/W H/L H: Data Read (LCD->MPU)
L: Data Write (MPU->LCD)
6 E H,H->L Enable
7-14 DB0-DB7 H/L Data Bus; Software selectable 4- or 8-bit mode
15 NC - Not connected
16 NC - Not connected
Table 7.3.1: A 16 x 2 Alphanumeric LCD Module Specifications
7.4 ADVANTAGES AND APPLICATIONS OF LCDs
Advantages
Download high quality fonts of any size, style or language easily and quickly.
Create graphics using primitives such as bitmaps, pixels, lines, rectangles and bar graphs.
Backlight & Contrast is adjustable in most models.
4 different brightness settings.
General Purpose Output (20mA drive).
Line wrap and Auto screen scroll.
Bar Graphs and Large Digits.
Speed settings.
Applications
Medical equipment
Electronic test equipment
Industrial machinery Interface
Serial terminal
Advertising system
EPOS
Restaurant ordering systems
Gaming box
Security systems
R&D Test units
Climatizing units
PLC Interface
Simulators
Environmental monitoring
Lab development, student projects
8. RS - 232
RS - 232 is a asynchronous serial communication protocol widely used in computers and digital systems. It is called asynchronous because there is no separate synchronizing clock signal as there are in other serial protocols like SPI and I2C. The protocol is such that it automatically synchronizes itself. We can use RS - 232 to easily create a data link between our MCU based projects and standard PC. Excellent example is a commercial Serial PC mouse (not popular these days, I had got one with my old PC which I bought in year 2000 in those days these were famous). You can make a data loggers that reads analog value(such as temperatures or light using proper sensors) using the ADC and send them to PC where a special program written by you shows the data using nice graphs and charts etc.. Actually your imagination is the limit!
8.1 BASICS OF SERIAL COMMUNICATION
In serial communication the whole data unit, say a byte is transmitted one bit at a time. While in parallel transmission the whole data unit, say a byte (8bits) are transmitted at once. Obviously serial transmission requires a single wire while parallel transfer requires as many wires as there are in our data unit. So parallel transfer is used to transfer data within short range (e.g. inside the computer between graphic card and CPU) while serial transfer is preferable in long range.
As in serial transmission only one wire is used for data transfer. Its logic level changes according to bit being transmitted (0 or 1). But a serial communication needs some way of synchronization. If you don't understand what I mean by "synchronization" then don't worry just read on it will become clear.
Parts in RS - 232
In RS - 232 there are two data lines RX and TX. TX is the wire in which data is sent out to other device. RX is the line in which other device put the data it need to sent to the device.
Fig 8.1.1: RS - 232 transmission.
The arrows indicates the direction of data transfer. In addition to RX/TX lines there is a third line i.e. Ground (GND) or Common.
One more thing about RS - 232. We know that a HIGH =+5v and LOW=0v in TTL / MCU circuits but in RS - 232 a HIGH=-12V and LOW=+12V. This is bit weird but it increases the range and reliability of data transfer. Now you must be wondering how to interface this to MCUs who understand only 0 and 5v? But you will be very happy to know that there is a very popular IC which can do this for you! It is MAX232 from Maxim Semiconductors. I will show you how to make a level converter using MAX232 in next tutorial.
As there is no "clock" line so for synchronization accurate timing is required so transmissions are carried out with certain standard speeds. The speeds are measured in bits per second. Number of bits transmitted is also known as baud rate. Some standard baud rates are
1200
2400
4800
9600
19200
38400
57600
115200 ... etc
For our example for discussion of protocol we chose the speed as 9600bps(bits per second). As we are sending 9600 bits per second one bits takes 1/9600 seconds or 0.000104 sec or 104 uS (microsecond= 10^-6 sec).
To transmit a single byte we need to extra bits they are START BIT and STOP BIT(more about them latter). Thus to send a byte a total of ten bits are required so we are sending 960 bytes per second.
Note: The number of stop bits can be one or two (for simplicity we will be using single stop bit). There is one more bit the parity bit but again for simplicity we would not be using it)
8.2 RS - 232 DATA TRANSFER
The data transfer is done in following ways
Transmission
1. When there is no transmission the TX line sits HIGH (-12V See above para) (STOP CONDITION)
2. When the device needs to send data it pulls the TX line low for 104uS (This is the start bit which is always 0)
3. then it send each bits with duration = 104uS
4. Finally it sets TX lines to HIGH for at least 104uS (This is stop bits and is always 1). I said "at least" because after you send the stop bit you can either start new transmission by sending a start bit or you let the TX line remain HIGH till next transmission begin in this case the last bit is more than 104uS.
Fig 8.2.1: Data Transmission on RS - 232 line
Reception
1. The receiving device is waiting for the start bit i.e. the RX line to go LOW.
2. When it gets start bit it waits for half bit time i.e. 104/2 = 51uS now it is in middle of start bit it reads it again to make sure it is a valid start bit not a spike.
3. Then it waits for 104uS and now it is in middle of first bit it now reads the value of RX line.
4. In same way it reads all 8 bits.
5. Now the receiver has the data.
Fig 8.2.2: How the Receiver receives the data on RS - 232 RX l
9. SOFTWARE DESCRIPTION AND CODING
9.1 CCS COMPILIER
The compiler used in this project is Microchip PIC Micro C Compiler. CCS provides a complete, integrated tool suite for developing and debugging embedded applications running on Microchip PIC® MCUs. The heart of this development tool suite is the CCS intelligent code optimizing C compiler, which frees developers to concentrate on design functionality instead of having to become an MCU architecture expert.
Maximize code reuse by easily porting from one MCU to another.
Minimize lines of new code with CCS provided peripheral drivers, built-in functions and standard C operators.
Built in libraries are specific to PIC® MCU registers, allowing access to hardware features directly from C.
Problems facing Embedded Software Developers
When starting a new project, simply select the microcontroller you the device database and the µvision IDE sets all compiler, assembler, linker, and memory options for you.
The CCS Compiler µ Vision debugger accurately simulates on-chip peripherals (PC, CAN, UART, SPI,Interrupts,I/O ports, A/D converter, D/A converter and PWM modules)of your aver device.
Simulation helps you understand h/w configurations and avoids time wasted on setup problems. Additionally, with simulation, you can write and test applications before target h/w is available.
When you are ready to begin testing your s/w application with target h/w, use the MON51, MON390, MONADI, or flash MON51 target monitors, the ISD51 In-System Debugger, or the ULINK USB-JTAG adapter to download and test program code on your target system.
Creating a project
Select Project - New Project.
Select a directory and enter the name of the project file.
Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device
Create source files to add to the project.
Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project.
Select Project - Options and set the tool options. Note when you select the target device from the Device Database™ all-special options are set automatically. You typically only need to configure the memory map of your target hardware. Default memory model settings are optimal.
Evaluation Software Limitations
The compiler, assembler, linker, and debugger are limited to 2 Kbytes of object code but source code may be any size. Programs that generate more than 2 Kbytes of object code will not compile, assemble, or link.
9.2 PIC TOOL KIT
We use PIC KIT 2 to dump the code in to the microcontroller. The hex file generated by the CCS compiler after debugging and compilation is used by PIC KIT 2.
Importing a Hex file
To import a hex file to be programmed in to the target device, select File>Import Hex
Fig: 9.2.1: PIC Kit 2 Programmer
Loading hex file to controller
After a device family has been selected and a hex file has been imported, the target device can be programmed by clicking write. The device will be erased and programmed with the hex code previously imported.
Fig 9.2.2: Loading Hex file to the controller tablet
The status of Write operation is displayed in the status bar located under the Device configuration window. Of the write is successful, the status bar turns green and displays "Programming Successful", as shown in fig below.
.
Fig 9.2.3: PIC Kit 2 Programming
10. FUTURE SCOPE
It can be designed according to the customers wish. It can be further developed by including the features like GSM facility in order to send SMS to the owner if any animal crosses the fence. The fence created can not only be in the shape of a circle but also even in straight lines, curve shaped. The size of the kit can be reduced to embedded chip and made easy for usage. It can be used in boarder alerting system for military, marine surveying and land surveying. Since the project result is mainly based on the GPS signals, by using a better quality of GPS receiver for more accuracy results in accurate and spontaneous results. Also the battery supply can be enhanced by using rechargeable batteries with good battery backup.
11. CONCLUSION
In this project we are making use of a GPS receiver for communication purpose. We are going to construct the virtual fence with muscle stimulator circuit or shock generator for domestic/wildlife applications. The LCD displays the latitude and longitudes, distance and radius of the fence.
This project can develop a virtual fence which acts similar to the physical fencing and has got the extra feature of providing shock/buzzer sound in case if the animal/person crosses the fence. By this we can completely design our own fence anywhere on the earth irrespective of the slope, hill, steep and above water surfaces etc.
12. APPENDIX
12.1 SCHEMATIC DIAGRAM
Fig 12.1: Schematic Diagram
12.2 HARDWARE SNAPSHOT
12.3 ABBREVIATIONS
AUC Authentication Center
BTS Base Transceiver Station
BSC Base Station Controller
CEPT Conference of European Posts and Telegraphs
EIR Equipment Identity Register.
ETSI European Telecommunication Standards Institute
HLR Home Location Register
IMEI International Mobile Equipment Identity
ITU International Telecommunication Union
IMSI International Mobile Subscriber Identity
LA Last known Location Area
MSISDN Mobile Subscriber ISDN
MSC Mobile service Switching Center
MAP Mobile Application Part
MSRN Mobile Station Roaming Number
MS Mobile station
MM Mobility Management layer
POTS Plain Old Telephone Service
PSTN Public switched telephone network
PSPDN packet switched public data network
PLMN Public land mobile network
Radio Resources management (RR)
RBS Remote Base station
SIM Subscriber Identity Module
TCU TransCoding Unit
TRAU TransCoding Rate and Adaptation Unit
VLR Visitor Location Register
Some Importantant links below with reports.just view the lik below.just search any project on our search box
Arduino interesting projects:
Arduino 30 simple and good projects
Atmega projects lists
Android Electronics projects lists
Rf based Projects with report
engineering study notes
GSM GPS based projects with report
Bluetooth based projects with reports
BIBLIOGRAPHY
References
1. "Why Did the Department of Defense Develop GPS?" Trimble Navigation Ltd. http://www.trimble.com/gps/whygps.shtml#0. Retrieved 2010-01-13.
2. "A Guide to the Global Positioning System (GPS) - GPS Timeline". Radio Shack. http://support.radioshack.com/support_tutorials/gps/gps_tmline.htm. Retrieved 2010-01-14.
3. Daly, P.. "Navstar GPS and GLONASS: global satellite navigation systems". IEEE. http://ieeexplore.ieee.org/iel1/2219/7072/00285510.pdf?arnumber=285510.
4. The Global Positioning System by Robert A. Nelson Via Satellite, November 1999
Web References
1. http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010296
2. http://www.howstuffworks.com
3. http://en.wikipedia.org/wiki/Gps
4. http://www.8051projects.com
5. www.csiro.au/science/Virtual-Fencing-Project.html
Arduino interesting projects:
Arduino 30 simple and good projects
Atmega projects lists
Android Electronics projects lists
Rf based Projects with report
engineering study notes
GSM GPS based projects with report
Bluetooth based projects with reports
1. INTRODUCTION
PLEASE use image yourself or down load the full report...searchin in the searech box
1.1 DEFINITION
The term “virtual” has been defined in philosophy as "that which is not real" but may display the salient qualities of the real. In general, fencing refers to a boundary; both the words put together it virtual fencing refers to a boundary, which doesn’t exist physically.
1.2 VIRTUAL FENCING
The purpose the project “GPS based virtual fencing” is to construct a virtual fencing that functions similar to physical fencing. A virtual fence is a barrier that uses electric shock to deter animals or people from crossing a boundary. The voltage of the shock may have effects ranging from uncomfortable, to painful or even lethal (capable of causing death). Mostly used today for agricultural fencing and other forms of animal control purposes, though it is frequently used to enhance security of sensitive areas, and there exist places where lethal voltages are used. Virtual fencing for the wild animals is meant to restrict animals to move in only few areas.
For example in recent days we can find the elephants coming in to the villages and damaging their lands, houses, and even their lives in this case we can restrict the elephants to the forest itself, not only elephants it may be any other wild animals we can stop them from coming out of the forest. In the other case we generally find our pet animals missing from home, even in this case we can stop our pet animal from going outside the home. In both the above cases we can make use of the virtual fencing project to restrict the movement of the animals beyond particular location.
For this purpose we make use of the current location of the animal which can be known with the help of the GPS and whenever it was about to cross its area it will have a shock which forces it to stay in the location to which it was restricted. The device consists of a micro controller which receives the information from the GPS and monitors the shock providing circuit.
2. OBJECTIVE OF THE PROJECT
Construction of virtual fencing.
Restricting animals/people to a particular area.
GPS interfacing with microcontroller.
Creating the fencing dynamically at any location on the earth irrespective of hill, slope, steep areas etc.,
Ability to increase the boundary distance dynamically if needed.
2.1 BLOCK DIAGRAM
Fig 2.1.1: Block Diagram of the project
2.2 BLOCK DIAGRAM DESCRIPTION
In this project we are making use of a GPS receiver to find the location of the animal/person to which we are creating the fence. The receiver gives the exact location where on the earth that particular animal is present in terms of latitudes and longitudes. We make use of the PIC 16F876A Microcontroller which has got 22 pins. This is used to control the operation of the fencing according to the GPS input and the predefined fence input. The LCD is used for display purpose which gives the details like latitudes, longitudes, distance, and radius etc., Several LEDs are used to indicate the status of the components and main power supply.
Once the operation of the circuit starts and when the location of animal/person is beyond the predefined fence value then the circuit generates shock using the muscle stimulator circuit. Also gives sound through a buzzer. The power supply is used to give power to all the above components of the circuit. As the main purpose of this project is in remote places and is not constant in location we opt for DC power supply rather than AC supply.
3. POWER SUPPLY
Power supply is the major concern for every electronic device. Since the controller and other devices used are low power devices there is a need to step down the voltage and as well as rectify the output to convert the output to a constant dc.
3.1 BLOCK DIAGRAM
Fig 3.1.1: Block Diagram of Regulated Power Supply
3.2 COMPONENTS OF POWER SUPPLY
Transformer
Transformer is a device used to increment or decrement the input voltage given as per the requirement. The transformers are classified into two types depending upon there functionality
Step up transformer
Step down transformer
Here we use a step down transformer for stepping down the house hold ac power supply i.e. the 230-240v power supply to 5V. We use a 5-0-5 v center tapped step down transformer.
Rectifier
The output of the transformer is an ac and should be rectified to a constant dc for this it is necessary to feed the output of the transformer to a rectifier.
The rectifier is employed to convert the alternating ac to a constant dc. There are many rectifiers available in the market some of them are
Half wave rectifier
Full wave rectifier
Bridge rectifier
The rectification is done by using one or more diodes connected in series or parallel. If only one diode is used then only first half cycle is rectified and it is termed as half wave rectification and the rectifier used is termed as half wave rectifier.
If two diodes are employed in parallel then both positive and negative half cycles are rectified and this is full wave rectification and the rectifier is termed as full wave rectifier.
If the diodes are arranged in the form of bridge then it is termed as Bridge rectifier, it acts as a full wave rectifier. In our project we make use of the rectifiers which are readily available in the market in the form of integrated chips (I.Cs).
Voltage Regulator
The voltage regulator is used for the voltage regulation purpose. We use IC 7805 voltage regulator.
The IC number has a specific significance. The number 78 represents the series while 05 represent the output voltage generated by the IC.
Light Emitting Diode
We employ a light emitting diode for testing the functionality of the power supply circuit. Here we use a 5 volts LED which is connected in series with the power supply circuit it verifies the functioning of the power supply.
LED’s are also employed in other areas for many purposes. The fallowing are the advantages of using LED’s.
It helps us while troubleshooting the device i.e. when the device is malfunctioning it would be easy to detect where the actual problem a raised.
LED employed with microcontroller verifies whether data is being transmitted.
It verifies the functionality of the power supply.
4. MICROCONTROLLER
4.1 INTRODUCTION
The PIC16F876A CMOS FLASH-based 8-bit microcontroller is upward compatible with pin PIC16CXXX and PIC16FXXX devices. It features 200 ns instruction execution, 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital(A/D) converter, 2 capture/compare/ PWM functions, a synchronous serial port that can be configured as either 3-wire SPI or 2-wire I2C bus, a USART, and a Parallel Slave Port.
High-Performance RISC CPU
Only 35 single-word instructions to learn.
All single-cycle instructions except for program branches, which are two-cycle.
Operating speed: DC – 20 MHz clock input.
DC – 200 ns instruction cycle.
Up to 8K x 14 words of Flash Program Memory.
Up to 368 x 8 bytes of Data Memory (RAM).
Up to 256 x 8 bytes of EEPROM Data Memory.
Pin out compatible to other 28-pin or 40/44-pin PIC16CXXX and PIC16FXXX.
Peripheral Features
Timer0: 8-bit timer/counter with 8-bit prescaler.
Timer1: 16-bit timer/counter with prescaler, can be incremented during Sleep via external crystal/clock.
Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.
Two Capture, Compare, PWM modules.
o Capture is 16-bit, maximum resolution is 12.5 ns.
o Compare is 16-bit, maximum resolution is 200 ns.
o PWM maximum resolution is 10-bit.
Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™ (Master/Slave).
Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address detection.
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).
Analog Features
10-bit, up to 8-channel Analog-to-Digital Converter (A/D).
Brown-out Reset (BOR).
Analog Comparator module with:
o Two analog comparators.
o Programmable on-chip voltage reference (VREF) module.
o Programmable input multiplexing from device inputs and internal voltage reference.
o Comparator outputs are externally accessible.
Special Microcontroller Features
100,000 erase/write cycle Enhanced Flash program memory typical.
1,000,000 erase/write cycle Data EEPROM memory typical.
Data EEPROM Retention > 40 years.
Self-reprogrammable under software control.
In-Circuit Serial Programming™ (ICSP™) via two pins.
Single-supply 5V In-Circuit Serial Programming.
Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation.
Programmable code protection.
Power saving Sleep mode.
Selectable oscillator options.
In-Circuit Debug (ICD) via two pins.
CMOS Technology
Low-power, high-speed Flash/EEPROM technology.
Fully static design.
Wide operating voltage range (2.0V to 5.5V).
Commercial and Industrial temperature ranges.
Low-power consumption.
Program memory (FLASH)
It is used for storing a written program. Since memory made in FLASH technology can be programmed and cleared more than once, it makes this microcontroller suitable for device development.
EEPROM
Data memory that needs to be saved when there is no supply. It is usually used for storing important data that must not be lost if power supply suddenly stops.
For instance, one such data is an assigned temperature in temperature regulators. If during a loss of power supply this data was lost, we would have to make the adjustment once again upon return of supply. Thus our device looses on self-reliance.
RAM
Data memory used by a program during its execution. In RAM are stored all inter-results or temporary data during run-time.
Ports
Ports are physical connections between the microcontroller and the outside world. PIC16F876A has 22 Input/output pins.
Free-Run Timer
This is an 8-bit register inside a microcontroller that works independently of the program. On every fourth clock of the oscillator it increments its value until it reaches the maximum (255), and then it starts counting over again from zero. As we know the exact timing between each two increments of the timer contents, timer can be used for measuring time which is very useful with some devices.
Central Processing Unit
CPU has a role of connective element between other blocks in the microcontroller. It coordinates the work of other blocks and executes the user program. It is the brain of a microcontroller. This part is responsible for finding and fetching the right instruction which needs to be executed, for decoding that instruction, and finally for its execution. Central processing unit connects all parts of the microcontroller into one whole. Surely, its most important function is to decode program instructions.
When programmer writes a program, instructions have a clear form like MOVLW 0x20. However, in order for a microcontroller to understand that, this 'letter' form of an instruction must be translated into a series of zeros and ones which is called an 'opcode'.
This transition from a letter to binary form is done by translators such as assembler translator (also known as an assembler). Instruction thus fetched from program memory must be decoded by a central processing unit. We can then select from the table of all the instructions a set of actions which execute a assigned task defined by instruction. As instructions may within themselves contain assignments which require different transfers of data from one memory into another, from memory onto ports, or some other calculations, CPU must be connected with all parts of the microcontroller. This is made possible through a data bus and an address bus.
Arithmetic logic unit is responsible for performing operations of adding, subtracting, moving (left or right within a register) and logic operations. Moving data inside a register is also known as 'shifting'. PIC16F876A contains an 8-bit arithmetic logic unit and 8-bit work registers.
Fig 4.1.1: Harvard vs. Von-Neuman Block Architectures
In instructions with two operands, ordinarily one operand is in work register (W register), and the other is one of the registers or a constant. By operand we mean the contents on which some operation is being done, and a register is any one of the GPR or SFR registers. GPR is an abbreviation for 'General Purposes Registers', and SFR for 'Special Function Registers'. In instructions with one operand, an operand is either W register or one of the registers.
As an addition in doing operations in arithmetic and logic, ALU controls status bits (bits found in STATUS register). Execution of some instructions affects status bits, which depends on the result itself.
Depending on which instruction is being executed, ALU can affect values of Carry (C), Digit Carry (DC), and Zero (Z) bits in STATUS register.
CISC, RISC
It has already been said that PIC16F876A has RISC architecture. This term is often found in computer literature, and it needs to be explained here in more detail. Harvard architecture is a newer concept than von-Neumann. It rose out of the need to speed up the work of a microcontroller. In Harvard architecture, data bus and address bus are separate. Thus a greater flow of data is possible through the central processing unit, and of course, a greater speed of work. Separating a program from data memory makes it further possible for instructions not to have to be 8-bit words. PIC16F876A uses 14 bits for instructions which allows for all instructions to be one word instructions. It is also typical for Harvard architecture to have fewer instructions than von-Neumann's, and to have instructions usually executed in one cycle.
Microcontrollers with Harvard architecture are also called "RISC microcontrollers". RISC stands for Reduced Instruction Set Computer. Microcontrollers with von-Neumann's architecture are called 'CISC microcontrollers'. The title CISC stands for Complex Instruction Set Computer.
Since PIC16F876A is a RISC microcontroller, that means that it has a reduced set of instructions, more precisely 35 instructions. (Ex. Intel's and Motorola's microcontrollers have over hundred instructions) All of these instructions are executed in one cycle except for jump and branch instructions. According to what its maker says, PIC16F876A usually reaches results of 2:1 in code compression and 4:1 in speed in relation to other 8-bit microcontrollers in its class.
4.2 PIN DIAGRAM
pin configuration click here
Pipelining
Instruction cycle consists of cycles Q1, Q2, Q3 and Q4. Cycles of calling and executing instructions are connected in such a way that in order to make a call, one instruction cycle is needed, and one more is needed for decoding and execution. However, due to pipelining, each instruction is effectively executed in one cycle. If instruction causes a change on program counter, and PC doesn't point to the following but to some other address (which can be the case with jumps or with calling subprograms), two cycles are needed for executing an instruction. This is so because instruction must be processed again, but this time from the right address. Cycle of calling begins with Q1 clock, by writing into instruction register (IR). Decoding and executing begins with Q2, Q3 and Q4 clocks.
Fig 4.2.3: Instruction Pipeline Flow
Clock generator – Oscillator
Oscillator circuit is used for providing a microcontroller with a clock. Clock is needed so that microcontroller could execute a program or program instructions.
Reset
Reset is used for putting the microcontroller into a 'known' condition. That practically means that microcontroller can behave rather inaccurately under certain undesirable conditions. In order to continue its proper functioning it has to be reset, meaning all registers would be placed in a starting position. Reset is not only used when microcontroller doesn't behave the way we want it to, but can also be used when trying out a device as an interrupt in program execution, or to get a microcontroller ready when loading a program.
In order to prevent from bringing a logical zero to MCLR pin accidentally (line above it means that reset is activated by a logical zero), MCLR has to be connected via resistor to the positive supply pole. Resistor should be between 5 and 10K. This kind of resistor, whose function is to keep a certain line on a logical one as a preventive, is called a pull up.
Microcontroller PIC16f876a knows several sources of resets
a) Reset during power on, POR (Power-On Reset)
b) Reset during regular work by bringing logical zero to MCLR microcontroller's pin.
c) Reset during SLEEP regime
d) Reset at watchdog timer (WDT) overflow
e) Reset during at WDT overflow during SLEEP work regime.
The most important reset sources are a) and b). The first one occurs each time a power supply is brought to the microcontroller and serves to bring all registers to a starting position initial state. The second one is a product of purposeful bringing in of a logical zero to MCLR pin during normal operation of the microcontroller. This second one is often used in program development.
During a reset, RAM memory locations are not being reset. They are unknown during a power up and are not changed at any reset. Unlike these, SFR registers are reset to a starting position initial state. One of the most important effects of a reset is setting a program counter (PC) to zero (0000h) , which enables the program to start executing from the first written instruction. Reset at supply voltage drop below the permissible (Brown-out Reset).
Impulse for resetting during voltage voltage-up is generated by microcontroller itself when it detects an increase in supply Vdd (in a range from 1.2V to 1.8V). That impulse lasts 72ms which is enough time for an oscillator to get stabilized. These 72ms are provided by an internal PWRT timer which has its own RC oscillator. Microcontroller is in a reset mode as long as PWRT is active. However, as device is working, problem arises when supply doesn't drop to zero but falls below the limit that guarantees microcontroller's proper functioning. This is a likely case in practice, especially in industrial environment where disturbances and instability of supply are an everyday occurrence. To solve this problem we need to make sure that microcontroller is in a reset state each time supply falls below the approved limit.
4.3 MEMORY ORGANIZATION
PIC16F876A has two separate memory blocks, one for data and the other for program. EEPROM memory with GPR and SFR registers in RAM memory make up the data block, while FLASH memory makes up the program block.
Program memory
Program memory has been carried out in FLASH technology which makes it possible to program a microcontroller many times before it's installed into a device, and even after its installment if eventual changes in program or process parameters should occur. The size of program memory is 1024 locations with 14 bits width where locations zero and four are reserved for reset and interrupt vector.
Data memory
Data memory consists of EEPROM and RAM memories. EEPROM memory consists of 256 eight bit locations whose contents are not lost during loosing of power supply. EEPROM is not directly addressable, but is accessed indirectly through EEADR and EEDATA registers. As EEPROM memory usually serves for storing important parameters (for example, of a given temperature in temperature regulators) , there is a strict procedure for writing in EEPROM which must be followed in order to avoid accidental writing. RAM memory for data occupies space on a memory map from location 0x0C to 0x4F which comes to 68 locations. Locations of RAM memory are also called GPR registers which is an abbreviation for General Purpose Registers. GPR registers can be accessed regardless of which bank is selected at the moment.
Program Counter
Program counter (PC) is a 13-bit register that contains the address of the instruction being executed. It is physically carried out as a combination of a 5-bit register PCLATH for the five higher bits of the address, and the 8-bit register PCL for the lower 8 bits of the address.
By its incrementing or change (i.e. in case of jumps) microcontroller executes program instructions step-by-step.
Stack
PIC16f876a has a 13-bit stack with 8 levels, or in other words, a group of 8 memory locations, 13 bits wide, with special purpose. Its basic role is to keep the value of program counter after a jump from the main program to an address of a subprogram. In order for a program to know how to go back to the point where it started from, it has to return the value of a program counter from a stack. When moving from a program to a subprogram, program counter is being pushed onto a stack (example of this is CALL instruction). When executing instructions such as RETURN, RETLW or RETFIE which were executed at the end of a subprogram, program counter was taken from a stack so that program could continue where was stopped before it was interrupted. These operations of placing on and taking off from a program counter stack are called PUSH and POP, and are named according to similar instructions on some bigger microcontrollers.
In System Programming
In order to program a program memory, microcontroller must be set to special working mode by bringing up MCLR pin to 13.5V, and supply voltage Vdd has to be stabilized between 4.5V to 5.5V. Program memory can be programmed serially using two 'data/clock' pins which must previously be separated from device lines, so that errors wouldn't come up during programming.
5. GLOBAL POSITIONING SYSTEM (GPS)
CLIck here for gps
6. MUSCLE STIMULATOR
click here for MUSCLE STIMULATOR
7. LIQUID CRYSTAL DISPLAY (LCD)
CLICK HERE FOR LCD
7.2 BASIC 16x 2 CHARACTERS LCD – BLACK ON GREEN 5V
This is a basic 16 character by 2-line display. Black text on Green background. Utilizes the extremely common HD44780 parallel interface chipset. Interface code is freely available. We will need ~11 general I/O pins to interface to this LCD screen.
Fig 7.2.1: A 16/2 character LCD display
The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 characters, whereas LCDs supporting more than 80 characters make use of 2 HD44780 controllers.
Fig 7.2.2: 2 Pin Description of LCD
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins are extra in both for back-light LED connections). Pin description is shown in the table below.
Fig 7.2.3: Character LCD type HD44780 Pin diagram
Pin description of character LCD:
Pin No. Name Description
Pin no. 1 VSS Power supply (GND)
Pin no. 2 VCC Power supply (+5V)
Pin no. 3 VEE Contrast adjust
Pin no. 4 RS 0 = Instruction input
1 = Data input
Pin no. 5 R/W 0 = Write to LCD module
1 = Read from LCD module
Pin no. 6 EN Enable signal
Pin no. 7 D0 Data bus line 0 (LSB)
Pin no. 8 D1 Data bus line 1
Pin no. 9 D2 Data bus line 2
Pin no. 10 D3 Data bus line 3
Pin no. 11 D4 Data bus line 4
Pin no. 12 D5 Data bus line 5
Pin no. 13 D6 Data bus line 6
Pin no. 14 D7 Data bus line 7 (MSB)
Table 7.2.1: Character LCD pins with 1 Controller
Pin No. Name Description
Pin no. 1 D7 Data bus line 7 (MSB)
Pin no. 2 D6 Data bus line 6
Pin no. 3 D5 Data bus line 5
Pin no. 4 D4 Data bus line 4
Pin no. 5 D3 Data bus line 3
Pin no. 6 D2 Data bus line 2
Pin no. 7 D1 Data bus line 1
Pin no. 8 D0 Data bus line 0 (LSB)
Pin no. 9 EN1 Enable signal for row 0 and 1 (1stcontroller)
Pin no. 10 R/W 0 = Write to LCD module
1 = Read from LCD module
Pin no. 11 RS 0 = Instruction input
1 = Data input
Pin no. 12 VEE Contrast adjust
Pin no. 13 VSS Power supply (GND)
Pin no. 14 VCC Power supply (+5V)
Pin no. 15 EN2 Enable signal for row 2 and 3 (2ndcontroller)
Pin no. 16 NC Not Connected
Table 7.2.2: Character LCD pins with 2 Controller
7.3 LCD BACKGROUND
Frequently, an 8051 program must interact with the outside world using input and output devices that communicate directly with a human being. One of the most common devices attached to an 8051 is an LCD display. Some of the most common LCDs connected to the 8051 are 16x2 and 20x2 displays. This means 16 characters per line by 2 lines and 20 characters per line by 2 lines, respectively.
Interfacing Example - 16 Characters x 2 Lines LCD
This is the first interfacing example for the Parallel Port. We will start with something simple. This example doesn't use the Bi-directional feature found on newer ports, thus it should work with most, if no all Parallel Ports. It however doesn't show the use of the Status Port as an input. A 16 Character x 2 Line LCD Modules to the Parallel Port. These LCD Modules are very common these days, and are quite simple to work with, as all the logic required running them is on board.
Schematic
Fig 7.3.1: Schematic Diagram of 2 line 16 character LCD display
Circuit Description
Above is the quite simple schematic. The LCD panel's Enable and Register Select is connected to the Control Port. The Control Port is an open collector / open drain output. While most Parallel Ports have internal pull-up resistors, there is a few which don't. Therefore by incorporating the two 10K external pull up resistors, the circuit is more portable for a wider range of computers, some of which may have no internal pull up resistors. We make no effort to place the Data bus into reverse direction. Therefore we hard wire the R/W line of the LCD panel, into write mode.
This will cause no bus conflicts on the data lines. As a result we cannot read back the LCD's internal Busy Flag which tells us if the LCD has accepted and finished processing the last instruction. This problem is overcome by inserting known delays into our program.
The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. As with all the examples, I've left the power supply out.
We can use a bench power supply set to 5v or use an onboard +5 regulator. Remember a few de-coupling capacitors, especially if we have trouble with the circuit working properly.
16 x 2 Alphanumeric LCD Module Features
Intelligent, with built-in Hitachi HD44780 compatible LCD controller and RAM providing simple interfacing 61 x 15.8 mm viewing area.
5 x 7 dot matrix format for 2.96 x 5.56 mm characters, plus cursor line.
Can display 224 different symbols.
Low power consumption (1 mA typical).
Powerful command set and user-produced characters.
TTL and CMOS compatible.
Connector for standard 0.1-pitch pin headers.
16 x 2 Alphanumeric LCD Module Specifications
Pin Symbol Level Function
1 VSS - Power, GND
2 VDD - Power, 5V
3 Vo - Power, for LCD Drive
4 RS H/L Register Select Signal
H: Data Input
L: Instruction Input
5 R/W H/L H: Data Read (LCD->MPU)
L: Data Write (MPU->LCD)
6 E H,H->L Enable
7-14 DB0-DB7 H/L Data Bus; Software selectable 4- or 8-bit mode
15 NC - Not connected
16 NC - Not connected
Table 7.3.1: A 16 x 2 Alphanumeric LCD Module Specifications
7.4 ADVANTAGES AND APPLICATIONS OF LCDs
Advantages
Download high quality fonts of any size, style or language easily and quickly.
Create graphics using primitives such as bitmaps, pixels, lines, rectangles and bar graphs.
Backlight & Contrast is adjustable in most models.
4 different brightness settings.
General Purpose Output (20mA drive).
Line wrap and Auto screen scroll.
Bar Graphs and Large Digits.
Speed settings.
Applications
Medical equipment
Electronic test equipment
Industrial machinery Interface
Serial terminal
Advertising system
EPOS
Restaurant ordering systems
Gaming box
Security systems
R&D Test units
Climatizing units
PLC Interface
Simulators
Environmental monitoring
Lab development, student projects
8. RS - 232
RS - 232 is a asynchronous serial communication protocol widely used in computers and digital systems. It is called asynchronous because there is no separate synchronizing clock signal as there are in other serial protocols like SPI and I2C. The protocol is such that it automatically synchronizes itself. We can use RS - 232 to easily create a data link between our MCU based projects and standard PC. Excellent example is a commercial Serial PC mouse (not popular these days, I had got one with my old PC which I bought in year 2000 in those days these were famous). You can make a data loggers that reads analog value(such as temperatures or light using proper sensors) using the ADC and send them to PC where a special program written by you shows the data using nice graphs and charts etc.. Actually your imagination is the limit!
8.1 BASICS OF SERIAL COMMUNICATION
In serial communication the whole data unit, say a byte is transmitted one bit at a time. While in parallel transmission the whole data unit, say a byte (8bits) are transmitted at once. Obviously serial transmission requires a single wire while parallel transfer requires as many wires as there are in our data unit. So parallel transfer is used to transfer data within short range (e.g. inside the computer between graphic card and CPU) while serial transfer is preferable in long range.
As in serial transmission only one wire is used for data transfer. Its logic level changes according to bit being transmitted (0 or 1). But a serial communication needs some way of synchronization. If you don't understand what I mean by "synchronization" then don't worry just read on it will become clear.
Parts in RS - 232
In RS - 232 there are two data lines RX and TX. TX is the wire in which data is sent out to other device. RX is the line in which other device put the data it need to sent to the device.
Fig 8.1.1: RS - 232 transmission.
The arrows indicates the direction of data transfer. In addition to RX/TX lines there is a third line i.e. Ground (GND) or Common.
One more thing about RS - 232. We know that a HIGH =+5v and LOW=0v in TTL / MCU circuits but in RS - 232 a HIGH=-12V and LOW=+12V. This is bit weird but it increases the range and reliability of data transfer. Now you must be wondering how to interface this to MCUs who understand only 0 and 5v? But you will be very happy to know that there is a very popular IC which can do this for you! It is MAX232 from Maxim Semiconductors. I will show you how to make a level converter using MAX232 in next tutorial.
As there is no "clock" line so for synchronization accurate timing is required so transmissions are carried out with certain standard speeds. The speeds are measured in bits per second. Number of bits transmitted is also known as baud rate. Some standard baud rates are
1200
2400
4800
9600
19200
38400
57600
115200 ... etc
For our example for discussion of protocol we chose the speed as 9600bps(bits per second). As we are sending 9600 bits per second one bits takes 1/9600 seconds or 0.000104 sec or 104 uS (microsecond= 10^-6 sec).
To transmit a single byte we need to extra bits they are START BIT and STOP BIT(more about them latter). Thus to send a byte a total of ten bits are required so we are sending 960 bytes per second.
Note: The number of stop bits can be one or two (for simplicity we will be using single stop bit). There is one more bit the parity bit but again for simplicity we would not be using it)
8.2 RS - 232 DATA TRANSFER
The data transfer is done in following ways
Transmission
1. When there is no transmission the TX line sits HIGH (-12V See above para) (STOP CONDITION)
2. When the device needs to send data it pulls the TX line low for 104uS (This is the start bit which is always 0)
3. then it send each bits with duration = 104uS
4. Finally it sets TX lines to HIGH for at least 104uS (This is stop bits and is always 1). I said "at least" because after you send the stop bit you can either start new transmission by sending a start bit or you let the TX line remain HIGH till next transmission begin in this case the last bit is more than 104uS.
Fig 8.2.1: Data Transmission on RS - 232 line
Reception
1. The receiving device is waiting for the start bit i.e. the RX line to go LOW.
2. When it gets start bit it waits for half bit time i.e. 104/2 = 51uS now it is in middle of start bit it reads it again to make sure it is a valid start bit not a spike.
3. Then it waits for 104uS and now it is in middle of first bit it now reads the value of RX line.
4. In same way it reads all 8 bits.
5. Now the receiver has the data.
Fig 8.2.2: How the Receiver receives the data on RS - 232 RX l
9. SOFTWARE DESCRIPTION AND CODING
9.1 CCS COMPILIER
The compiler used in this project is Microchip PIC Micro C Compiler. CCS provides a complete, integrated tool suite for developing and debugging embedded applications running on Microchip PIC® MCUs. The heart of this development tool suite is the CCS intelligent code optimizing C compiler, which frees developers to concentrate on design functionality instead of having to become an MCU architecture expert.
Maximize code reuse by easily porting from one MCU to another.
Minimize lines of new code with CCS provided peripheral drivers, built-in functions and standard C operators.
Built in libraries are specific to PIC® MCU registers, allowing access to hardware features directly from C.
Problems facing Embedded Software Developers
When starting a new project, simply select the microcontroller you the device database and the µvision IDE sets all compiler, assembler, linker, and memory options for you.
The CCS Compiler µ Vision debugger accurately simulates on-chip peripherals (PC, CAN, UART, SPI,Interrupts,I/O ports, A/D converter, D/A converter and PWM modules)of your aver device.
Simulation helps you understand h/w configurations and avoids time wasted on setup problems. Additionally, with simulation, you can write and test applications before target h/w is available.
When you are ready to begin testing your s/w application with target h/w, use the MON51, MON390, MONADI, or flash MON51 target monitors, the ISD51 In-System Debugger, or the ULINK USB-JTAG adapter to download and test program code on your target system.
Creating a project
Select Project - New Project.
Select a directory and enter the name of the project file.
Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device
Create source files to add to the project.
Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project.
Select Project - Options and set the tool options. Note when you select the target device from the Device Database™ all-special options are set automatically. You typically only need to configure the memory map of your target hardware. Default memory model settings are optimal.
Evaluation Software Limitations
The compiler, assembler, linker, and debugger are limited to 2 Kbytes of object code but source code may be any size. Programs that generate more than 2 Kbytes of object code will not compile, assemble, or link.
9.2 PIC TOOL KIT
We use PIC KIT 2 to dump the code in to the microcontroller. The hex file generated by the CCS compiler after debugging and compilation is used by PIC KIT 2.
Importing a Hex file
To import a hex file to be programmed in to the target device, select File>Import Hex
Fig: 9.2.1: PIC Kit 2 Programmer
Loading hex file to controller
After a device family has been selected and a hex file has been imported, the target device can be programmed by clicking write. The device will be erased and programmed with the hex code previously imported.
Fig 9.2.2: Loading Hex file to the controller tablet
The status of Write operation is displayed in the status bar located under the Device configuration window. Of the write is successful, the status bar turns green and displays "Programming Successful", as shown in fig below.
.
Fig 9.2.3: PIC Kit 2 Programming
10. FUTURE SCOPE
It can be designed according to the customers wish. It can be further developed by including the features like GSM facility in order to send SMS to the owner if any animal crosses the fence. The fence created can not only be in the shape of a circle but also even in straight lines, curve shaped. The size of the kit can be reduced to embedded chip and made easy for usage. It can be used in boarder alerting system for military, marine surveying and land surveying. Since the project result is mainly based on the GPS signals, by using a better quality of GPS receiver for more accuracy results in accurate and spontaneous results. Also the battery supply can be enhanced by using rechargeable batteries with good battery backup.
11. CONCLUSION
In this project we are making use of a GPS receiver for communication purpose. We are going to construct the virtual fence with muscle stimulator circuit or shock generator for domestic/wildlife applications. The LCD displays the latitude and longitudes, distance and radius of the fence.
This project can develop a virtual fence which acts similar to the physical fencing and has got the extra feature of providing shock/buzzer sound in case if the animal/person crosses the fence. By this we can completely design our own fence anywhere on the earth irrespective of the slope, hill, steep and above water surfaces etc.
12. APPENDIX
12.1 SCHEMATIC DIAGRAM
Fig 12.1: Schematic Diagram
12.2 HARDWARE SNAPSHOT
12.3 ABBREVIATIONS
AUC Authentication Center
BTS Base Transceiver Station
BSC Base Station Controller
CEPT Conference of European Posts and Telegraphs
EIR Equipment Identity Register.
ETSI European Telecommunication Standards Institute
HLR Home Location Register
IMEI International Mobile Equipment Identity
ITU International Telecommunication Union
IMSI International Mobile Subscriber Identity
LA Last known Location Area
MSISDN Mobile Subscriber ISDN
MSC Mobile service Switching Center
MAP Mobile Application Part
MSRN Mobile Station Roaming Number
MS Mobile station
MM Mobility Management layer
POTS Plain Old Telephone Service
PSTN Public switched telephone network
PSPDN packet switched public data network
PLMN Public land mobile network
Radio Resources management (RR)
RBS Remote Base station
SIM Subscriber Identity Module
TCU TransCoding Unit
TRAU TransCoding Rate and Adaptation Unit
VLR Visitor Location Register
Some Importantant links below with reports.just view the lik below.just search any project on our search box
Arduino interesting projects:
Arduino 30 simple and good projects
Atmega projects lists
Android Electronics projects lists
Rf based Projects with report
engineering study notes
GSM GPS based projects with report
Bluetooth based projects with reports
BIBLIOGRAPHY
References
1. "Why Did the Department of Defense Develop GPS?" Trimble Navigation Ltd. http://www.trimble.com/gps/whygps.shtml#0. Retrieved 2010-01-13.
2. "A Guide to the Global Positioning System (GPS) - GPS Timeline". Radio Shack. http://support.radioshack.com/support_tutorials/gps/gps_tmline.htm. Retrieved 2010-01-14.
3. Daly, P.. "Navstar GPS and GLONASS: global satellite navigation systems". IEEE. http://ieeexplore.ieee.org/iel1/2219/7072/00285510.pdf?arnumber=285510.
4. The Global Positioning System by Robert A. Nelson Via Satellite, November 1999
Web References
1. http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010296
2. http://www.howstuffworks.com
3. http://en.wikipedia.org/wiki/Gps
4. http://www.8051projects.com
5. www.csiro.au/science/Virtual-Fencing-Project.html
No comments:
Post a Comment
its cool