+ All Categories

WDAS

Date post: 02-Sep-2014
Category:
Upload: vaibhav-mehta
View: 125 times
Download: 0 times
Share this document with a friend
Popular Tags:
230
A PROJECT REPORT ON “WIRELESS DATA ACQUISITION SYSTEM” SUBMITTED BY MINALI JADHAV RUCHA GAJARE VAIBHAV MEHTA UNDER THE GUIDANCE OF Mrs. SHRAVANI SHAHAPURE DEPARTMENT OF ELECTRONICS & TELECOMMUNICATION ENGINEERING PILLAI’S INSTITUTE OF INFORMATION TECHNOLOGY, ENGINEERING, MEDIA STUDIES & RESEARCH NEW PANVEL – 410206 UNIVERSITY OF MUMBAI
Transcript

A PROJECT REPORT ON

WIRELESS DATA ACQUISITION SYSTEMSUBMITTED BY MINALI JADHAV RUCHA GAJARE VAIBHAV MEHTA UNDER THE GUIDANCE OF Mrs. SHRAVANI SHAHAPURE

DEPARTMENT OF ELECTRONICS & TELECOMMUNICATION ENGINEERING PILLAIS INSTITUTE OF INFORMATION TECHNOLOGY, ENGINEERING, MEDIA STUDIES & RESEARCH NEW PANVEL 410206 UNIVERSITY OF MUMBAI Academic Year 2011-12

DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION Pillais Institute of Information Technology, Engineering, Media Studies and Research New Panvel-410206 CERTIFICATE This is to certify that the requirements for the project synopsis entitled WIRELESS DATA ACQUISITION SYSTEM have been successfully completed by the following students: Name Minali P Jadhav Rucha H Gajare Vaibhav D Mehta Roll No 822 816 834

In partial fulfillment of Bachelor of Engineering University of Mumbai, in the department of Electronics and Telecommunication, Pillais Institute of Information Technology, Engineering, Media Studies & Research, New Panvel during the academic year 2011-12.

Internal Guide: _____________________ (Mrs. Shravani Shahapure) Internal Examiner: _________________

External Guide: _________________ External Examiner: _____________

Head of Department: _______________

Principal: _____________________

Acknowledgement

Apart from the efforts of us, the success of any project depends largely on the encouragement and guidelines of many others. We take this opportunity to express our gratitude to the people who have been instrumental in the successful completion of this project. We would like to show greatest appreciation to our project guide Mrs. Shravani Shahapure. We cant say thank you enough for her tremendous support and help. We feel motivated and encouraged every time we attend her meeting. Without her encouragement and guidance this project would not have materialized. We would like to tender our sincere thanks to Prof. Sanjeev Kumar Shrivastava the H.O.D of the branch of Electronics & Telecommunication Engineering. and the entire teaching staff of Pillis Institute of Information Technology for their support and encouragement in all aspects. We also express our deep regards and gratitude to our Principal Dr. R.I.K Moorthy. We would wish to thank the non-teaching staff and our friends who have helped us in all the time in one way or other. The guidance and support received from all the members who contributed and who are contributing to this project, was vital for the success of the project. We are grateful for their constant support and help.

PREFACE

We take an opportunity to present this project report on "WIRELESS DATA ACQUISITION SYSTEM" and put before readers some useful information regarding our project. The completion of the project work is a millstone in student life and its execution is inevitable in the hands of guide. We have made sincere attempts and taken every care to present this matter in precise and compact form, the language being as simple as possible. We are sure that the information contained in this volume would certainly prove useful for better insight in the scope and dimension of this project in its true perspective. The task of completion of the project though being difficulty was made quite simple, interesting and successful due to deep involvement and complete dedication of our group members.

Table of ContentsTable of Contents..................................................................................................................................5 List of Figures...................................................................................................................................9 ........................................................................................................................................................11 1. INTRODUCTION..........................................................................................................................11 1.1 DAS: Then and Now................................................................................................................12 1.2 Typical Data Acquisition System.............................................................................................13 1.3 Problems in DAS......................................................................................................................15 2. REVIEW OF LITERATURE.........................................................................................................16 3. WIRELESS DATA ACQUISITION SYSTEM............................................................................18 3.1 Structure of WDAS in brief......................................................................................................18 3.2 Wireless Technology................................................................................................................19 3.3 Why only Wi-Fi?.....................................................................................................................20 3.4 Block Diagram of Wireless Data Acquisition System.............................................................20 3.4.1 PIC18F4550 Microcontroller.............................................................................................23 3.4.1.1 PIC18F4550 Microchip High-Performance, Enhanced Flash, USB Microcontrollers with nanoWatt Technology Features......................................................................................24 3.4.1.2 PIN diagram and Architecture....................................................................................26 3.4.2. Ultrasonic Distance Measurement Sensor........................................................................27 3.4.2.1 Construction and Working..........................................................................................28 3.4.2.2 Selection of transducer................................................................................................29 3.4.2.3 Ultrasonic Echo Ranging............................................................................................29 3.4.2.4 Calculation to measure distance of obstacle...............................................................31 3.4.2.5 Specifications..............................................................................................................31

3.4.3 Passive Infrared Sensor......................................................................................................32 3.4.3.1 Design..........................................................................................................................33 3.4.3.3 PIR Based motion detector.........................................................................................34 3.4.3.4 Construction and Working of PIR..............................................................................35 3.4.3.5 Specifications..............................................................................................................36 3.4.4 IR Based Obstacle Sensor..................................................................................................38 3.4.4.1 Working.......................................................................................................................39 3.4.4.2 Circuit description & working for oscillator..............................................................48 3.4.4.3 IR transmitter LED......................................................................................................49 3.4.4.4 TSOP1738 IR receiver................................................................................................50 3.4.5 Global Positioning System................................................................................................51 3.4.5.1 How it works...............................................................................................................52 3.4.5.2. Navigation equations..................................................................................................52 3.4.5.3 Trilateration.................................................................................................................53 3.4.5.4 The GPS satellite system............................................................................................54 3.4.5.5 Signals in GPS.............................................................................................................54 3.4.5.6 Sources of GPS signal errors......................................................................................55 3.4.5.7 GPS Module in our Project.........................................................................................56 3.4.5.8 Specifications..............................................................................................................56 3.4.6 LM35 Temperature Sensor................................................................................................57 3.4.7 Data Sharing Methods.......................................................................................................59 3.4.7.1 Selection of sharing techniques..................................................................................61 3.4.7.2 Opera Units.................................................................................................................62 3.4.7.3 Remote Desktop..........................................................................................................66 3.4.7.3.3 Configure for a Remote Desktop Connection in windows 7..................................70

3.4.7.3.4 Connecting to a Remote Desktop in windows 7.....................................................73 3.4.8 Software Development For WDAS...................................................................................74 3.4.8.1 Software developing for microcontroller PIC18F4550..............................................77 3.4.8.2 Software developing for PC........................................................................................93 3.4.9 PCB Layout......................................................................................................................102 COMPONENTS LIST......................................................................................................................109 TESTING OF WDAS.......................................................................................................................110 5.1 Recorded data when WDAS system was in ideal state..........................................................111 5.2 Recorded data when WDAS system when feted on Robot...................................................116 8. Reference......................................................................................................................................126 Appendix...........................................................................................................................................128 9.1 Program for developing software for PC...............................................................................128 Program for microcontroller for collecting data from sensors, processing data, master slave communication and communication with PC..............................................................................144 9.2.1 Program for master PIC.......................................................................................................144 9.2.2 Program for slave PIC......................................................................................................161

List of FiguresFigure 1.1 Block diagram of DAS.....................................................................................................13 Figure 3.1 Structure of WDAS...........................................................................................................19 Figure 3.2 Block diagram WDAS......................................................................................................21 Figure 3.3 Pin configuration of PIC...................................................................................................26 Figure 3.4 PIC block diagram...........................................................................................................27 Figure 3.5 Ultrasonic sensor.....................................................................................................28 Figure 3.6 Construction of ultrasonic sensor.....................................................................................28 Figure 3.6 Radiation pattern of Ultrasonic.........................................................................................29 Figure 3.7 Ultrasonic transmitter receiver.........................................................................................29 Figure 3.8 Ultrasonic block diagram..................................................................................................30 Figure 3.9 Simplified model of pyroelectric effect............................................................................33 Figure 3.10 Construction of PIR35 Figure 3.11 Working principle of PIR...............................................................................................36 Figure 3.12 PIR...................................................................................................................................36 Figure 3.13 IR spectrum.....................................................................................................................38 Figure 3.14 IR Obstacle detection.....................................................................................................38 Figure 3.15 IR obstacle detector circuit.............................................................................................48 Figure 3.16 Oscillator circuit for IR transmission....................................................................49 Figure 3.17 Waveforms......................................................................................................................49 Figure 3.18 IR Transmitter LED........................................................................................................49 Figure 3.19 TSOP1738 IR receiver....................................................................................................50 Figure 3.20 Block Diagram of TSOP1738.........................................................................................50 Figure 3.21 GPS satellite system........................................................................................................54 9|Page

Figure 3.23 GPS MT3318 USB Module............................................................................................56 Figure 3.24 Opera data sharing unit...................................................................................................62 Figure 3.25 Downloading opera web page - Step1............................................................................63 Figure 3.26 Opera Unite Installation and setting - Step2..................................................................64 Figure 3.27 Opera Unite Installation and setting - Step3..................................................................65 Figure 3.28 Opera Unite Installation and setting - step4...................................................................66 Figure 3.29-Configuring Remote desktop - step1..............................................................................71 Figure 3.30 Configure for a Remote Desktop - Step2.......................................................................71 Figure 3.31 Configure for a Remote Desktop - Step3.......................................................................73 Figure 3.32 Connecting to remote desktop - step1 .............................................................................................................................................................74 Figure 3.33 Connecting to remote desktop - Step2............................................................................74 Figure 3.34 Simple I/O.......................................................................................................................79 Figure 3.35 Port A and TRISA Register............................................................................................79 Figure 3.36 PORTB and TRISB Register..........................................................................................81 Figure 3.37 ADCON0 control register...............................................................................................82 Figure 3.38 ADCON1 register...........................................................................................................83 Figure 3.39 PCFG register..................................................................................................................84 Figure 3.40 ADCON2 Register..........................................................................................................85 Figure 3.41 A/D conversions TAD cycles (ACQT = 000, TAQ=1)......................................88 Figure 3.42 A/D conversions TAD cycles (ACQT = 010, TAQ=4TAD)..............................88 Figure 3.43 Software developing for PC flowchart...........................................................................93 Figure 3.44 WDAS software screen shot...........................................................................................96 Figure 3.45 Selecting Port to which motherboard is connected........................................................97 Figure 3.46 Motherboard connected..................................................................................................97 10 | P a g e

Figure 3.47 Data log started...............................................................................................................98 Figure 3.48 Selecting port where GPS is connected..........................................................................99 Figure 3.49 GPS data display...........................................................................................................102 Figure 3.50 PCB design stages.........................................................................................................103 Figure 3.51 Schematic of circuit......................................................................................................106 Figure 3.52 PCB layout....................................................................................................................107

1. INTRODUCTIONIn industry with having huge span, Agricultural area, security system and other practical application process, it often needs to test the site equipments video of particular area with audio 11 | P a g e

and environmental. To control or observe such sites it is necessary to check conditions over sites time to time. This is what actually data acquisition means. Data acquisition is the process of sampling signals that measures real world physical conditions and converts the resulting samples into digital numeric values that can be manipulated. Data acquisition systems can take many forms from very simple manual systems to high complicated computer controlled ones. The simplest form may be a technician manually logging information such as the temperature of an oven. However this form of data acquisition has its limitations. Not only is it expensive because of the fact that someone has to be available to take the measurements, but being manual it can be subject to errors. Readings may not be taken at the prescribed times, and also there can be errors resulting from the manual fashion in which the readings are taken. As can be imagined the problems become worse if a large number of readings need to be taken, as timing may become more of an issue, along with the volume of work required. To overcome this, the simple answer is to use computer control to perform the data acquisition. As a result a definition of what is normally taken to be data acquisition is gathering information in an automated fashion from analog and digital measurement sources, i.e. sensors and devices under test. Data acquisition is widely used in many areas of industry. Data acquisition is used to acquire data from sensors and other sources under computer control and bring the data together and store and manipulate it. In view of the wide variety of signals and parameters that can be sampled and stored, data acquisition involves many techniques and skills. Data acquisition systems incorporate signals, sensors, actuators, signal conditioning, data acquisition devices, and application software. So summing up, Data Acquisition is the process of: Acquiring signals from real-world phenomena Digitizing the signals Analyzing, presenting and saving the data

1.1 DAS: Then and Now12 | P a g e

It was not that long ago the stereotype of an engineer was someone in a white lab coat watching one or more meters and writing results on a clipboard. The advent of extremely low cost computers, combined with the development of a wide variety of powerful data acquisition interfaces has driven this stereotype farther back in history than black and white movies. Also, most college graduates in science and engineering disciplines have enough programming training and experience to make the programming required for DAQ applications quite straightforward. In the early 1980's, when the PC-based DAQ market was in its infancy, most analog input and output devices offered 12-bit resolution. There were also some lower speed products with greater than 12-bit resolution and a number of high speed products offering resolution in the 8 to 10-bit range. Today, the technology has changed and the standard resolution is 16-bit, with DAQ products offering resolutions up to 24-bit while some of the higher speed, lower resolution products are even challenging the performance of low end digital oscilloscopes.

1.2 Typical Data Acquisition System

Figure 1.1 Block diagram of DAS

The

figure depicts the two important features of a data acquisition system:

Signals are input to a sensor, conditioned, converted into bits that a computer can read, and analyzed to extract meaningful information. Data from a computer is converted into an analog signal and output to an actuator. 13 | P a g e

The ideal solution for a data acquisition system is often to use a central computer to control the system and to collect the data, store and process it. This can be done by collecting data through microcontroller and save that data in personal computer. Further on connecting that personal computer to Wi-Fi we can share the recorded data. There are some free utilities such as opera through which its possible to share data over Internet. Not only sharing, but even we can control the equipments by remote desktop the particular computer.

The standard data acquisition system (DAS) contains three elements, acquisition hardware, storage unit and data transmission method. Acquisition hardware plays a key role in the system which decides the performance of DAS. Most of the research is using personal computer as acquisition hardware. Further on with new technique the standard personal computer to high speed personal computer for better performance of data processing and transferring to storage unit. But the microcontroller based DAS is more popular platform since its low in cost and suitable for simple and small application. Now days there are no serial ports in net books or laptops. Instead of that there are USB ports. Also data transmission speed is more as compared with serial ports. So to collect the data form acquisition hardware and store it in net book, the communication between them can only be done by USB. USB advantages for data acquisition: Not only has USB proved itself an ideal platform for many mainstream computer applications, but it also offers many advantages for data acquisition systems. The advantages include aspects including: USB allows much faster speeds than RS232 The power for the "sensor" or data acquisition module can be obtained from the computer, simplifying many systems, and especially any portable USB data acquisition systems. USB data acquisition modules can be connected and disconnected without the need to power down the computer USB ports are standard on most PCs these days making it an almost universally available method of connection. It is possible to use USB as well as other data acquisition communication standards together It is possible to expand the connectivity using a USB hub so that several USB data acquisition devices can be connected So we should use the Microcontroller which has USB communication or else serial to USB converter should be used. But for higher data transmission direct USB connection is preferred. Considering the microcontroller with USB communication available in market at a cheaper rate for basic requirement is from the Microchip which is PIC18F4550. Its cost is approximate 350 INR. It has 35 I/O ports, 13 internal ADC converter ports with resolution of 10 bits and lots of other features. If more ports are require then the PICs can be cascaded in master and slave configuration to work together. From this microcontroller data at the ports can be stored in memory card and can also be stored in net book for further operation. 14 | P a g e

1.3 Problems in DASIt is difficult to define a typical data acquisition system as the requirements, and hence the implementations vary so considerably. Although simple solutions may utilize a data logger, these data loggers may not be suitable for data acquisition systems requiring data from a large variety of different sensors to be made and collected and analyzed. The ideal solution for a data acquisition system is often to use a central computer to control the system and to collect the data, store and process it. This can be done by collecting data through microcontroller and save that data in personal computer. In certain case, when area to be monitored is very large then, wired DAS has certain drawbacks which are noted below. System becomes more complex Cost of overall DAS increases More man power is required More time is required for installation Maintenance is difficult If any problem arises it cant be detected easily Hence time is wasted in finding the problem

The best way of solving this problem is going for WIRELESS DATA ACQUISITION SYSTEM which is cost effective choice. So to solve this problem we can transmit the signals from various sensors to central unit using wireless transmission.

15 | P a g e

2. REVIEW OF LITERATUREThere are a number of test equipment choices in the data acquisition market, ranging from PC plug-in cards to standalone data acquisition units. To select the optimal equipment for our application, it is important for us to evaluate our measurement performance needs, including resolution, accuracy, functionality and throughput speeds. With so many choices available today, we will want to choose a flexible solution that can grow in tandem with our application, so we can protect our investment in the future [12]. Different types of Data Acquisition systems are: 1 PC Plug-In Cards PC plug-in cards are typically positioned as a low-cost data acquisition solution. These cards are designed to communicate with a PC over its internal bus and have direct access to the PCs internal memory. Manufacturers currently offer PC plug-in cards with a wide range of capabilities, including signal conditioning, stepper motor control, analog input/output, and digital input/output. Typically, the channel count is low with PC plug-in cards due to the physical space available inside the PC. Data acquisition systems that use PC plug-in cards are normally less accurate than stand-alone instruments due to the electrical noise generated by the PC. In addition, PC plug-in cards are generally not very robust and cannot typically handle voltages greater than 10 volts. With PC plug-in data acquisition, you will need signal conditioning components to make ac voltage and temperature measurements. If an application requires signal conditioning, be aware that this will greatly affect the overall cost of the data acquisition system. In fact, the cost of the signal conditioning components could potentially equal the cost of the PC plug-in card. It is also important to note that integrating a PC plug-in card into a PC may not be a straightforward task. Since the card is installed directly into the PC, it is crucial to select interrupt lines or memory addresses that are not reserved for other devices in the PC. 2 Switch Boxes 16 | P a g e

For many design verification and product testing applications, switch boxes are included as a type of data acquisition system. A switch box is typically used to route test signals between the device-under-test and other instrumentation such as oscilloscopes, counters, power supplies, and digital multimeter. Switch boxes are available that can switch signal levels from a few microvolt to several hundred volts, and from dc to several gigahertz. In addition to basic switching, some switch boxes add simple control capabilities. For example, some manufacturers have added digital input/output capabilities, analog output control, and isolated actuators for controlling high-power devices.

3. Stand-Alone Data Loggers Data loggers are used primarily to monitor signals over a period of time in order to identify irregularities that may require attention. Most data loggers also provide a way to graph and analyze the data, which is collected through a PC connection. Although used primarily in the up-front design verification stage of product development, data loggers also are used in-house for environmental-chamber monitoring, component inspection, bench top testing, and process troubleshooting. Since they typically are used in single-instrument applications, data loggers also make great portable field-testing instruments. Some data loggers have the ability to perform mathematical operations on the measured data, compare the measured data against user-defined limits, and output signals for control operations. For example, when measuring temperature, signal conditioning or linearization must be applied before the measured data is useful. If the data logger has these built-in capabilities, a computer may not be at all necessary. Most data loggers also have a communications interface (GPIB, USB or LAN) to allow measurement data to be down-loaded to a PC in real-time or after a specific test is completed. If the application requires real-time downloading of the measurement data, the PC must continuously monitor the data logger, resulting in the loss of the data loggers stand-alone benefits. If the data logger has its own internal data storage capability, or access to an external storage device such as a disk drive, then you can download the measurements for analysis at a later time. Note that a low-cost data logger with fewer than 20 channels and a relatively low scan rate is adequate for many data logging applications. For greater flexibility and functionality, select a data logger that can operate as a standalone instrument, can be easily upgraded, and can be connected to a PC. A data logger should also have plug-in slots and the ability to measure different types of input signals without external signal conditioning. All the above mentioned types available in market are quite costly and are complex. Their installation and maintenance require expertise of the system. In our project we have designed a DAS which include all the above advantages as well as it easy to install and maintain. Due to wireless connection, its cost is much less and it does not require any additional network setup because of Wi-Fi. All the industries already have Wi-Fi 17 | P a g e

connection, so we just need to add our system in that network, which not a difficult job. If any problem arises it is very easy to detect and solve the problem.

3. WIRELESS DATA ACQUISITION SYSTEMWireless data acquisition system is based on wireless sensors network principal. A wireless sensor network (WSN) consists of spatially distributed autonomous sensors to monitor physical or environmental conditions, such as temperature, sound, vibration, pressure, humidity, motion or pollutants and to cooperatively pass their data through the network to a main location[1]. The more modern networks are bi-directional, also enabling control of sensor activity. The development of wireless sensor networks was motivated by military applications such as battlefield surveillance; today such networks are used in many industrial and consumer applications, such as industrial process monitoring and control, machine health monitoring, and so on. The WSN is built of "nodes" from a few to several hundreds or even thousands, where each node is connected to one (or sometimes several) sensors. Each such sensor network node has typically several parts: a radio transceiver with an internal antenna or connection to an external antenna, a microcontroller, an electronic circuit for interfacing with the sensors and an energy source, usually a battery or an embedded form of energy harvesting. In this project we have replaced transmission of every sensor into group of sensors with single transmitter [3].

3.1 Structure of WDAS in briefThe wireless data acquisition system is outlined in fig

18 | P a g e

Figure 3.1 Structure of WDAS

The processor board collects status of various sensors and updates all measurements and sends that data to host PC with USB communication. PC logs this data and stores it with time and date. PCs in the network communicate with host PC through wireless communication. Data log on host PC is shared using file transfer protocol (FTP), opera unit and web hosting. For real time viewing the data log on internet, PHP web page hosting can be done. The work of collecting data, monitoring and processing is done by host PC.

3.2 Wireless

TechnologyWireless technology and wireless networks are widely used today, but its quite new in industrial automation systems. There are different technologies and wireless standards available[13], [14]: Infrared Wireless USB Bluetooth ZigBee (IEEE 802.15.4) 19 | P a g e

Wi-Fi (IEEE 802.11)

The Figure below compares the different wireless technologies: Table 1 Out of these technologies the cheapest and effective way of wireless communication is through Wi-Fi. We just need to collect the data and share it over network. Wi-Fi data acquisition is an extension of PC-based data acquisition to measurement applications where cables are inconvenient or uneconomical.

3.3 Why only Wi-Fi? Wide bandwidth Ease of installation No line of sight required. In industrial areas Wi-Fi network is already installed, so no any additional installation is required to create a network. Error detection and correction is easy. Secured

3.4 Block Diagram of Wireless Data Acquisition System20 | P a g e

WDAS can be used for various applications such as in industry for automation or for monitoring process, medical for observing the patient under test, security system, robotics etc. In our project we have developed system for robotics having some basic sensors such as Ultrasonic sensor, PIR sensor, GPS, temperature sensor, IR based obstacle sensors, batteries. So considering these sensors the block diagram of our project wireless data acquisition system is shown bellow.

Figure 3.2 Block diagram WDAS

In the figure above the most important part is microcontroller and the host pc. All the sensors in the network are connected to the 21 | P a g e

microcontroller PIC 18F4550.this microcontroller has built in 13 channel ADC with 10 bit of resolution, so external ADC is not required resulting in less complexity circuit and reduces overall cost of the system. Also this microcontroller provides boot uploder. Using this we can reprogram microcontroller without removing it from circuitry using USB communication. This microcontroller collects the data from its ports and processed it for transmitting to host PC using USB communication. PC logs this data and stores it with date and time. The data stored in PC can be share with other computers in the network using Wi-Fi. All the PCs in the network are communicated through Wi-Fi. Files can be transferred by file transfer protocol (FTP), web hosting and opera unit. This data can be viewed in real time due to the use of PHP. PHP is a scripting language for creating dynamic web pages. As all PCs are communicated wirelessly, the data can be viewed remotely. In industrial area where the span of area is more, we can install WDAS at different unite and can monitor all the WDAS system seating at masters computer/central computer or any other computer in network or the PC having internet connectivity. This can be done by creating a star network. The system to cover larger area by dividing area in units is shown below [19].

22 | P a g e

3.4.1 PIC18F4550 Microcontroller

The better way of selecting microcontroller is first to list out the sensors which are to be interface and there nature of output and input of the signal required. In case if analog signal is produced at sensors output, we require analog to digital converter to convert the data in digital form for logging purpose. We can use analog to digital converter externally or else we can select the microcontroller having inbuilt ADC. The best solution is to select microcontroller which has internal ADC. This will reduce complexity of the circuit and will reduce the overall circuit structure. Second thing is the interfacing required. In our project we required a microcontroller to interface it with PC for data logging and sharing over a network and on internet. Now days there are no laptops and notebooks having RS232. This is due to popularity of USB communication. As a result RS232 communication has become outdated. So we require a microcontroller which could support USB communication. The third think is the number of ports required. The microcontroller should provide require number of ports. If not it should support master and slave configuration so that the slave microcontroller can be use for interfacing the other sensors. Also we should consider the memory requirement of microcontroller speed and power consumption [5]. Considering all these things the best option found out is PIC18F4550 microcontroller. PIC is a family of modified Harvard architecture microcontrollers made by Microchip Technology. The name PIC initially referred to "Peripheral Interface Controller". PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability. Microchip produces microcontroller supporting 12, 13, 14, 16 and 32 bit data processing. PIC18F4550 is from PIC18 family supporting 8bit processing. PIC18F4550 is ideal for low power (nanoWatt) and connectivity applications that benefit from the availability of three serial ports: FS-USB (12Mbit/s), IC and SPI (up to 10Mbit/s) and an asynchronous (LIN capable) serial port (EUSART). It has large amounts of RAM memory for buffering and Enhanced Flash program memory make it ideal for embedded control and monitoring applications that require periodic connection with a (legacy free) personal computer via USB for data upload/download and/or firmware updates. It supports boot uploader. Through which PIC 23 | P a g e

microcontroller can be reprogrammed without removing it from circuit via USB communication. Once boot uploader is loaded in microcontroller, we dont require any external programming kit to reprogram it. The cost of microcontroller in Indian market is around 350. While seeing to its features and application is cheaper. It can be programmed in C Compiler Optimized Architecture with optional Extended Instruction Set. The program memory can be erase/Write cycle up to 100,000 of time. While data EEPROM can be Erase/Write cycle up to 1,000,000 times.

3.4.1.1 PIC18F4550 Microchip High-Performance, Enhanced Flash, USB Microcontrollers with nanoWatt Technology Features Two-Speed Oscillator Start-up Universal Serial Bus Features: USB V2.0 Compliant Low Speed (1.5Mb/s) and Full Speed (12 Mb/s) Supports Control, Interrupt, Isochronous and Bulk Transfers Supports up to 32 Endpoints (16 bidirectional) 1-Kbyte Dual Access RAM for USB On-Chip USB Transceiver with On-Chip Voltage Regulator Interface for Off-Chip USB Transceiver Streaming Parallel Port (SPP) for USB streaming transfers (40/44-pin devices only) Power-Managed Modes: Run: CPU on, peripherals on Idle: CPU off, peripherals on Sleep: CPU off, peripherals off Idle mode currents down to 5.8A typical Sleep mode currents down to 0.1A typical Timer1 Oscillator: 1.1A typical, 32 kHz, 2V Watchdog Timer: 2.1A typical Flexible Oscillator Structure: Four Crystal modes, including High Precision PLL for USB Two External Clock modes, up to 48 MHz Internal Oscillator Block: - 8 user-selectable frequencies, from 31 kHz to 8 MHz - User-tunable to compensate for frequency drift

Secondary Oscillator using Timer1 @ 32 kHz Dual Oscillator options allow microcontroller and USB module to run at different clock speeds Fail-Safe Clock Monitor: - Allows for safe shutdown if any clock stops Peripheral Highlights: High-Current Sink/Source: 25 mA/25 mA Three External Interrupts 24 | P a g e

Four Timer modules (Timer0 to Timer3) Up to 2 Capture/Compare/PWM (CCP) modules: - Capture is 16-bit, max. resolution 5.2 ns (TCY/16) - Compare is 16-bit, max. resolution 83.3 ns (TCY) - PWM output: PWM resolution is 1 to 10-bit Enhanced Capture/Compare/PWM (ECCP) module: - Multiple output modes - Selectable polarity Special Microcontroller Features: C Compiler Optimized Architecture with optional Extended Instruction Set 1,000,000 Erase/Write Cycle Data EEPROM Program Memory typical Memory typical 100,000 Erase/Write Cycle Enhanced Flash Flash/Data EEPROM Retention: > 40 years Self-Programmable under Software Control Priority Levels for Interrupts 8 x 8 Single-Cycle Hardware Multiplier Extended Watchdog Timer (WDT): - Programmable period from 41 ms to 131s Programmable Code Protection Single-Supply 5V In-Circuit Serial Programming (ICSP) via two pins In-Circuit Debug (ICD) via two pins

- Programmable dead time - Auto-shutdown and auto-restart Enhanced USART module: - LIN bus support Master Synchronous Serial Port (MSSP) module supporting 3-wire SPI (all 4 modes) and I2C Master and Slave modes 10-bit, up to 13-channel Analogto-Digital Converter module (A/D) with Programmable Acquisition Time Dual Analog Comparators with Input Multiplexing

Optional dedicated ICD/ICSP port (44-pin devices only) Wide Operating Voltage Range (2.0V to 5.5V) 100,000 Erase/Write Cycle Enhanced Flash

25 | P a g e

3.4.1.2 PIN diagram and ArchitectureFigure 3.3 Pin configuration of PIC

26 | P a g e

Figure 3.4 PIC block diagram

3.4.2. Ultrasonic Distance Measurement Sensor 27 | P a g e

Ultrasound is cyclic sound pressure with a frequency greater than the upper limit of human hearing. Ultrasound is thus not separated from "normal" (audible) sound based on differences in physical properties, only the fact that humans cannot hear it. So this range of frequency is used for obstacle detection purpose based on radar or sonar which evaluates attributes of a target by interpreting the echoes from radio or sound waves respectively. Ultrasonic sensors generate high frequency Ultrasound waves and evaluate the echo which is received back by the sensor. Sensors calculate the time interval between sending the signal and receiving the echo to determine the distance to an object. Systems typically use a transducer which generates sound waves in the ultrasonic range, above 18,000 hertz, by turning electrical energy into sound, then upon receiving the echo turn the sound waves into electrical energy which can be measured and displayed.

Figure 3.5 Ultrasonic sensor

3.4.2.1 Construction and WorkingUltrasonic sensor consists of two units, namely the transmitter unit and receiver unit. Transmitter and receiver unit structure is simple a piezoelectric crystal is connected with mechanical anchors and only connected with the diaphragm vibrator, alternating voltage with a frequency of 40 kHz 400 kHz are given on the metal plate. The atomic structure of the piezoelectric crystal will contract (binding), expanded or shrunk to the polarity of applied voltage, and is called the piezoelectric effect. Contractions that occur forwarded to the diaphragm resulting in an ultrasonic vibrator emitted into the air (the surroundings), and the reflection of ultrasonic waves will occur when there is a particular object, and the reflection of ultrasonic waves to be received back by the receiver sensor units. Furthermore, the sensor unit will cause the diaphragm vibrator receiver will vibrate and the piezoelectric effect produces an 28 | P a g eFigure 3.6 Construction of ultrasonic sensor

alternating voltage with the same frequency. Large amplitude signals generated by receiver sensor units depend on the distant object detected nearby and the quality of the sensor transmitter and receiver sensors [8].

3.4.2.2 Selection of transducerWhile selecting transducer for a given application, it is important to be aware of the principles of sound propagation. Since sound is a wave phenomenon, its propagation and directivity are related to its wavelength (). A typical radiation power pattern for either a Generator or receiver of waves is shown in Figure 3.7. Due to the reciprocity of transmission and reception, the graph portrays both power radiated along a given direction (in case of wave production), and the sensitivity along a given direction (in case of wave reception). The angular, half-width (/2) of the main beam is given by: /2 = sin-1 (0.51/D ) for -3dB /2 = sin-1 (0.7/ D ) for -6dB = c / fFigure 3.6 Radiation pattern of Ultrasonic

Where D is the effective diameter of the flexure diaphragm, is the wavelength, c the velocity of sound (344 meter/second in air at 20 C), and f is the operating frequency. The above relationship applies if < D. For D, the power pattern tends to become spherical in form. Thus, narrow beams and high directivity are achieved by selecting D large in relation to . So for covering angle of 60 with a main beam (-6dB) Figure 3.7 Ultrasonic we have to select a pair of ultrasonic working at transmitter receiver 40KHz frequency and having effective diameter of 23mm (1mm wall thickness).

3.4.2.3 Ultrasonic Echo RangingUltrasonic ranging systems are used to determine the distance to an object by measuring the time required for an ultrasonic wave to travel to the object and return to the source. This technique is frequently referred to as echo ranging. The distance to the object may be related to the time it will take for an ultrasonic pulse to propagate the 29 | P a g e

distance to the object and return to the source by dividing the total distance by the speed of sound which is 344 meters/second or 13.54 inches/millisecond. Below is a block diagram that illustrates the basic design concept and functional elements in a typical ranging system. With increasing in distance between obstacle and Ultrasonic sensor, the accuracy gets decreases. Ideally it can work for detecting obstacle at a distance up to 4m. It can detect obstacle which are more than 4m distance, but its accuracy get decreases.

Figure 3.8 Ultrasonic block diagram

30 | P a g e

The driving signal can be either a tone burst of suitable burst number, which depends on the rising time of transceiver, or a pulse that will result in the transmission of a few cycles of Ultrasonic energy. MCU starts a counter when tone burst starting, which is stopped by the detected returning echo. The count is thus directly proportional to the propagation time of the ultrasonic wave. The matching circuit tunes out the imaginary part of transceiver and also plays as an impedance matching bridge for maximizing energy transfer. The returning ultrasonic echo is usually very weak and the key to designing a good ranging system is to utilize a high Q tuned frequency amplifier stage that will significantly amplify any signal at the frequency of the ultrasonic echo while rejecting all other higher or lower frequencies. Another useful technique is to make the gain of the echo amplifier increase with time such that the amplifier gain compensates for the proportional decrease in the signal strength with distance or time. This amplifier is called as TGC (Time Controlled Gain) Amplifier.

3.4.2.4 Calculation to measure distance of obstacleThe distance of the obstacle can be measured by calculating time required for travelling of sound signal using simple formula as below. Distance = (Echo pulse width high time * Sound Velocity (340M/S)/2) or Distance in cm = (Echo pulse width high time (in uS)*0.017)

3.4.2.5 Specificationso Working 5V(DC) o Working 15mA o Working frequency : 40 KHZ 31 | P a g e Current : Voltage : o Output: 0-5V (Output high when obstacle

detected in range) o Beam Angle : Max 60 degree

o Distance 400cm

:

2cm

-

o Echo signal : PWM signal (time required for sound signal to travel twice between source and obstacle) o Size 45mm*20mm*15 mm :

o Accuracy : 0.3cm o Input trigger signal : 10us impulse TTL

3.4.3 Passive Infrared Sensor A Passive Infrared sensor (PIR sensor) is an electronic device that measures infrared (IR) light radiating from objects in its field of view. All objects above absolute zero emit energy in the form of radiation. Usually infrared radiation is invisible to the human eye but can be detected by 32 | P a g e

electronic devices designed for such a purpose. The term passive in this instance means that the PIR device does not emit an infrared beam but merely passively accepts incoming infrared radiation. Infra meaning below our ability to detect it visually, and Red because this color represents the lowest energy level that our eyes can sense before it becomes invisible. Thus, infrared means below the energy level of the color red and applies to many sources of invisible energy [4].

3.4.3.1 DesignInfrared radiation enters through the front of the sensor, known as the sensor face. At the core of a PIR sensor is a solid state sensor or set of sensors, made from an approximately 1/4 inch square of natural or artificial pyroelectric materials, usually in the form of a thin film, out of gallium nitride (GaN), cesium nitrate (CsNO3), polyvinyl fluorides, derivatives of phenylpyrazine, and cobalt phthalocyanine. (See pyroelectric crystals.) Lithium tantalate (LiTaO3) is a crystal exhibiting both piezoelectric and pyroelectric properties [9]. *Pyroelectricity: Pyroelectricity (from the Greek pyr, fire, and electricity) is the ability of certain materials to generate a temporary voltage when they are heated or cooled. A pyroelectric material generates an electric charge in response to a thermal energy flow through its body. Since all pyroelectrics are also piezoelectrics, the absorbed heat causes the front side of the sensing element to expand. The resulting thermally induced stress leads to a development of piezoelectric charge on the element electrodes. This charge is manifested as voltage across the electrodes deposited on opposite side of the material. Fig: Simplified model of a pyroelecric effect as a secondary effect of piezoelectricity. Initially, the element has a uniform temperature (a); upon exposure to thermal radiation its front side warms up and expands, causing a stress induced charge (b)Figure 3.9 Simplified model of pyroelectric effect

33 | P a g e

3.4.3.2 Lenses Besides sensing element, a PIR detector needs afocusing device. Some detectors employ parabolic mirrors while the Fresnel plastic lenses become more and more popular because they are inexpensive, may be molded in any desirable shape and in addition to focusing, act as windows to protect the interior of the sensor from outside moisture and pollutants.

3.4.3.3 PIR Based motion detectorIn a PIR-based motion detector, the PIR sensor is typically mounted on a printed circuit board containing the necessary electronics required to interpret the signals from the pyroelectric sensor chip. The complete assembly is contained within a housing mounted in a location where the sensor can view the area to be monitored. Infrared energy is able to reach the pyroelectric sensor through the window because the plastic used is transparent to infrared radiation (but only translucent to visible light). This plastic sheet also prevents the intrusion of dust and/or insects from obscuring the sensor's field of view, and in the case of insects, from generating false alarms. The window may have multiple Fresnel lenses molded into it. Alternatively, some PIDs are manufactured with internal plastic, segmented parabolic mirrors to focus the infrared energy. Where mirrors are used, the plastic window cover has no Fresnel lenses molded into it. The PID can be thought of as a kind of infrared camera that remembers the amount of infrared energy focused on its surface. Once power is applied to the PID, the electronics in the PID shortly settle into a quiescent state and energize a small relay. This relay controls a burglar alarm control panel. If the amount of infrared energy focused on the pyroelectric sensor changes within a configured time period, the device will switch the state of the alarm relay.

34 | P a g e

3.4.3.4 Construction and Working of PIRAll living objects emit energy. This is infrared radiation with wavelengths ~10um (micrometers). This radiation is invisible to the human eye but can be detected by the Passive infrared sensor (PIR). The PIR sensor is a electronic device with two sensitive areas allocated under infrared filter window. This arrangement cancels signals caused by the sunlight, vibration and changes in ambient temperature. A man crosses the horizontal plane in front of the mounted sensors activates the first and then the second detector sensitive area. All other sources of infrared radiation do not act on the behavior of the sensor because they affect on both sensitive elements simultaneously.Figure 3.10 Construction of PIR

Human motion leads to a change of emitted infrared energy which is detected by the PIR sensor. The sensor reacts to this change and provides a low-frequency (~10Hz) small amplitude signal. This signal amplified by the Operational Amplifier and digitized by the Analog to Digital Converter embedded into the MCU. Passive infrared sensor can sense the changes of the infrared energy within small distances till 1m. For reliable detection of human movement at the long distance it is necessary to use a Fresnel lens. Fresnel lens allows focusing infrared radiation on the sensor surface and reveals the presence of a human at a 7m distance. The lens divides the entire territory covered by a sensor on the sectors. Any movement between the sectors leads to a change in infrared energy, registered by two sensitive zones of the PIR sensor. When a person passes in front of a motion sensor, the signal from its output will initially be positive (when a person crosses the first sensor element) and then negative (when a person crosses the second sensor element). This is indicated on the Picture 3 with two zones 1 and 2. During the passage of these areas by 35 | P a g e

human in the opposite direction, the output signal from the sensor is inverted.Figure 3.11 Working principle of PIR

3.4.3.5 Specificationso Supply: 5V Dc to 9V DC o Detection range: 6meters o Output: 5V TTL o Static current: 50uA o Sensitivity: Presettable o Settling time: 60 seconds o Trigger:H-Yes, L-No o Block time: 2.5 S(default) o Delay time: 5 S(default) o Sentry Angle:< 110 degree o Size: Length32mm, Width 24mm, Thickness 26mmFigure 3.12 PIR

36 | P a g e

Calibration The PIR Sensor requires a warm-up time in order to function properly. This is due to the settling time involved in learning its environment. This could be anywhere from 10-60 seconds. During this time there should be as little motion as possible in the sensors field of view. Sensitivity The PIR Sensor has a range of approximately 20 feet. This can vary with environmental conditions. The sensor is designed to adjust to slowly changing conditions that would happen normally as the day progresses and the environmental conditions change, but responds by making its output high when sudden changes occur, such as when there is motion. Applications: PIR sensors are used in many applications. They are used on television sets and television accessory devices, such as VCRs and DVD players, to detect infrared light coming from a television remote. PIR sensors are also used as motion detectors at most public doorways in grocery stores, hospitals, and libraries. PIR sensors can also be used for military purposes such as laser range-finding, night vision, and heat-seeking missiles. Advantages PIR sensors have several important advantages. They detect infrared light from several feet/yards away, depending on how the device is calibrated. PIR sensors are generally compact and can be fitted into virtually any electronic device. Also, they do not need an external power source because they generate electricity as they absorb infrared light. Disadvantages Although PIR sensors can be advantageous, they also have several disadvantages. PIR sensors can only receive infrared light and cannot emit it like other types of infrared sensors. They can be expensive to purchase, install, and calibrate as well.

3.4.4 IR Based Obstacle Sensor sInfrared (IR) light is electromagnetic radiation with a wavelength longer than that of visible light, measured from the nominal edge of visible red light at 0.74 micrometers (m), and extending conventionally to 300 m. These wavelengths correspond to a frequency range of approximately 1 to 400 THz, and include most of the thermal radiation emitted by objects near room temperature. Much of the energy from the Sun arrives on Earth in the form of infrared radiation .

Figure 3.13 IR spectrum

There are certain transducers, which emits and sense IR rays. The principal is just to transmit IR rays and sense the reflect signal if there is any obstacle. Similarly if there is any other IR signal transmitting at one end can be can be decoded at other end. For transmitting Infrared we use IR LDR and sensing we use IR receiver. Inexpensive infrared receiver chips are available. The receivers are sensitive to oscillations several kilohertz to either side, although reception distance improves with a better signal to start with. If used for object detection, the signal needs to travel the distance to the object, bounce off the object, and then travel the distance back to the receiver. So, distance becomes a factor.Figure 3.14 IR Obstacle detection

3.4.4.1 Working

When IR LED is given a supply it emits IR light. This light when strikes a target it gets reflected, whose proportional depends on distance of obstacle and color of obstacle. For white color reflection is more and for black surface its less. There it is picked up with phototransistor. This phototransistor can be used to measure proportional of reflected IR light. Initially resistance of photo transistor is very high. Depending on the proportion of IR light incident on its resistance gets reduce. To Figure 3.15 IR obstacle detector circuit measure change in resistance, phototransistor is given a VCC supply. According to ohms law, change in resistance results change in voltage drop across it. This Voltage in measured which is proportional to picked up light intensity. Comparator or ADC is used to convert it to digital form and decide, if there is an obstacle in front of us. For example if 5 Volts supply is used: 4.5 Volts mean obstacle is far, and 1 Volt means obstacle is close. Since infrared spectrum lies between visible and microwave portion of electromagnetic spectrum, all the signals received by normal IR receiver are detected as obstacle. This will create a problem. To solve this problem we can select a receiver which will allow a range of frequency as that of transmitter. This can be done by selecting TSOP1738 IR receiver that will allow only 38 KHz frequency and filter out all other frequencies. So to generate a frequency of 38 KHz at transmitter we need an oscillator which will drive it. For feeding 38 KHz oscillation to IR LED, 555 timer IC is used.

3.4.4.2 Circuit description & working for oscillatorIn the circuit, 555 IC works as oscillator. This circuit provides oscillation of 38KHZfrequency. This type of relaxation oscillator for generating stabilized square wave output

waveforms of either a fixed frequency of up to 500 KHz or of varying duty cycles from 50 to 100%. Here 555 IC is working as Astable Oscillator [18]. In astable mode, the 555 timer puts out a continuous stream of rectangular pulses having a specified frequency. Resistor R1 is connected between VCC and the discharge pin (pin 7) and another resistor (R2) is connected between the discharge pin (pin 7), and the trigger (pin 2) and threshold (pin 6) pins that share a common node. Hence the capacitor is charged through R1 and R2, and discharged only through R2, since pin 7 has low impedance to ground during output low intervals of the cycle, therefore discharging the capacitor. In the astable mode, the frequency of the pulse stream depends on the values of R1, R2 and C:[7]

Figure 3.16 Oscillator circuit for IR transmission

The high time from each pulse is given by (t1): and the low time from each pulse is given by (t2): where R1 and R2 are the values of the resistors in ohms and C is the value of the capacitor in farads. The power capability of R1 must be greater than V2cc /R1 Particularly with bipolar 555s, low values of R1 must be avoided so that the output stays saturated near zero volts during discharge, as assumed by the above equation. Otherwise the output low time will be greater than calculated above. After calculation for 38 KHz oscillation using 555IC we get R1= 1K, R2= 10K pot, C1=0.01F, C2= 0.01F, C3=0.1F

Figure 3.17 Waveforms

3.4.4.3 IR transmitter LEDIR transmitter is a transducer which emits the light in form of infra red rays. In our project we are modulating signal in 38 KHz and emit that modulated signal by infra red transducer.Figure 3.18 IR Transmitter LED

Figure 3.19 TSOP1738 IR receiver

3.4.4.4 TSOP1738 IR receiverThe TSOP17: series are miniaturized receivers for infrared remote control systems. PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as IR filter. The demodulated output signal can directly be decoded by a microprocessor. TSOP17.. is the standard IR remote control receiver series, supporting all major transmission codes. In the device number, end 2 numbers indicates the frequency range. In our project we are using TSOP1738, which means that it can operate in range of 38 KHz.

Features of TSOP1738 Photo detector and preamplifier in one package Internal filter for PCM frequency Improved shielding against electrical field disturbance TTL and CMOS compatibility Output active low Low power consumption High immunity against ambient light Continuous data transmission possible (1200 bit/s) Suitable burst length 10 cycles/burst

Features of obstacle sensorFigure 3.20 Block Diagram of TSOP1738

Very cheap Quite reliable Can be used for detection of obstacle for a range up to 12 cm.

Need of IR based obstacle sensor Obstacle sensor is used in industries, automated systems, robots etc. These sensors are available at very cheap rate. So it is widely used. We had used this to detect and measure the distance. This method is quite reliable and at a best rate.

3.4.5 Global Positioning System Introduction to GPS The Global Positioning System (GPS) is a satellite-based navigation system that consists of 24 orbiting satellites, each of which makes two circuits around the Earth every 24 hours. These satellites transmit three bits of information the satellite's number, its position in space, and the time the information is sent. These signals are picked up by the GPS receiver, which uses this information to calculate the distance between it and the GPS satellites. With signals from three or more satellites, a GPS receiver can triangulate its location on the ground (i.e., longitude and latitude) from the known position of the satellites. With four or more satellites, a GPS receiver can determine a 3D position (i.e., latitude, longitude, and elevation). In addition, a GPS receiver can provide data on your speed and direction of

travel. Anyone with a GPS receiver can access the system. Because GPS provides real-time, three-dimensional positioning, navigation, and timing 24 hours a day, 7 days a week, all over the world, it is used in numerous applications, including GIS data collection, surveying, and mapping. What attracts us to GPS is

The relatively high positioning accuracies, from tens of meters down to the millimeter level. The capability of determining velocity and time, to an accuracy commensurate with position. The signals are available to users anywhere on the globe: in the air, on the ground, or at sea. It is a positioning system with no user charges that simply requires the use of relatively low cost hardware. It is an all-weather system, available 24 hours a day. The position information is in three dimensions, that is, vertical as well as horizontal information is provided.

3.4.5.1 How it worksGPS satellites circle the earth twice a day in a very precise orbit and transmit signal information to earth. GPS receivers take this information and use triangulation to calculate the user's exact location. Essentially, the GPS receiver compares the time a signal was transmitted by a satellite with the time it was received. The time difference tells the GPS receiver how far away the satellite is A GPS receiver must be locked on to the signal of at least three satellites to calculate a 2D position (latitude and longitude) and track movement. With four or more satellites in view, the receiver can determine the user's 3D position (latitude, longitude and altitude).

3.4.5.2. Navigation equationsThe x, y, and z components of satellite position and the time sent are designated as [xi, yi, zi, ti] where the subscript i denotes the satellite and has the value 1, 2, ..., n, where Knowing when the message was received , the receiver computes the message's transit time as . Note that the receiver indeed knows the reception time indicated by its on-board clock, rather than . Assuming the message traveled at the speed of light (c) the

distance traveled is (tr ti)c. Knowing the distance from receiver to satellite and the satellite's position implies that the receiver is on the surface of a sphere centered at the satellite's position. Thus the receiver is at or near the intersection of the surfaces of the spheres. In the ideal case of no errors, the receiver is at the intersection of the surfaces of the spheres. Let b denote the clock error or bias, the amount that the receiver's clock is off. The receiver has four unknowns, the three components of GPS receiver position and the clock bias [x, y, z, b]. The equations of the sphere surfaces are given by:

or in terms of pseudoranges,

, as

.These equations can be solved by algebraic or numerical methods .

3.4.5.3 TrilaterationTrilateration is used to determine the position based on three satellite's pseudoranges. In the usual case of two intersections, the point nearest the surface of the sphere corresponding to the fourth satellite is chosen. Let d denote the signed distance from the receiver position to the sphere around the fourth satellite. The notation, d(correction) shows this as a function of the correction, because it changes the pseudoranges. The problem is to determine the correction such that d(correction) = 0. This is the familiar problem of finding the zeroes of a one dimensional non-linear function of a scalar variable.

Certain atmospheric factors and other sources of error can affect the accuracy of GPS receivers. Users can also get better accuracy with Differential GPS (DGPS), which corrects GPS signals to within an average of three to five meters. The U.S. Coast Guard operates the most common DGPS correction service. This system consists of a network of towers that

receive GPS signals and transmit a corrected signal by beacon transmitters. In order to get the corrected signal, users must have a differential beacon receiver and beacon antenna in addition to their GPS.

3.4.5.4 The GPS satellite systemThe 24 satellites that make up the GPS space segment are orbiting the earth about 12,000 miles above us. They are constantly moving, making two complete orbits in less than 24 hours. These satellites are travelling at speeds of roughly 7,000 miles an hour. GPS satellites are powered by solar energy. They have backup batteries onboard to keep them running in the event of a solar eclipse, when there's no solar power. Small rocket boosters on each satellite keep them flying in the correct path.

Figure 3.21 GPS satellite system

3.4.5.5 Signals in GPSGPS satellites transmit two low power radio signals, designated L1 and L2. Civilian GPS uses the L1 frequency of 1575.42 MHz in the UHF band. The signals travel by line of sight, meaning they will pass through clouds, glass and plastic but will not go through most solid objects such as buildings and mountains. A GPS signal contains three different bits of information - a pseudorandom code, ephemeris data and almanac data. The pseudorandom code is simply an I.D. code that identifies which satellite is transmitting information. You can view this number on your Garmin GPS unit's satellite page, as it identifies which satellites it's receiving. Ephemeris data, which is constantly transmitted by each satellite, contains important information about the status of the satellite (healthy or unhealthy), current date and time. This part of the signal is essential for determining a position. The almanac data tells the GPS receiver where each GPS satellite should be at any time throughout the day. Each satellite transmits almanac data showing the orbital information for that satellite and for every other satellite in the system.

3.4.5.6 Sources of GPS signal errorsFactors that can degrade the GPS signal and thus affect accuracy include the following:

Ionosphere and troposphere delays - The satellite signal slows as it passes through the atmosphere. The GPS system uses a built-in model that calculates an average amount of delay to partially correct for this type of error. Signal multipath - This occurs when the GPS signal is reflected off objects such as tall buildings or large rock surfaces before it reaches the receiver. This increases the travel time of the signal, thereby causing errors. Receiver clock errors - A receiver's built-in clock is not as accurate as the atomic clocks onboard the GPS satellites. Therefore, it may have very slight timing errors. Orbital errors - Also known as ephemeris errors, these are inaccuracies of the satellite's reported location. Number of satellites visible - The more satellites a GPS receiver can "see," the better the accuracy. Buildings, terrain, electronic interference, or sometimes even dense foliage can block signal reception, causing position errors or possibly no position reading at all. GPS units typically will not work indoors, underwater or underground. Satellite geometry/shading - This refers to the relative position of the satellites at any given time. Ideal satellite geometry exists when the satellites are located at wide angles relative to each other. Poor geometry results when the satellites are located in a line or in a tight grouping. Intentional degradation of the satellite signal - Selective Availability (SA) is an intentional degradation of the signal once imposed by the U.S. Department of Defense. SA was intended to prevent military adversaries from using the highly accurate GPS signals. The government turned off SA in May 2000, which significantly improved the accuracy of civilian GPS receivers.

3.4.5.7 GPS Module in our ProjectIn our project we have used GPS Receiver MT3318 USB Module. GPS Receiver MT3318 USB Module is based on the MediaTek MTK MT3318 chipset. It has active patch antenna from Cirocomm. It can track 51 satellites simultaneously. It can be directly connected to the PC via USB port. It has onboard FT232 USB to serial converter of interfacing GPS with the PCs USB port. GPS receiver is mounted on the PCB along with the 3.3V low drop voltage regulator, Figure 3.23 GPS MT3318 USB Module transmit, receive and power indication LEDs, Schmitt triggers based buffer for 5V to 3.3V logic level conversion and FT232 USB to serial converter. GPS receiver gives data output in standard NMEA format with update rate of 1 second at 9600 bps. Receiver has onboard battery for memory backup for quicker acquisition of GPS satellites. GPS module is powered by USB port of the PC.

3.4.5.8 Specifications Supply: 5V, 40mA, Built in RTC power battery (3V) for location data retention Chipset: MTK MT3318 Antenna: High gain GPS patch antenna from Cirocomm Data output: CMOS UART interface at 3.3V Protocol: NMEA-0183@9600bps (Default) at update rate of 1 second. Protocol message support: GGA, GSA, GSV,RMC, VTG No. of Satellite simultaneously tracked: 51 Tracking Sensitivity: On-module antenna : -157dBm Position Accuracy : All Programs > Accessories > Remote Desktop Connection

Figure 3.32 Connecting to remote desktop - step1

2. In the Remote Desktop Connection window, Type the address of the remote computer in the Computer: text box and then click Connect.

Figure 3.33 Connecting to remote desktop - Step2

3. After clicking on connect you will be asked for User name and password. Just enter it and get connected to remote computer. 3.4.8 Software Development For WDAS Software design is a process of problem solving and planning for a software solution. After the purpose and specifications of software are

determined, software developers will develop a plan for a solution. It includes low-level component and algorithm implementation issues as well as the architectural view. Design considerations while programming: There are many aspects to consider in the design of a piece of software. The importance of each should reflect the goals the software is trying to achieve. Some of these aspects are

Compatibility - The software is able to operate with other products that are designed for interoperability with another product. For example, a piece of software may be backward-compatible with an older version of itself. Extensibility - New capabilities can be added to the software without major changes to the underlying architecture. Fault-tolerance - The software is resistant to and able to recover from component failure. Maintainability - The software can be restored to a specified condition within a specified period of time. For example, antivirus software may include the ability to periodically receive virus definition updates in order to maintain the software's effectiveness. Modularity - the resulting software comprises well defined, independent components. That leads to better maintainability. The components could be then implemented and tested in isolation before being integrated to form a desired software system. This allows division of work in a software development project. Packaging - Printed material such as the box and manuals should match the style designated for the target market and should enhance usability. All compatibility information should be visible on the outside of the package. All components required for use should be included in the package or specified as a requirement on the outside of the package. Reliability - The software is able to perform a required function under stated conditions for a specified period of time. Reusability - the software is able to add further features and modification with slight or no modification. Robustness - The software is able to operate under stress or tolerate unpredictable or invalid input. For example, it can be designed with a resilience to low memory conditions.

Security - The software is able to withstand hostile acts and influences. Usability - The software user interface must be usable for its target user/audience. Default values for the parameters must be chosen so that they are a good choice for the majority of the users.

Software development for WDAS is divided in two parts. One is developing software for PC to communicate with microcontroller and log the data, where as the other is for the microcontroller for configuring the controller and send the data to PC. The important thing before beginning of programming is to collect all the data for configuring the ports. After that, we need to study the steps in which way communication should be done; data should be fetched and logged in PC.

3.4.8.1 Software developing for microcontroller PIC18F4550Simplicity and ease which higher programming languages bring in, as well as broad application of microcontrollers today, were reasons to incite some companies to adjust and upgrade BASIC programming language to better suit needs of microcontroller programming. This change is for developing applications is faster and easier with all the predefined routines which BASIC brings in, whose programming in assembly would take the largest amount of time. Before going further lets see the basic definitions used in programming Programming language: It is a set of commands and rules according to which we write the program. There are various programming languages such as BASIC, C, Pascal, etc. There are plenty of resources on BASIC programming language out there, so we will focus our attention particularly to programming of microcontrollers. Program: It consists of a sequence of commands written in programming language that microcontroller executes one after another. Compiler is a program run on computer and its task is to translate the original BASIC, C, Pascal code into language of zeros and ones that can be fed to microcontroller. The process of translation of program written in MPLab IDE C language into executive HEX code is shown in the figure below in fig. The program written in C and saved as file program. C is converted by compiler into assembly code (program.asm). The generated assembly code is further translated into executive HEX code which can be written to microcontroller memory. Programmer is a device which we use to transfer our HEX files from computer to microcontroller memory.

Before beginning for writing program for microcontroller we list out the sensors that are to be connected, its format of output, its in digital or analog output. After listing we allocated the ports for sensors. We studied the registers which are to me initializing. For initializing port as simple I/O, A/D converter communications are as follow:

3.4.8.1.1 Simple I/ODepending on the device selected and features enabled, there are up to five ports available. Some pins of the I/O ports are multiplexed with an alternate function from the peripheral features on the device. In be used as a general purpose I/O pin. Each port has three registers for its operation [7]. These TRIS register (data direction register) PORT register (reads the levels on the pins of the device) LAT register (output latch) The Data Latch register (LATA) is useful for read-modify- write operations on the value driven by the I/O pins. By clearing some bit of the TRIS register (bit=0), the corresponding port pin is configured as output. Similarly, by setting some bit of the TRIS register (bit=1), the corresponding port pin is configured as input. This rule is easy to remember 0 = Output, 1 = Input.

Figure 3.34 Simple I/O

Port A and TRISA Register: PORTA is an 8-bit wide, bidirectional port. The corresponding data direction register is TRISA. Reading the PORTA register reads the status of the pins; writing to it will write to the port latch.

Figure 3.35 Port A and TRISA Register

The Data Latch register (LATA) is also memory mapped. Readmodify-write operations on the LATA register read and write the latched output value for PORTA. The RA4 pin is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The RA6 pin is multiplexed with the main

oscillator pin; it is enabled as an oscillator or I/O pin by the selection of the main oscillator in Configuration Register 1H. When not used as a port pin, RA6 and its associated TRIS and LAT bits are read as 0. RA4 is also multiplexed with the USB module; it serves as a receiver input from an external USB transceiver. Several PORTA pins are multiplexed with analog inputs, the analog VREF+ and VREF- inputs and the comparator voltage reference output. The operation of pins RA5 and RA3:RA0 as A/D converter inputs is selected by clearing/setting the control bits in the ADCON1 register (A/D Control Register 1). All other PORTA pins have TTL input levels and full CMOS output drivers. The TRISA register controls the direction of the RA pins, even when they are being used as analog inputs. The user must ensure the bits in the TRISA register are maintained set when using them as analog inputs.

Port B and TRISB Register Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups. This is performed by clearing bit, RBPU (INTCON2). The weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups are disabled on a Power-on Reset.

Figure 3.36 PORTB and TRISB Register

Four of the PORTB pins (RB7:RB4) have an interrupt-on- change feature. Only pins configured as inputs can cause this interrupt to occur. Any RB7:RB4 pin configured as an output is excluded from the interrupt-onchange comparison. Pins, RB2 and RB3, are multiplexed with the USB peripheral and serve as the differential signal outputs for an external USB transceiver (TRIS configuration). RB4 is multiplexed with CSSPP, the chip select function for the Streaming Parallel Port (SPP) TRIS setting. Similarly we can configure ports C, D and E and their corresponding TRISC, TRISD and TRISE registers respectively.

3.4.8.1.2 A/D converterMany electrical signals around us are Analog in nature. That means a quantity varies directly with some other quantity. The first quantity is mostly voltage while that second quantity can be anything like temperature,

pressure, light, force or acceleration. For example in LM35 temperature sensor the output voltage varies according to the temperature, so if we could measure voltage, we can measure temperature [6], [20]. But most of our computer (or Microcontrollers) are digital in nature. They can only differentiate between HIGH or LOW level on input pins. For example if input is more than 2.5v it will be read as 1 and if it is below 2.5 then it will be read as 0 (in case of 5v systems). So we cannot measure voltage directly from MCUs. To solve this problem most modern MCUs have an ADC unit. ADC stands for analog to digital converter. It will convert a voltage to a number so that it can be processed by a digital system like MCU. The ADC takes a VSS-VDD (0-5V on my PIC MCU) DC signal as its input and then converts the voltage to a digital value.PPIC18F4550 has 10 bit ADC module. Using the 10-bit ADC, this means that a voltage level of 0V should be read as 0, and 5V as 1023 (2^10 - 1). The ADC module on the PIC18F4550 has five registers associated with it (page 267 in the datasheet):

Result High Register (ADRESH) Result Low Register (ADRESL) Control Register 0 (ADCON0) Control Register 1 (ADCON1) Control Register 2 (ADCON2)

We will start by configuring the ADCON0 control register. bit 7-6 Unimplemented: Read as 0

Figure 3.37 ADCON0 control register

bit 5-2 CHS3:CHS0: Analog Channel Select bits 0000 = Channel 0 (AN0) 0100 = Channel 4 (AN4) 0001 = Channel 1 (AN1) 0101 = Channel 5 (AN5)(1,2) 0010 = Channel 2 (AN2) 0110 = Channel 6 (AN6)(1,2) 0011 = Channel 3 (AN3) 0111 = Channel 7 (AN7)(1,2)

1000 = Channel 8 (AN8) 1100 = Channel 12 (AN12) 1001 = Channel 9 (AN9) 1101 = Unimplemented(2) 1010 = Channel 10 (AN10) 1110 = Unimplemented(2) 1011 = Channel 11 (AN11) 1111 = Unimplemented(2) bit 1 GO/DONE: A/D Conversion Status bit When ADON = 1: 1 = A/D conversion in progress 0 = A/D Idle bit 0 ADON: A/D On bit 1/0 = A/D converter module is enabled disable Configuring ADCON0 control register ADCON0bits.ADON = 0; // Disable A/D module ADCON0bits.CHS0 = 0; // Select channel 0 (AN0) ADCON0bits.CHS1 = 0; ADCON0bits.CHS2 = 0; ADCON0bits.CHS3 = 0; Only one channel (I/O pin) may be sampled at one time. ADCON0 (page 261 in 18F4550 datasheet) can be used to select the channel. It can also be used to enable the A/D converter module (something that needs to be done before any A/D conversions will take place) and to check whether an A/D conversion has completed. The CHS3:CHS0 (Channel Select) bits are used to select the channel that will be sampled when the GO_DONE bit is set. I'm only using one analog input and so I decided to use channel 0 (AN0), as this will leave the rest of the I/O pins available as digital inputs or outputs. I choose channel 0 by clearing bits CHS3:CHS0 and, since I'm not using any other channels, I will always leave them cleared. If you use multiple channels, just change the CHS3:CHS0 bits to select the channel you want to sample then set the GO_DONE bit to start the sample/conversion process. Next is the ADCON1 register.

Figure 3.38 ADCON1 register

bit 7-6 Unimplemented: Read as 0 bit 5 VCFG0: Voltage Reference Configuration bit (VREF- source) 1 = VREF- (AN2) 0 = VSS bit 4 VCFG0: Voltage Reference Configuration bit (VREF+ source) 1 = VREF+ (AN3) 0 = VDD bit 3-0 PCFG3:PCFG0: A/D Port Configuration Control bits:

Figure 3.39 PCFG register

This register controls which I/O pins are analog and which are digital. As previously mentioned, I chose to use channel 0 so that the rest of the pins would be available as digital I/O. Two bits in the register also determine what the voltage reference source is. ADCON1 configuration:ADCON1bits.VCFG1 ADCON1bits.VCFG0 ADCON1bits.PCFG0 digital ADCON1bits.PCFG1 ADCON1bits.PCFG2 ADCON1bits.PCFG3 = 0; // Use VSS for Vref- source = 0; // Use VDD for Vref+ source = 0; // Make AN0 pin analog and all others = 1; = 1; = 1;

The last configuration register is ADCON2.

Figure 3.40 ADCON2 Register

bit 7 ADFM: A/D Result Format Select bit 1 = Right justified 0 = Left justified bit 6 Unimplemented: Read as 0 bit 5-3 ACQT2:ACQT0: A/D Acquisition Time Select bits 111 = 20 TAD 011 = 6 TAD 110 = 16 TAD 010 = 4 TAD 101 = 12 TAD 001 = 2 TAD 100 = 8 TAD 000 = 0 TAD(1) bit 2-0 ADCS2:ADCS0: A/D Conversion Clock Select bits 111 = FRC (clock derived from 011 = FRC (clock derived from A/D RC oscillator)(1) A/D RC oscillator)(1) 110 = FOSC/64 010 = FOSC/32 101 = FOSC/16 001 = FOSC/8 100 = FOSC/4 000 = FOSC/2

The acquisition time and A/D conversion clock need to be set in ADCON2. The A/D conversion clock (Tad) is the amount of time ittakes the A/D module to convert one bit. It takes 11 Tad to perform the 10bit A/D conversion. According to the datasheet, Tad must be selected to be as short as possible but greater than the minimum Tad (.7us for the 18F4550 p400, parameter 130). TAD can be configured to equal:

2 TOSC 4 TOSC 8 TOSC

16 TOSC 32 TOSC 64 TOSC

TOSC = 1/FOSC, where FOSC is the frequency of your crystal or oscillator. We are running at 20MHz in our PIC Development board so we set prescaler of 32 TOSC. Our FOSC = 20MHz

Therefore our FOSC = 1/20MHz = 50nS 32 TOSC = 32 x 50nS = 1600nS = 1.6uS 1.6uS is more than the minimum requirement. The three bits selecting the acquisition time need to be configured. You can find the formula to calculate the acquisition time in the datasheet, but it's probably sufficient to say that it needs to be about 2.5s. The acquisition time determines how long the channel is sampled before starting the conversion. The acquisition time can be one of the following options:

0 TAD 2 TAD 4 TAD 6 TAD

8 TAD 12 TAD 16 TAD 20 TA

Since my TAD is 32*Tosc =1.6s so we select 2 x TAD as acquisition time. TACQ=2 x TAD =2 x 1.6uS (Replacing TAD= 1.6uS) =3.2uS The acquisition time parameter, used to reduce software overhead, is the amount of Tad cycles to delay before the actual A/D conversion starts. Last, but not least, bit 7 (ADFM bit) of ADCON2 selects whether the 10 bit A/D result will be left-justified or right-justified. Since the microcontroller registers are only 8 bits, two registers


Recommended