Вы находитесь на странице: 1из 31

UNIVERSITY OF DAR ES SALAAM

SCHOOL OF INFORMATICS AND COMMUNICATION TECHNOLOGY ELECTRONICS AND COMMUNICATION UNIT

FINAL PROJECT REPORT: ES 399

PROJECT TITLE: DESIGN AND IMPLEMENTATION OF A FOUR ELECTRODE


CAPACITIVE TOMOGRAPHY SYSTEM.

A Project Report in Partial Fulfillment for the Award Bachelor of Science in Electronic science and Communication.

Candidate Name: KABIKA, Twaha

Registration #: 2007-04-03165

Supervisor: Dr. Mwambela.

Supervisors signature: Submission Date: 20nd July 2010

Twaha project report 2009/2010 Page 1

Statement of authorship and originality


Declaration
Statement of Authorship and Originality

I declare that this report and work described in it are my own work, with any contributions from others expressly acknowledge and/or cited.

I declare that the work in this report was carried out in accordance with the regulations of the University of Dar es Salaam and has not been presented to any other University for examination either in Tanzania or overseas. Any views expressed in the report are those of the author and in no way represent those of the University of Dar es Salaam.

SIGNED ..

DATEJuly 20, 2010

Twaha project report 2009/2010 Page 2

Acknowledgments
There are many people that I would like to acknowledge during the course of this project.

Firstly, I would like to thank my supervisor, Dr.Mwambela, without his guidance and endless ideas this project would not be possible. I would also like to thank my fellow colleagues in the Department of electronics and communication unit for their views and help with this project. Also thanks go to the other lecturers and supervisors who have taught me throughout the 3years in electronic science and communication field, without them the whole project would not be possible.

Secondly, I would like to thank Mr. Baraka, Mr Nombo and the technicians Mr. Andrew and Madam Agrippina for thier help in ordering the components in time for the project.

Finally ,I would to thank all the class members especially my friends Juma Mtimali, Mlomo Frolian,Elias Eduard,Shaame Suleiman for their help .

Twaha project report 2009/2010 Page 3

Abstract
An electrical capacitance tomography system (ECT) has been developed. The system consists of a circular sensor with four electrodes, Microcontroller, analogue switches and Operational amplifiers are used. A charge generator injects charges into the sensor filled with objects different dielectric constants through switches which select one electrode plate to be injected per time. The charges, in the form of potential dropped, on another electrode are measured in the capacitive measuring circuit (in this project the programmed micro controller) for calculating the capacitance. Some experiments as the sensor filled with full dielectric material placed on a specified area was carried on. We have found that the minimum and maximum capacitance between the electrode pairs is about 0.1245 pF and 2.6760 pF respectively. These very low capacitance values suggested that the measuring circuit being implemented should have high sensitivity and also be insensitive to noise. Designed and simulated for the two part is successfully done using proteus and Micro C software separately. Circuit diagrams and prototype of the implemented circuit have also been included in this report. The project has done successfully but there are challenges found during the course. There is a big gap between theory and practical. Also some of the components are not available in the simulator (Proteus) which makes simulation to be impossible. Several components are not found in Tanzania, which leads to re-designing unnecessarily.

Twaha project report 2009/2010 Page 4

Table of contents
Statement of authorship and originality.................................................................... i Acknowledgments................................................................................................. ii Abstract ................................................................................................................... iii List of Figures........................................................................................................... vi List of Tables............................................................................................................ vii CHAPTER ONE: GENERAL INRODUCTION 1.0 Introduction.. .1 1.1 Problem Statement...............................................................................................2 1.2 Project Objectives/significance........................................................................... 3 1.3 Methodology.. 4 CHAPTER TWO: LITERATURE REVIEW CHAPTER THREE: The Proposed Design and implimentation CHAPTER FOUR: Results and Discussion CHAPTER FIVE: Conclusion and Recommendation Conclusions Recommendations Bibliography APPENDICIES Appendix A: Project cost Appendix B: LM 741 Data sheet Appendix C: HEF4066 BP Data sheet Appendix D: PIC 16F876A Data sheet

Twaha project report 2009/2010 Page 5

1. CHAPTER ONE:GENERAL INTRODUCTION 1.0 INTRODUCTION:


In the last decade ,process tomography technique have been developed rapidly for visualising the internal behaviour of the industrial processes, e.g gas/oil flows in oil pipe lines, or the behaviour of the dielectric material inside the pipe.Electrical measurements capacitance involves the measurement of the changes in the capacitance from a multielectrode sensor due to the change in the permitivity of the material being imaged and the reconstruction of cross-sectional images using the measured data and a suitable algorithm . A typical electrical capacitive tomography pipe line sensor consists of a set of measurement electrodes mounted symetrically around the circumference of an insulating pipe . An earthed screen , which surrounds the measurement electrodes, minimises external electrical noise . Radial earthed screens are fitted between the electrodes to reduce the interelectrode capacitance external to the sensor pipe ,particularly the standing capacitance between adjacent electrode pairs. For a sensor with N electrodes there are N(N-1)/2 single electrode pairs and hence N(N-1)/2 independent measurements. The inter electrode capacitance of an electrical sensor depends mainly on the electrode size for a given number of electrodes ,the capacitance is proportional to the axial length of electrodes.

1.1PLOBLEM STATEMENT
Despite of all the demand and the importance of the presence of electrical capacitance tomography system, the controller for the sensor/system and measurement circuit are not yet easily available when needed, hence designing one will enable the easiest study of the change in the capacitance and the behavior of the dielectric material as it is highly needed in practricals. Unfortunately there is lack of experts in ECT field, hence the knowledge of electrical capacitance tomography system is highly needed. On the other hand is to enhance designing skills on electronic devices using the theories covered in lectures.As it is known currently that, the graduate Engineers lack hands on designing skills.

Twaha project report 2009/2010 Page 6

1.2 PROJECT OBJECTIVES


1.2.1 Main Objective
This project aimed the Design and Implementation of Controller and Measurement circuit for the Four Electrode Capacitive Tomography System.

1.2.2 Specific Objectives


This project has aimed the design the Four Electrode Capacitance Tomography System with the following features: Input frequency on the analogue switchies is100kHz. Max peak to peak input Voltage 18V. 16 Bits digital inputs to the switchies from the micro- controller . Applied voltage in ICs is 5v from the power supply. Applied voltage for the Operational Amplifier is 21V.

1.2.3 Methodology
There various architecture used in the Four Electrical Capacitance tomography system Design ed and realized. In this project the design based on AC based Capacitance Tomography systemas far as the microcontroller programmming in getting the control bits for switchies and the designs of the measurement circuit are concerned to complish the project ,The design phases include, Literature Review Sytem design which based on AC based capacitance tomography system. Circuit simulations (some of the parts) with proteus and program running by the use of the MicroC Softwares. Hardware Implementation of the designed and simulated circuits.

Twaha project report 2009/2010 Page 7

2. CHAPTER TWO: LITERATURE REVIEW


2.0 INTRODUCTION
In recent years, numerous types of tomography sensors have been designed and developed in monitoring and investigating the industrial solid/gas flow. Researches were carried out in order to obtain a good flow meter for process control. The tomography development is also focusing on producing high quality image to suit the demand from industrial sectors. Several sensing principles of tomography sensor in one modality were approaches to produce image reconstruction on solid/gas flow, such as the electrical capacitance, gamma, and optical tomography. The electrical capacitance sensor consists of eight electrodes in circumference of pipe line.and each electrode is excited at one time i.e only one electrode can be the source to the rest electrode,and the signal is taken and processed. All the detailed development hardware were elaborate in this report.

2.1 Primary Sensor Design of Electrical Capacitance Tomography


The ECT electrode design is made out of a pipeline sensor which uses electrode plates as the detecting sensor. These plates are mounted symmetrically on the periphery of an insulating pipe as shown in Fig. 2.0 The pipe uses solid and gas as its medium. The solid particles will yield standing capacitance output that is useful for image reconstruction

. Measurement electrode

Fig 2.0 Electrical capacitance sensor with eight electrode.

Twaha project report 2009/2010 Page 8

2.2 Electrical Capacitance Hardware


An ECT sensor comprised of a set of measurement electrodes mounted symmetrically inside or more typically outside an insulation pipe .These measurement electrodes are connected to the electronic devices, or commonly known as signal conditioning system. Capacitance measurement circuit, amplifying circuit, AC to DC converter circuit and filter circuit are the items that make up the signal conditioning system. Other than that, a sine wave generator is also required as the excitation source for the system. The electronic devices outputs are then sent to the data acquisition system to be changed from analog to digital conversion. The digital data will be sent to computer for analysis and imagereconstruction.For the research, the signal conditioning circuit is designed to be plugged directly onto the out put terminal of the electrodes. Conventionally, all the signal conditioning circuits are placed in one bulky signal conditioning board. However, here, eight identical circuits are used. Each circuit is plugged onto every electrode .During the operation, should only one signal conditioning board is not working; users can simply change it by plugging out the board and replace it with a new board. Figures below shows an example of one of the set of signal conditioning circuit. For this electrical capacitance tomography a stray immune AC based capacitance measuring circuit has been developed. AC based capacitance measuring circuit is highly sensitive, has good linearity, good stability and high resolution AC . It uses an operational amplifier (op-amp) with resistor feedback which directly measures the AC admittance of an unknown capacitance. This type of circuit has found extensive applications owing to their low drift and good SNR. Fig. 6 shows a typical hardware of electrical capacitance sensor including the AC based capacitance measuring circuit.

2.2.0 CONDITIONING CIRCUIT.


In this design the conditioning circuit consists of the opamp with capacitor and resistor as feedback,AC amplifier , AC/DC converter , low pass filter and the measurement circuit. The opamp with RC feedback is employed so that it can change/converts the current into an ac voltage , that voltage is very small so it needed to be amplified then the ac amplifier is employed since the measurement circuit used is the microcontroller based the ac signal must be change to dc by passing through the AC/DC converter but that rectified signal has the AC components so the low pass filter is imployed. See below the circuit for the mentioned above parts as done in this literature

Twaha project report 2009/2010 Page 9

Fig.2.1 the ciruit for ac amplifier , rectifier and low passfilter.

2.2.1 CONTROL CIRCUIT (MICROCONTROLLER).


Microcontrollers: Characterization A microcontroller can be considered as a microcomputer built on a single integrated circuit or chip. Historically, microcontrollers appeared after microprocessors and followed independent paths. Microprocessors are mainly found in personal computers and workstations, as these require strong computational power, and the ability to manage large sets of data and instructions at a high speed. A very important parameter for microprocessors is the size of their internal registers (8, 16, 32, or 64 bits), as this determines the number of bits that can be processed simultaneously. On the other hand, microcontrollers are used in a large variety of applications. They can be found in the automotive industry, communication systems, electronic instrumentation, hospital equipment, industrial equipment and applications, household appliances, toys, and so forth. Microcontrollers have been designed to be used in applications in which they have to carry out a small number of tasks at the lowest possible economic cost. They do this by executing a program permanently stored in their memory, whereas the input/output ports of the microcontroller are used to interact with the outside world. Therefore, the microcontroller becomes part of the application; it is a controller embedded in the system. Complex applications can use several microcontrollers, each one of them focusing on a small group of tasks. The following generic requirements are important for microcontrollers and designs using microcontrollers:
Page 10

Twaha project report 2009/2010

1. Input/output resources. As opposed to microprocessors in whichthe emphasis is on


computational power, microcontrollers put their emphasis on their input/output resources, such as the ability to handle interrupts, analog signals, number of different input and output lines, and so forth.

2. Optimization of space. It is important to use the smallest possible footprint at a


reasonable cost. Given that the number of pins in a chip depends on its packaging, the footprint can be optimized by having one pin able to perform several different functions.

3. Using the most appropriate microcontroller for a given application.Microcontroller


manufacturers have developed families of devices with the same instruction set but different hardware aspects, such as memory size, input/output devices, and so forth. This allows the designer to select the most appropriate device from a given family.

4. Protection against failure. It is critical for safety to guarantee that the microcontroller
is executing the correct program. If for any reason the program goes astray, the situation has to be immediately corrected. Microcontrollers have a watchdog timer (WDT) to ensure that the program is being executed correctly. Watchdog timers do not exist in personal computers.

5. Low power consumption. Because batteries power many applications using microcontrollers, it is important to ensure the low power consumption of ucontrollers. Furthermore, the energy used when the microcontroller is not doing anything, for e.g, when it is waiting for an action from the user like a keyboard input, needs to be kept to a minimum. To do this, the microcontroller is set in sleeping state until it resumes the execution of the program. 6. Protection of programs against copies. The program stored in memory needs to be protected against unauthorized reading. To do this, the microcontrollers incorporate protection mechanisms against copying.

2.2.1.0 Components of a Microcontroller


Microcontrollers combine the fundamental resources available in a microcomputer such as the CPU, memory, and I/O resources in a single chip.Microcontrollers have an oscillator to generate the signal necessary to synchronize all internal operations. Although this can be a basic RC (resistance capacitor) oscillator, a quartz crystal (XTAL) is normally used due to its high frequency stability. The frequency of the oscillator has a direct influence on the speed at which program instructions are executed.Similar to microcomputers, the CPU is the brain of the microcontroller. The CPU fetches the program instructions from their locations in memory one by one, interprets or decodes them, and executes them. The CPU also includes the ALU circuits
Twaha project report 2009/2010 Page 11

for binary arithmetic and logic operations.The microcontrollers CPU has different registers. Some of these registers are intended for general use, whereas others have a specific purpose. Specific purpose registers include: instruction register, accumulator,status register, program counter, data address register, and stack pointer. The instruction register (IR) stores the instruction that the CPU is executing. The programmer does not normally have access to the IR. The accumulator (ACC) is a register associated with the arithmeticand logic operations that the ALU is carrying out. When executing any operation, one of the data needs to be in the ACC. The resulting value is also stored in the ACC. PIC microcontrollers do not have the ACC register. Instead, they have a working (W) register that is very similar to the ACC. The status register (STATUS) contains the bits that show different characteristics related to the operations carried out by the ALU. These can be the sign of the resulting value (positive vs. negative), a flag to notify if the resulting value is zero, carry over, parity bits, and so forth. The program counter (PC) is the CPU register where addresses of instructions are stored. Every time that the CPU looks for an instruction in the memory, the PC is increased, pointing to the following instruction. In an instant of time, the PC contains the address of the instruction that will be executed next. The control transfer instructions modify the value stored in the PC. The data address register (DAR) stores data addresses from memory. This register plays a major role in indirect data addressing. Different types of microcontrollers use different specific names for the DAR. For example, PIC microcontrollers call this register the file select register (FSR). The stack pointer (SP) stores data addresses in the stack. PIC microcontrollers do not have an SP register. The microcontroller memory stores both program instructions and data. Any microcontroller has two types of memory: random-access memory (RAM) and read-only memory (ROM). RAM can be read and written. Basic block diagram of a microcontroller. RAM is volatile memory, meaning that its data is lost when it is not powered. On the other hand, although ROM can only be read, it is non-volatile. The different types of technologies used for ROM such as EPROM (erasable programmable readonly memory), EEPROM (electrical erasable programmable read-only memory), OTP (one-time programmable), and FLASH. Both RAM and ROM are random access memories, meaning that the time to access specific data does not depend on its stored location. This is opposed to sequential access memories in which the time needed to access a specific memory cell depends on the location of the last accessed cell. ROM is used to permanently store the program for the microcontroller, whereas RAM is used to temporarily store the data that will be manipulated by the program. An increasing number of microcontrollers use nonvolatile memory such as EEPROM to store some of the data that is changed only sporadically. The size of ROM is larger than
Twaha project report 2009/2010 Page 12

the size of RAM for two main reasons: First, most applications require programs that manipulate a relatively small number of data. Second, RAM has a larger footprint compared to ROM, and therefore it is more expensive than Rumbaing the vehicle to communicate with the outside world, the I/O resources are very important in microcontrollers. I/O resources consist of the serial and parallel ports, timers, and interruption managers. Some microcontrollers also incorporate analog input and output lines associated with analog-to-digital (A/D) and digital-to-analog (D/A) converters. The resources needed to ensure the regular operation of the microcontrollers such as the watchdog are also considered part of the I/O resources. Parallel ports are normally structured in groups of up to eight lines of digital inputs and outputs. It is normally possible to manipulate each one of these lines individually. Serial ports can be of different technologies such as RS-232C (Recommended Standard 232), IC (inter integrated circuit), USB (universal serial bus), and Ethernet. In general, microcontroller will have the largest possible number of I/O resources for the number of available pins in its integrated circuit package. To increase the performance, one physical pin can be connected to several internal blocks, and therefore that pin may carry out different functions depending on how the microcontroller has been configured. In this project the type of Microcontroller used is the PIC 6F876A, it consists of three PORTS i.e portA, portB and portC. Each port comprised of eight pins, other pins like Vdd and Vss are used for supplying voltage to the PIC, MCLR is used for setting and resetting the PIC, OSC1 and OSC2 are used for connecting the external oscillator to the PIC.

Fig 2.2 shows a diagram of PIC 16F876A

In this project the microcontroller is used to derive /generate the 16 bits to contlor the
switching circuit(i.e oppenning and closing the switches).
Twaha project report 2009/2010 Page 13

2.2.2 SWITCHING CIRCUIT.


Usually, switching circuit is formed by CMOS analog switches which mainly functions to control the status of the electrodes. From here researcher can choose the electrode as either being the source or detecting electrode. Each set of signal conditioning circuit needs a switching circuit. Normally, the configuration of the switching circuit in an ECT system is represented as shown in Fig below.

Figure 2.2 .The switching circuit

Twaha project report 2009/2010 Page 14

3 DETAILED DESIGN AND IMPLEMENTATION 3.0 CONTROLLER CIRCUIT.


In the controlling circuit the microcontroller ic 16F876A is used to generate the sixteen bits which are used to drive /open the switches. Port B and C are programmed to generate those bits in the ordering sequences. Those bits are come in the order shown in table below-: !stsequence PORTA 3 C PORTB 3 C 2ndsequence PORT A C 3 PORT B C C 3rdsequence PORTA C C PORTB 3 C 4thsequence PORTA C C PORTB 3 C

FIG.3.0 the table that show the bits sequence from the microcontroller Where by 3 represents the bits 0011 and C represents the bits 1100 The codes below are used to program the microcontroller to generate the above sequence of the bits-:
#define Switch PORTB.F0 #define Pressed 0 void main() { TRISB = 0; // PORTC outputs TRISA=0x10; // RA4 input PORTB = 0; // Turn OFF all Switches TRISC = 0; // PORTC outputs PORTC = 0; // Turn OFF all Switches while(1)// Endless loop { if(Switch == Pressed) { PORTB=0xC3; PORTC=0xCC; Delay_ms(4000); // Delay second PORTB=0x3C; PORTC=0xCC; Delay_ms(4000); // Delay second PORTB=0xCC; PORTC=0xC3; Delay_ms(4000); // Delay second PORTB=0xCC; PORTC=0x3C;

Twaha project report 2009/2010 Page 15

Delay_ms(4000); // Delay second PORTB=0x00; PORTC=0x00; Delay_ms(4000); // Delay second }}}

THE CONNECTION OF THE MICROCONTROLLER TO GENERATE THE ABOVE BITS IS AS SHOWN BELOW.

X1 U1
CRYSTAL 13 1 2 3 4 5 6 7 14 33 34 35 36 37 38 39 40 OSC1/CLKI MCLR/VPP RC0/T1OSO/T1CKI RC1/T1OSI/CCP2A RC2/CCP1 RA0/AN0 RC3/SCK/SCL RA1/AN1 RC4/SDI/SDA RA2/AN2/VREFRC5/SDO RA3/AN3/VREF+ RC6/TX/CK RA4/T0CKI RC7/RX/DT RA5/AN4/SS/LVDIN RA6/OSC2/CLKO RD0/PSP0 RD1/PSP1 RB0/INT0 RD2/PSP2 RB1/INT1 RD3/PSP3 RB2/INT2 RD4/PSP4 RB3/CCP2B RD5/PSP5 RB4 RD6/PSP6 RB5/PGM RD7/PSP7 RB6/PGC RB7/PGD RE0/RD/AN5 RE1/WR/AN6 RE2/CS/AN7 PIC18F452 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30 8 9 10

C1
15p

C2
15p

R9
4k7

FIG3.0. the microcontroller connections

Twaha project report 2009/2010 Page 16

3.1 SWITCHING CIRCUIT.


The switching circuit comprises of the analogue switches that are HEF 4066 BP. These types of switches have the analogue inputs terminal and the digital inputs terminal. The terminal E1,E2,E3 and E4 are the digital inputs , these terminals/inputs pins are the one that are used to operate the switch that is when they get high inputs then the switch goes to on/close state and when the low input comes on switch goes to open/off state. The pins y and z are used for analogue signal input either of them can be used as the input or output pin. In this project four IC of these switch were used that means each switch per each electrode. And this is done to avoid the unnecessary interference of the signal when the adjacent switches are selected at a time which also leads to the killing of the component .The switching connection to the microcontroller is as shown below; SWITCH1 E0 E1 E2 E3 E0 E1 E2 E3 PORTB7 PORTB6 PORTB5 PORTB4 SWITCH3 PORTC0 PORTC1 PORTC2 PORTC3 E0 E1 E2 E3 SWITCH2 E0 PORTB3 E1 PORTB2 E2 PORTB1 E3 PORT B0 SWITCH4 PORTC4 PORTC5 PORTC6 PORTC7

FIG3.1The table that shows the switch connection to the microcontroller. Also the y and z pins needs the special connection also there were connected as shown below

Y0 for all switches are used as the sine wave inputs(100KHz and 9Vp-p) Z1 FOR all switches is connected to the electrode i.e used to send the signal to
the electrode.

Z0 and Y1 are connected together. Z2 and Y3 are connected together. Z3 is used as an output takes the signal out the electrode to the condition
circuit.
Twaha project report 2009/2010 Page 17

The hardware connection is as shown below;

Twaha project report 2009/2010 Page 18

3.6 CONDITIONING CIRCUIT This is the circuit comprising the operational amplifier and with a feedback capacitance Cf and a feedback resistance Rf ,converts the current into an AC voltage V0 given by-:
V0 =[ Where Rf/(
fRf+1)]

* vi << Rf and then

is the angular frequency of the the excitation voltage .

When capacitance feedback is selected to be dominant i.e 1/ the equation become; V0 = -[Cx/Cf] Vi.

Then after the calculation the feedback capacitance Cf selected is 10pf and the feedback resistor Rf is 160k but due to scarcity of the component the 220k is used. Below is the circuit diagram is as shown below-:
Cf 10pF

Rf 220k V1 10V U1 +V LM741/NS +

V2 +V10V

Twaha project report 2009/2010 Page 19

3.3 CAPACITANCE MEASUREMENT CIRCUIT


The Design of the capacitance measurement circuit is based on the below theory
Begin with the voltage equation for RC charging circuit is:

The time that the capacitor is charge to 1/2 of Vs is :

let R = 10k and set up the timer to overflow every 69.3 us so

where N is a number of periods that elapsed. Below is the program codes that are used to program to function the above task .

I)

When the hyperterminal is used as the out put display

/* * Project name: Capacitance measurementcircuit : MCU: PIC16F876A: Oscillator: HS, 8.0000 MHz internal Ext. Modules: SW: mikroC v8.1.0.0 * NOTES: */ #define Vappied PORTA.F3 #define TEST PORTA.F0 unsigned int gCap = 0; char gOverTest = 0; char gMessage[8]; char gCapstr[8],ch; void interrupt(){ if(PIR1.TMR2IF){ TMR2 = 0x87; // best value to create 69.3us gCap++; if(gCap > 65500) gOverTest = 1; PIR1.TMR2IF =0; // Clear int bit } } void main(){ char i,j; char cap_size; //ANSEL = 0;

Twaha project report 2009/2010 Page 20

TRISB = 0; PORTB = 0; Uart1_Init(9600); Delay_ms(10); //OSCCON = 0x7E; // 8Mhz, RC internal clock OPTION_REG.T0CS = 0; INTCON.GIE = 1; //Enable global interrupt INTCON.PEIE = 1; //Enable peripheral interrupt //------------ Set up Timer2 -----------PIE1.TMR2IE = 1; T2CON = 0; // timer2 off, prescaler 1:1 TMR2 = 0x87; PIR1.TMR2IF =0; // Clear int bit //---------------------------------------CMCON = 5; // one independent comparator // RA1 = Vin- , RA2 = Vin+ = Vref CMCON.C2INV = 1; // C2 output inverted //-----------------------------------------//ANSEL |= 6; TRISA |= 6; // RA1 and RA2 are analog input //--------------------------------------------TRISA |= 1; // RA0 is digital input TRISA &= ~8; // RA3 is digital outupt //-----------------------------------------//while(1){} Uart1_write_Text( "Capacitance Values\n\r"); delay_ms(1000); Vappied = 0;

while(1){ if(!TEST) { gCap = 0; gOverTest =0; Uart1_Write_Text( "Testing......\n\r"); TMR2 = 0x87; Vappied = 1; //apply voltage T2CON.TMR2ON = 1; // start timer //T1CON.TMR1ON = 1; // start timer1 while(!CMCON.C2OUT) { if(gOverTest) break; } T2CON.TMR2ON = 0; // stop timer Vappied = 0; //--------------------------------if(!gOverTest){ WordToStr(gCap, gMessage); // convert int to string //---------- remove space ' ' ---------j=0; for(i=0; i<6; i++){ if(gMessage[i]!= ' ') { gCapstr[j] = gMessage[i]; j++; gCapstr[j] = 0; } } //-------------------------------------cap_size = strlen(gCapstr); // find capacitor size in x10 nanofarad switch (cap_size) { case 1: { gCapstr[4] = 0; gCapstr[3] = gCapstr[0]; gCapstr[2] = '0'; gCapstr[1] = '.'; gCapstr[0] = '0'; Uart1_Write_Text(gCapstr); break;

Twaha project report 2009/2010 Page 21

} case 2: { gCapstr[4] = 0; gCapstr[3] = gCapstr[1]; gCapstr[2] = gCapstr[0]; gCapstr[1] = '.'; gCapstr[0] = '0'; Uart1_Write_Text(gCapstr); break; } case 3: { gCapstr[4] = 0; gCapstr[3] = gCapstr[2]; gCapstr[2] = gCapstr[1]; gCapstr[1] = '.'; Uart1_Write_Text(gCapstr); break; } case 4: { gCapstr[5] = 0; gCapstr[4] = gCapstr[3]; gCapstr[3] = gCapstr[2]; gCapstr[2] = '.'; Uart1_Write_Text(gCapstr); break; } case 5: { gCapstr[6] = 0; gCapstr[5] = gCapstr[4]; gCapstr[4] = gCapstr[3]; gCapstr[3] = '.'; Uart1_Write_Text(gCapstr); break; } } Uart1_Write_Text("uF\n\r"); } else { gOverTest = 0; Uart1_Write_Text( "Can not test \n\r"); } delay_ms(1000); } } }

ii) the program when the LCD is used /*


* Project name: Capacitance Measurementcircuit * Test configuration: MCU: PIC16F876A Dev.Board: Oscillator: HS, 8.0000 MHz internal Ext. Modules: SW: mikroC v8.1.0.0 * NOTES: */ #define Vappied PORTA.F3 #define TEST PORTA.F0 unsigned int gCap = 0; char gOverTest = 0; char gMessage[8]; char gCapstr[8]; void interrupt(){

Twaha project report 2009/2010 Page 22

if(PIR1.TMR2IF){ TMR2 = 0x87; // best value to create 69.3us gCap++; if(gCap > 65500) gOverTest = 1; PIR1.TMR2IF =0; // Clear int bit } } void main(){ char i,j; char cap_size; //ANSEL = 0; TRISB = 0; PORTB = 0; //OSCCON = 0x7E; // 8Mhz, RC internal clock OPTION_REG.T0CS = 0; INTCON.GIE = 1; //Enable global interrupt INTCON.PEIE = 1; //Enable peripheral interrupt //------------ Set up Timer2 -----------PIE1.TMR2IE = 1; T2CON = 0; // timer2 off, prescaler 1:1 TMR2 = 0x87; PIR1.TMR2IF =0; // Clear int bit //---------------------------------------CMCON = 5; // one independent comparator // RA1 = Vin- , RA2 = Vin+ = Vref CMCON.C2INV = 1; // C2 output inverted //-----------------------------------------//ANSEL |= 6; TRISA |= 6; // RA1 and RA2 are analog input //--------------------------------------------TRISA |= 1; // RA0 is digital input TRISA &= ~8; // RA3 is digital outupt //-----------------------------------------//while(1){} Lcd_Init(&PORTB); Lcd_Cmd(Lcd_Clear); Lcd_Out(1, 1, "Capacita"); Lcd_Out(2, 1, "nceMeter"); delay_ms(2000); Lcd_Cmd(Lcd_Clear); Lcd_Cmd(LCD_CURSOR_OFF); Lcd_Out(1, 1, "Ready..."); Vappied = 0; while(1){ if(!TEST) { gCap = 0; gOverTest =0; Lcd_Cmd(Lcd_Clear); Lcd_Out(1, 1, "Testing."); Lcd_Out(2, 1, "..."); TMR2 = 0x87; Vappied = 1; //apply voltage T2CON.TMR2ON = 1; // start timer //T1CON.TMR1ON = 1; // start timer1 while(!CMCON.C2OUT) { if(gOverTest) break; } T2CON.TMR2ON = 0; // stop timer Vappied = 0; //--------------------------------if(!gOverTest){ WordToStr(gCap, gMessage); // convert int to string //---------- remove space ' ' ---------j=0; for(i=0; i<6; i++){ if(gMessage[i]!= ' ') { gCapstr[j] = gMessage[i];

Twaha project report 2009/2010 Page 23

j++; gCapstr[j] = 0; } } //-------------------------------------cap_size = strlen(gCapstr); // find capacitor size in x10 nanofarad switch (cap_size) { case 1: { gCapstr[4] = 0; gCapstr[3] = gCapstr[0]; gCapstr[2] = '0'; gCapstr[1] = '.'; gCapstr[0] = '0'; Lcd_Cmd(Lcd_Clear); Lcd_Out(1, 5, gCapstr); break; } case 2: { gCapstr[4] = 0; gCapstr[3] = gCapstr[1]; gCapstr[2] = gCapstr[0]; gCapstr[1] = '.'; gCapstr[0] = '0'; Lcd_Cmd(Lcd_Clear); Lcd_Out(1, 5, gCapstr); break; } case 3: { gCapstr[4] = 0; gCapstr[3] = gCapstr[2]; gCapstr[2] = gCapstr[1]; gCapstr[1] = '.'; Lcd_Cmd(Lcd_Clear); Lcd_Out(1, 5, gCapstr); break; } case 4: { gCapstr[5] = 0; gCapstr[4] = gCapstr[3]; gCapstr[3] = gCapstr[2]; gCapstr[2] = '.'; Lcd_Cmd(Lcd_Clear); Lcd_Out(1, 4, gCapstr); break; } case 5: { gCapstr[6] = 0; gCapstr[5] = gCapstr[4]; gCapstr[4] = gCapstr[3]; gCapstr[3] = '.'; Lcd_Cmd(Lcd_Clear); Lcd_Out(1, 3, gCapstr); break; } } Lcd_Out(2, 1, "uF"); } else { gOverTest = 0; Lcd_Cmd(Lcd_Clear); Lcd_Out(1, 1, "Can not "); Lcd_Out(2, 1, "test."); } delay_ms(1000); } }

}
Twaha project report 2009/2010 Page 24

The hardware part connection is as shown below and this is when LCD used.

LCD1
LM041L

RV1
POT

R5
10k VSS VDD VEE RS RW E 4 5 6 D0 D1 D2 D3 D4 D5 D6 D7 7 8 9 10 11 12 13 14

R3
10k

R2
10k

U1
16 15 4 RA7/OSC1/CLKIN RA0/AN0 RA6/OSC2/CLKOUT RA1/AN1 RA2/AN2/CVREF/VREFRA5/MCLR RA3/AN3/C1OUT/VREF+ RA4/AN4/T0CKI/C2OUT RB0/INT/CCP1 RB1/SDI/SDA RB2/SDO/RX/DT RB3/CCP1 RB4/SCK/SCL RB5/SS/TX/CK RB6/AN5/T1OSO/T1CKI RB7/AN6/T1OSI PIC16F88 17 18 1 2 3 6 7 8 9 10 11 12 13

R1
10k

C1
100n

R4
10k

Fig3.3.0. the capacitance measurement circuit when the LCD used as DISPLAY.

Twaha project report 2009/2010 Page 25

1 2 3

And when the HyperTerminal is used the connection are as follows;

R5
10k

R3
10k

R2
10k

U1
16 15 4 RA7/OSC1/CLKIN RA6/OSC2/CLKOUT RA5/MCLR RA0/AN0 RA1/AN1 RA2/AN2/VREF RA3/AN3/CMP1 RA4/T0CKI/CMP2 17 18 1 2 3 6 7 8 9 10 11 12 13

R1
10k RXD TXD RTS CTS

C1
10u PIC16F628A

RB0/INT RB1/RX/DT RB2/TX/CK RB3/CCP1 RB4 RB5 RB6/T1OSO/T1CKI RB7/T1OSI

R4
10k

FIG3.3.1. The capacitance meter when the HyperTerminal is used to display.

Twaha project report 2009/2010 Page 26

CONCLUSION.
The design analysis of design block in the block diagram Of this project has been proven by means of simulations using proteus tools that are available in my area and all are working accordingly. The circuits have been implemented in circuit board and have been tested and are working properly but the measurement circuit shows some failure.In real life, things are not as simple as what are presented in theory.

Twaha project report 2009/2010 Page 27

Recommendations
Despite working with the final year project has been so important, memorable and verychallenging in practicing engineering skills, still there are some problems that have been encountered while doing the project. Many electronic components are not easily available inTanzania, which leads to redesigning so as to utilize the available components which results in degrading the performance of the product. The university has to equip the laboratories with all necessary electronic equipment so that students can easily access the components during their hands on designing. The Proteus tools available lack some of the devices since are just student versions or trial versions, the university should have to purchase the commercial version and installed in laboratory for learning purposes, so as to solve the problem since students cantafford them.

Twaha project report 2009/2010 Page 28

Bibliography
[1] T. Dyakowski, R. B. Edwards, C. G. Xie and R. A. Williams, Application of capacitance tomography to gas-solid flows Chemical Engineering Science, Vol. 52, No. 13, 1997, pp. 2099-2110. [2] Zhiyao Huang, Baoliang Wang and Haiqing Li, Application of Electrical Capacitance Tomography to the Void Fraction Measurement of Two-Phase Flow IEEE Instrumentation and Measurement Technology Conference Budapest, Hungary, May 21-23, 2001 pp. 341345. [3] Anton Fuchs, Bernhard Brandstatter, Daniel Watzenig, Gert Holler and Bernhard Kortschak, Flow Profile Estimator for Closed Pipes Based on Electrical Capacitance Tomography Techniques IMTC 2004: Instrumentation and Measurement Conference, Como, 18-20 May 2004, pp. 2326-2331. [4] R. A . Williams, M. S. Beck, Process Tomography : Principles, Techniques and Applications Butterworth-Heinemann,1995. [5] W.Q. Yang, T.A. York New AC-based capacitance tomography system IEE Proc.-Sci. Meas. Technol., Vol. 146 No. 1, January 1999. [6] H.Hahnel, W.Q. Yang and T.A. York An AC-based capacitance measuring circuit for tomography systems and its silicon chip design IEE Colloquium : Advances in sensors, London, 7 Dec. 1995.

Twaha project report 2009/2010 Page 29

APPENDICIES
Appendix A: Project cost
The cost presented in this report is just the project components cost. That is it comprises the electronic components used in the project. These costs are summarized in the tables. Table 2-2: project components cost DESCRIPTION S/N 1 2 3 4 5 6 7 8 Micro Controller Crystal oscillator Analogue switch(HEF 4066 BP) 22pf capacitor LM 741 10pf capacitor 220k resistor 10k resistor QUANTITY 2 2 4 4 4 4 4 4 Unitprice(Tshs) Total Price(Tshs) 15000/= 5000/= 2000/= 500/= 1000/= 500/= 500/= 500/= 30000/= 10000/= 8000/= 2000/= 4000/= 2000/= 2000/= 2000/=

total

28

60000/=

Twaha project report 2009/2010 Page 30

Twaha project report 2009/2010 Page 31

Вам также может понравиться