Академический Документы
Профессиональный Документы
Культура Документы
A Project Report in Partial Fulfillment for the Award Bachelor of Science in Electronic science and Communication.
Registration #: 2007-04-03165
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 ..
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 .
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.
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
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.
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.
. Measurement electrode
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.
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.
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
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;
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.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
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)]
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
V2 +V10V
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)
/* * 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;
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;
} 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); } } }
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];
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.
1 2 3
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
R4
10k
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.
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.
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.
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/=