ENG460 Engineering Thesis - Murdoch University

81
MURDOCH UNIVERSITY ENG460 Engineering Thesis Charge Transfer Capacitance Meter Development For Capacitive Level Sensor Robert Alexander Anderson 18 th November 2013 In partial fulfilment for a Bachelor of Engineering degree, this thesis was submitted to the School of Engineering and Information Technology, Murdoch University.

Transcript of ENG460 Engineering Thesis - Murdoch University

Page 1: ENG460 Engineering Thesis - Murdoch University

MURDOCH UNIVERSITY

ENG460 Engineering Thesis Charge Transfer Capacitance Meter Development

For Capacitive Level Sensor

Robert Alexander Anderson

18th November 2013

In partial fulfilment for a Bachelor of Engineering degree, this thesis was submitted to the

School of Engineering and Information Technology, Murdoch University.

Page 2: ENG460 Engineering Thesis - Murdoch University

i | P a g e

Acknowledgements I would like to take this opportunity to express my gratitude to my supervisor, Dr. Gareth Lee for

providing me with the guidance required to undertake this thesis project. In addition, a special thank

you to John Boulton for his advice and help in constructing my capacitor probes. Finally my heartfelt

appreciation goes to my family for their unending support and understanding.

Page 3: ENG460 Engineering Thesis - Murdoch University

ii | P a g e

Abstract An innovative technique has been recently developed to measure capacitance and capacitive touch. This

technique labeled ‘QTouch’ was patented to Atmel in 2011, [1] but invented by a firm called ‘Quantum

Research Group’. The heart of this thesis focuses on two different types of capacitive sensing circuits,

adapted from the ‘QTouch’ technique.

The first circuit involves a ‘charge divider’ approach, which behaves similar to resistive voltage divider

circuitry, where a voltage is retrieved between a pair of capacitors to compute the unknown

capacitance. The key advantage of this circuitry is that it allows a microcontroller to narrow the

analogue reference (AREF), which focuses a maximum analogue input range on a linear region. It also

has the advantage of obtaining a differential capacitance measurement through using a fixed/known

reference capacitor. And finally, it offers a measurement for each charge cycle. In the second prototype

circuit, the recently patented ‘QTouch’ charge transfer technique, used specifically in digital touch

sensors with large signal-to-noise ratios (SNR), is combined with the charge divider approach. Both these

combined techniques form a hybrid QTouch (Analogue QTouch) that is redeveloped into a capacitance

sensor that retains all of the noise rejection advantages of the traditional QTouch. The key advantage of

this circuitry is that it offers easy disturbance rejection, detects average changes in level and forms a

single ended sensor by using a fixed known capacitor.

The Analogue QTouch circuit makes capacitance measurements that are conveyed via an output DAC

breakout board, to an analogue voltage that is then fed through an operational amplifier to create a 4-

20mA signal. In this project, the QTouch circuit is applied to capacitor probes in a water tank to form a

capacitive level sensor, which measures the water level by computing the proportional relationship

between water level and the measured capacitance. An LCD display screen is used to display real-time

data, such as the capacitance and a corresponding level.

Key findings of this thesis are that the second prototype circuit that employs the ‘QTouch’ charge

transfer technique (Analogue QTouch) has been demonstrated to be at least as accurate as some of the

advanced capacitive measuring devices on the market such as the ‘Digital Multimeter Q1156’. It is also

able to detect capacitance changes and switch to a moving average equation (Equation 12) to improve

transient measurement accuracy. Because this system samples ‘accumulated charge’ it does not require

continuous sampling, as whenever the accumulated charge is sampled, a type of average accumulation

per iteration calculation is performed. Moreover in mathematical terms a sampling of the summation of

data points is performed rather than the data points themselves. This in turn allows the user to sample

the dataset at any time to perform an average calculation and according to the ‘law of large numbers',

the larger the dataset, the more likely the sample average will converge to the true average.

An additional feature of the circuits developed in this thesis is that they operate with any DC voltage

range. The benefit of this is that no external circuitry or expensive oscillators are required to perform

capacitive measurements. The highly accurate ‘QTouch charge transfer technique’ does not measure

frequencies or transient responses against time as other capacitive measurement systems do. Rather it

offers both a software and iteration based alternative that can be controlled by a microcontroller.

Page 4: ENG460 Engineering Thesis - Murdoch University

iii | P a g e

Terminology and Abbreviations ICSP This is used to reprogram the boot loader onto the ATmega CPU. It’s an “Atmel

Standard” for “In-circuit Serial Programming”

USART Stands For Universal Asynchronous Receiver/Transmitter. Used for translating data

between serial and parallel forms, it is a piece of computer hardware.

SPI Stands for serial peripheral interface bus. It operates in full duplex mode and is a

synchronous serial data link that communicates in master/slave mode.

I2C Stands for ‘Inter-Integrated Circuit’. It is a multi-master serial single ended computer bus

that allows low speed communication to an embedded system, motherboard or other

electronic device.

SCL Clock line, used to monitor/order communication between electronic devices that use

I2C communication.

SDA Data line, used to transmit data in I2C communication.

IC Stands for ‘integrated circuit’; that is a set of electronic circuits on a chip.

MCU An abbreviation for a ‘microcontroller’, a small computer on an integrated circuit that

contains memory, a processing core and input/output programmable peripherals.

LCD Stands for a ‘liquid crystal display’. In the context of this thesis it is a display panel.

CPU Stands for ‘central processing unit’; it is the hardware within the computer that carries

out arithmetic, logical and input/output operations.

IDE Stands for ‘integrated development environment’; it is the software application that

provides development facilities to allow computer programmers to develop software.

EMI Stands for ‘electromagnetic interference’; it is a radiofrequency type disturbance that

affects electrical circuits through electromagnetic induction or electromagnetic

radiation.

SNR Stands for ‘signal-to-noise ratio’; it is a measure used in engineering that compares the

expected signal level to the background noise level.

KVL Stands for ‘Kirchhoff's voltage law’; it is a law that states that the voltage around the

close loop must accumulate to zero.

LLN Stands for ‘Law of large numbers’; in statistics there are many expressions of LLN.

Classical LLN is referenced and explained within this thesis.

Page 5: ENG460 Engineering Thesis - Murdoch University

iv | P a g e

EEPROM Stands for ‘Electrically Erasable Programmable Read-Only Memory’; it is a type of non-

volatile memory that can remain stored even if the power is removed.

DMM Digital Multimeter

Page 6: ENG460 Engineering Thesis - Murdoch University

v | P a g e

Contents Acknowledgements ..................................................................................................................................... i

Abstract ...................................................................................................................................................... ii

Terminology and Abbreviations ..................................................................................................................iii

Contents ..................................................................................................................................................... v

List of Figures ............................................................................................................................................ viii

List of Tables ............................................................................................................................................... ix

List of Equations.......................................................................................................................................... ix

Chapter 1 Introduction ............................................................................................................................... 1

1.1 Problem Description ......................................................................................................................... 1

1.2 Objectives ......................................................................................................................................... 1

1.2.1 Peripheral Objectives ..................................................................................................................... 2

Chapter 2 Literary Review ........................................................................................................................... 3

2.1 Capacitors And Capacitance .............................................................................................................. 3

2.1.1 Pressure Tank Analogy ............................................................................................................... 4

2.1.2 Voltage And Stored Charge Relationship ................................................................................... 5

2.1.3 Current And Voltage Relationship .............................................................................................. 5

2.1.4 Characteristics Of Parallel Plated Capacitors .............................................................................. 6

2.1.5 Parasitic Effects .......................................................................................................................... 8

2.1.6 Capacitor Orientations And Charge ............................................................................................ 9

2.2 Capacitive Sensing Circuits .............................................................................................................. 10

2.2.1 Oscillators ................................................................................................................................ 10

2.2.2 Sensing Capacitance Using A Microcontroller .......................................................................... 12

Chapter 3 Approach .................................................................................................................................. 15

3.1 Peripheral Design Overview ............................................................................................................ 15

3.2Peripheral Selection ......................................................................................................................... 16

3.2.1 Eleven Microcontroller ............................................................................................................. 16

3.2.2 Freetronics LCD Display ............................................................................................................ 17

3.2.3 MCP4725 12-bit DAC ................................................................................................................ 18

3.2.4 Analogue Voltage To Current Circuit ........................................................................................ 19

3.3 Primary Selection ............................................................................................................................ 20

Page 7: ENG460 Engineering Thesis - Murdoch University

vi | P a g e

3.3.1 Conclusion And Choice For Capacitive Sensing ........................................................................ 20

3.3.2 QTouch Background ................................................................................................................. 22

3.3.3 Further QTouch Development Requirements .......................................................................... 22

Chapter 4 Assumptions ............................................................................................................................. 24

4.1 Common Assumptions ................................................................................................................ 24

4.2 Assumptions Purpose And Conclusion ........................................................................................ 24

Chapter 5 Methodology ............................................................................................................................ 26

5.1 Evolving QTouch Into A Capacitance Meter: A Mathematical Investigation ................................... 26

5.1.1 Introduction ............................................................................................................................. 26

5.1.2 Investigation Objectives ........................................................................................................... 26

5.1.3 Investigation ............................................................................................................................ 27

5.2 Adapted QTouch Capacitance Meter Circuitry ................................................................................ 33

5.2.1 The QTouchvs ‘QTouch Analogue’ Design ................................................................................ 33

5.3 Single Charge Based Capacitance Meter Circuitry ........................................................................... 36

5.3.1 Introduction ............................................................................................................................. 36

5.3.2 Investigation ............................................................................................................................ 37

5.3.3 Conclusion ................................................................................................................................ 39

5.4 Construction ................................................................................................................................... 40

5.4.1 Introduction to Capacitive Plate Design ................................................................................... 40

5.4.2 Capacitive Plate Design And Error Considerations ................................................................... 41

5.4.3 Capacitive Plate Construction .................................................................................................. 41

5.4.5 Conclusion ................................................................................................................................ 45

Chapter 6 Results ...................................................................................................................................... 46

6.1 Experiment 1 ................................................................................................................................... 46

6.1.1 Discussion ................................................................................................................................ 47

6.2 Experiment 2 ................................................................................................................................... 47

6.2.1 Discussion ................................................................................................................................ 48

6.3 Experiment 3 – Capacitive Probes ................................................................................................... 51

6.3.1 Objective .................................................................................................................................. 51

6.3.2 Methodology ............................................................................................................................ 51

6.3.3 Discussion ................................................................................................................................ 52

Chapter 7 Conclusion ................................................................................................................................ 54

Page 8: ENG460 Engineering Thesis - Murdoch University

vii | P a g e

7.1 Future Work .................................................................................................................................... 54

7.1.2 Capacitors versus energy relationship ..................................................................................... 54

7.2 Thesis Conclusion ............................................................................................................................ 55

Appendices ............................................................................................................................................... 56

Bibliography .............................................................................................................................................. 70

Page 9: ENG460 Engineering Thesis - Murdoch University

viii | P a g e

List of Figures Figure 1 A Typical Parallel Plate Capacitor .................................................................................................. 3

Figure 2, Current Flowing Through A Capacitor .......................................................................................... 4

Figure 3, Capacitor Analogy with Pressure Tank ......................................................................................... 5

Figure 4, Parallel Plate Capacitor Dimensions ............................................................................................. 6

Figure 5, Molecules In External Electric Field .............................................................................................. 7

Figure 6, Electric Field With/Without Insulator .......................................................................................... 8

Figure 7, Capacitor Including Parasitic Elements ........................................................................................ 9

Figure 8, Charge And Series Capacitors Relationship ................................................................................ 10

Figure 9 , Operational Amplifier Relaxation Oscillator .............................................................................. 11

Figure 10, CMOS Inverter Oscillator.......................................................................................................... 12

Figure 11, Microcontroller-Astable Multivibrator ..................................................................................... 13

Figure 12, QTouch Technique ................................................................................................................... 14

Figure 13, Peripheral Design Overview ..................................................................................................... 15

Figure 14, Freetronics Eleven Board ......................................................................................................... 17

Figure 15, Freetronics LCD Display ............................................................................................................ 18

Figure 16, MCP4725 12-bit Break Outboard ............................................................................................. 19

Figure 17, Transconductance Amplifier .................................................................................................... 20

Figure 18, Series Capacitors, Charge and Voltage ..................................................................................... 22

Figure 19, QTouch Simulation ................................................................................................................... 27

Figure 20, QTouch Spice Simulation Initial Condition ............................................................................... 28

Figure 21, QTouch Simulation Results ...................................................................................................... 28

Figure 22, Scientific Notebook Recursive Solution .................................................................................... 30

Figure 23, QTouch Analogue Design ......................................................................................................... 33

Figure 24, Qtouch Analogy ........................................................................................................................ 34

Figure 25,QTouch Analogue Equation 9 Analogy ...................................................................................... 35

Figure 26, QTouch Analogue Equation 12 Analogy ................................................................................... 36

Figure 27, Single Charge Based Capacitance Meter .................................................................................. 37

Figure 28, C1 Vs C2 Ratio .......................................................................................................................... 38

Figure 29, C2 Vs C1 Ratio .......................................................................................................................... 38

Figure 30, C1/C2 Line Versus Linear Comparison ...................................................................................... 39

Figure 31, Final Single Charge Circuit Diagram .......................................................................................... 40

Figure 32, Initial Capacitive Probe Construction ....................................................................................... 42

Figure 33, The Capacitor Plates Preparation For Rubber Boots ................................................................ 43

Figure 34, Capacitor Probes Duct Tape ..................................................................................................... 43

Figure 35, Rubber Coating And Wrapped Plastic Spacing ......................................................................... 44

Figure 36, Leak Seal Used For Rubber Coating .......................................................................................... 44

Figure 37, Capacitive Probes Held Together With Rubber Bands ............................................................. 45

Figure 38, Capacitor Probe Measurements Graph .................................................................................... 52

Figure 39, Capacitor Probe Linear Approximation .................................................................................... 53

Page 10: ENG460 Engineering Thesis - Murdoch University

ix | P a g e

List of Tables Table 1, Dielectric Constants For Selected Materials .................................................................................. 6

Table 2, QTouch Voltage Per Iteration ...................................................................................................... 29

Table 3, Scientific Notebook Variables ...................................................................................................... 30

Table 4, Calculated Iteration Voltage ........................................................................................................ 31

Table 5, DMM Q1156 Accuracy ................................................................................................................ 46

Table 6, Measured Capacitances .............................................................................................................. 47

Table 7, Measured Capacitance Treating Rated Capacitors As Oracle ...................................................... 48

Table 8, No1.Q1156 As Oracle .................................................................................................................. 49

Table 9, No2.Q1156As Oracle ................................................................................................................... 50

Table 10, Capacitive Probe Measurements............................................................................................... 51

List of Equations Equation 1, Ideal Capacitor Voltage Charge Relationship ........................................................................... 5

Equation 2, Capacitor Voltage Current Relationship ................................................................................... 5

Equation 3, Parallel Plate Capacitor Equation ............................................................................................. 6

Equation 4, KVL Series Capacitors ............................................................................................................. 23

Equation 5, Equivalent Charge .................................................................................................................. 23

Equation 6, KVL With Initial Conditions .................................................................................................... 29

Equation 7, Equivalent Charge With Initial Condition ............................................................................... 29

Equation 8, Both Equations 6 And 7 Combined ........................................................................................ 30

Equation 9, Recursive Solution For 'Node 2' Voltage ................................................................................ 30

Equation 10, QTouch Recursive Formula At Node 2 ................................................................................. 31

Equation 11,QTouch (n+1) Recursive Formula .......................................................................................... 31

Equation 12, The Recursive Moving Average Equation ............................................................................. 32

Equation 13, Energy Stored In A Capacitor ............................................................................................... 54

Page 11: ENG460 Engineering Thesis - Murdoch University

1 | P a g e

Chapter 1 Introduction

1.1 Problem Description For any industrial control system that uses a feedback-control loop, a sensor is required to measure the

process variable and generate feedback. This is so the process variable can be manipulated through an

actuator towards the set point. The difference between the set point and process variable is used to

calculate the error. The error is used to calculate the level of actuation required to manipulate the

process variable to set point. The primary drive for creating a capacitive level sensor is to signal the tank

level so that automatic level control can be achieved.

Capacitive sensing in respect to switches and mechanical systems is an attractive alternative. There is

currently a technological trend towards capacitor sensing in both industry and consumer products. This

is due to the absence of mechanical parts in capacitive sensing, which results in higher durability and no

mechanically based hysteresis. This thesis examines a variety of capacitive level sensing schemes, with a

focus on cost, accuracy, disturbance rejection and noise minimization. After the design or designs are

selected as a base model, adaptations are explored for further avenues of improvement. After this

selection phase the creating, calibrating and testing the improved capacitive level sensor will follow.

1.2 Objectives Depending upon the make, brand and materials used, the price of a capacitor level sensor can vary

between tens of dollars through to thousands of dollars. There are a variety of cheap components

available through local electronic stores or Internet that would allow for low-cost construction of a

capacitor level sensor. The key objective of this thesis is to select, design and build a fluid level sensor.

The level sensor is to be controlled from a microcontroller, which would also be responsible for signaling

the delivery of a 4 to 20 mA current to indicate the water level, and be able to interface to the

equipment in Murdoch University’s Instrumentation and Control Lab.

The work can be split into two phases. The first phase focuses on investigating various techniques and

circuit designs for measuring capacitance; looking at implementations that have either been proposed

before or are in use. Then the focus is on both analyzing and seeking to optimize accuracy, disturbance

rejection, noise rejection and maximum sampling rate. The second phase focuses on the

implementation and simulation aspects of creating a water level sensor. This final phase focuses on

developing equations, calibrations, programming and linearization for the hardware (the capacitive

probe sensor).

Page 12: ENG460 Engineering Thesis - Murdoch University

2 | P a g e

1.2.1 Peripheral Objectives The heart of this thesis project is concerned with capacitive measurement circuitry; however, without a

means of interfacing the usability of this project would be undermined. Therefore two additional

peripheral objectives are required for making the final product both user-friendly and more compatible.

Firstly, an output of a 4 to 20 mA current signal allows for interoperability with industrial current loops.

Finally a local LCD screen provides an alternative display screen of relevant data, in the absence of a CPU

terminal interface. These peripheral objectives are essential for any project operations within an

industrial setting.

1.3 Outline Of Thesis This thesis describes how a capacitance measurement system for water level sensing was developed

from the QTouch charge transfer technique. Chapters 2 to 4 set out the background for this project.

Chapter 2 presents a review of the current literature and theory on capacitors and capacitance

measurement circuits, exploring several existing sensing circuits for capacitance measurement. Chapter

3 presents a design overview for the total capacitance measurement system, and the selection of

peripheral components. It also explains the basis for selecting the QTouch system, and how its

limitations can be accommodated for the development of this water level sensor. Key relevant

assumptions are discussed in Chapter 4.

Chapters 5 to 7 present the methodology and results from this project. In Chapter 5, adaptations are

made to the QTouch system to apply the technology to directly measure capacitance, and by extension,

water level. The results from the QTouch capacitance level measurement, as well as water level

measurements taken from the total system, are summarized and discussed in Chapter 6. Finally,

conclusions and areas for future improvement are explored in Chapter 7.

Page 13: ENG460 Engineering Thesis - Murdoch University

3 | P a g e

Chapter 2 Literary Review

2.1 Chapter Overview This chapter presents the theoretical background for this project, explaining the physics of capacitors

and their relationship to voltage, current and charge, as well as the effects of parasitic elements such as

series inductance and internal resistance. Also, four existing sensing circuits for capacitance

measurement are explored as potential candidates on which to construct a water level sensing device as

per the thesis objectives.

2.2 Capacitors And Capacitance Capacitors are created by separating two conducting plates with a layer of insulating material (see

Figure 1). Each conducting plate is typically known as an electrode and is usually metallic. The material

that insulates between both electrodes is called a dielectric. A ‘parallel plate capacitor’ is a term used to

describe both the conducting plates as parallel and flat in orientation. [1]

Figure 1 A Typical Parallel Plate Capacitor

[2]

Traditionally current is described as the flow of positive charge, which is induced by the flow of electrons

in the opposite direction. To illustrate how electrons interact with the capacitor as current flows through

it, Figure 2 has been provided. Consider that electrons flow upwards into the capacitor; thus, a

corresponding current flows downwards. The electrons build up on the lower side of the capacitor

accumulating a net negative charge. This creates an electric field, which causes the electrons to move

away from the top as they accumulate on the bottom plate, at an equal rate. This phenomenon

possesses a few key characteristics to consider when using capacitors and DC circuitry. [1]

Page 14: ENG460 Engineering Thesis - Murdoch University

4 | P a g e

Figure 2, Current Flowing Through A Capacitor

[Image created by Author]

Firstly as electrons accumulate on one capacitor plate and vacate the other; a voltage difference

emerges across the capacitor. Also, simultaneously, current will flow as there is electron movement in

progress. Capacitors are used to store charge, as charge can be stored on one plate. However the

negative charge on one plate is always equal to the positive charge on the other; consequently the total

net charge on both plates is zero. [1]

2.2.1 Pressure Tank Analogy

A good analogy to a capacitor is a pressure Tank Reservoir with an elastic diaphragm that separates the

inlet and outlet. As a pressure difference is applied across the input and output, the elastic diaphragm

will stretch as a result of a reacting force. The only flow that occurs in this system will be because of the

initial pressure within the tank that was displaced as a consequence of the stretching diaphragm. In this

analogy the pressure difference behaves like a voltage difference, the flow behaves like current, and the

diaphragm performs a same function as the dielectric material used in capacitors (refer to Figure 3).

Page 15: ENG460 Engineering Thesis - Murdoch University

5 | P a g e

Figure 3, Capacitor Analogy with Pressure Tank

[Image created by Author]

2.2.2 Voltage And Stored Charge Relationship

The relationship between charge and voltage of an ideal capacitor is:

q = Cv (1)

Equation 1, Ideal Capacitor Voltage Charge Relationship

That is, the charge stored, in units of Coulombs, is directly proportional to the voltage across the

capacitive plates. The proportionality constant is called the capacitance C. Furthermore it is measured in

Farads, a unit of measurement that describes how many Coulombs are stored per Volt. For most typical

applications a Farad is considered to be an excessively high amount of capacitance. The general range of

capacitance used in most electronic applications is from a few picoFarads to 0.01 Farad. [1]

2.2.3 Current And Voltage Relationship

For a capacitor the relationship between voltage and current is:

(2)

Equation 2, Capacitor Voltage Current Relationship

This equation reveals two important characteristics of any capacitor. Firstly suppose the current was to

flow through at a constant rate, the charge will accumulate and the voltage will linearly increase.

Secondly if there is no change in voltage across the capacitor the current is zero and the charge is

constant. In steady state DC voltage operation a capacitor usually behaves like an open circuit. [1]

Page 16: ENG460 Engineering Thesis - Murdoch University

6 | P a g e

2.2.4 Characteristics Of Parallel Plated Capacitors

Figure 4 below shows the dimensions of a parallel plate capacitor. Each rectangular plate has an area A

(W×L), a width W, and a length L. Between the plate pair is a distance denoted as d, that is occupied

with a dielectric insulator. Provided both the length and width of the plates are much larger than the

distance between them the capacitance can be approximated by:

(3)

Equation 3, Parallel Plate Capacitor Equation

[1]

The dielectric constant is denoted by . The dielectric constant is different for each material as indicated

in Table 1.

Figure 4, Parallel Plate Capacitor Dimensions

[Image created by Author]

Material Relative Dielectric Constant r Dielectric Constant r× 0

Air 1 0=8.85× F/m

Diamond 5.5 4.87× F/m

Mica 7 6.20× F/m

Polyester 3.4 3.01× F/m

Quartz 4.3 3.81× F/m

Silicon dioxide 3.9 3.45× F/m

Distilled Water 78.5 6.95× F/m Table 1, Dielectric Constants For Selected Materials

Page 17: ENG460 Engineering Thesis - Murdoch University

7 | P a g e

The dielectric insulator works because the molecules within the dielectric medium exhibit an electric

field in the opposite direction. This effect occurs because of the charges on the plates. The dielectric

produces the electric field because of the electric dipole moments of the molecules within the dielectric.

When a dielectric insulator is placed within a charged capacitor its molecules become polarized such

that the net dipole moment is in parallel with the electric field. For instance if the molecules are polar

(initially random orientation) they are aligned because of the torque induced by the field. If the

molecules are non-polar, they are induced to be parallel to the field. In both cases the dielectric

becomes polarized as indicated in Figure 5. [3]

Figure 5, Molecules In External Electric Field

[4]

The creation of the surface charge on the dielectric insulator is caused by the net effect of the

polarization within the dielectric. ‘Bound charge’ refers to the charge within the dielectric. It is called

bound charge because unlike the free charge on the conductive capacitive plates, it is bound to the

molecules of the dielectric and cannot move. The polarity across the polarised dielectric insulator is

opposite to the capacitive plates; consequently, the net electric field is reduced between the plates. [3]

Figure 6 shows this effect, as compared to the polarity without a dielectric insulator.

Page 18: ENG460 Engineering Thesis - Murdoch University

8 | P a g e

Figure 6, Electric Field With/Without Insulator

[Image created by Author]

2.2.5 Parasitic Effects

Capacitors in the real world cannot always be modeled exclusively with just a capacitance. A real-world

model circuit for a capacitor is provided in Figure 7. The series inductance Ls occurs because any current

that flows into the capacitor generates a magnetic field. The series resistance Rs occurs because there is

resistivity in the materials used in the capacitive plates. Lastly, there are no insulating materials that act

as a perfect insulator; consequently, there is a resistance through the dielectric represented by Rp. Rs, Rp

and Ls are parasitic elements and they are always present in some degree. In circuit design care must be

taken to select components where parasitic elements do not jeopardise proper operation of the circuit.

[1]

Page 19: ENG460 Engineering Thesis - Murdoch University

9 | P a g e

Figure 7, Capacitor Including Parasitic Elements

Adapted from [5]

2.2.6 Capacitor Orientations And Charge

Figure 8 shows two capacitors that are connected in series. The charge across the first capacitor (C 1) is

equal to the charge across the second capacitor (regardless of its capacitance) and the charge across

both capacitors. This is because when the charge +Q appears on the first plate (from the positive

terminal) the electric field from that charge induces an equal negative (-Q) charge on the inner plates of

C1. To achieve this, electrons are withdrawn from the first plate of the second capacitor, while

generating a positive charge of equal magnitude. Thus through the electric field, the electrons are

attracted to the outer plate of the second capacitor and a corresponding negative charge (-Q) is

produced.

Page 20: ENG460 Engineering Thesis - Murdoch University

10 | P a g e

Figure 8, Charge And Series Capacitors Relationship

[Image created by Author]

2.3 Capacitive Sensing Circuits

2.3.1 Oscillators

Many electronic instruments have an oscillator or waveform generator of some sort. A typical oscillator

is required for any instrument that functions periodically, or initiates functions, or employs periodic

waveforms for cyclical measurement. For instance oscillators are used in every computer peripheral

from discs, printers and tapes. They are used in almost all digital instruments such as computers,

oscilloscopes, digital multimeters, receivers, calculators, counters, timers. Usually a device absent of an

oscillator is a slave and only operates when polled by a master device (that typically contains an

oscillator). [6] The following section explores popular oscillators, such as the RC relaxation oscillators to

a ‘digital logic’ inverter oscillator. [6]

Page 21: ENG460 Engineering Thesis - Murdoch University

11 | P a g e

2.3.1.1 Relaxation Oscillators

One of the simplest types of oscillators is made by charging a capacitor through an RC circuit. After the

capacitor reaches a threshold voltage limit it is quickly discharged. This is accomplished as the external

circuit reverses the polarity causing the capacitor to discharge as well as changing the current direction

when the threshold is reached. Typically the capacitor generates a triangle wave rather than a sawtooth

wave (the latter occurs when capacitor discharges to ground). Relaxation oscillators are based upon this

principle.

Relaxation oscillators have historically been constructed with negative-resistance devices like neon

bulbs or uni-junction transistors. Modern practices however favor both special IC timers and operational

amplifiers. Figure 9 below illustrates a commonly used RC relaxation oscillator. [6]

Figure 9 , Operational Amplifier Relaxation Oscillator

Adapted from [7]

The operation of this circuit is straightforward and based on the popular Schmitt trigger circuit. [6] By

assuming the operational amplifier output is initially in positive saturation mode (the inverting terminal

is charging to half V+); the capacitor charges up until it reaches half of V+ with an RC time constant of

. After the capacitor is charged to half of the supply voltage, the output of the operational

amplifier switches to negative saturation mode. In this mode the capacitor discharges with the same

time constant towards a voltage that is half of V-. This cycle repeats at a period of about 2.2RC and

generates an output voltage with the same frequency. It is recommended that a CMOS output-stage op-

amp is chosen so that the output saturates cleanly. [6]

Page 22: ENG460 Engineering Thesis - Murdoch University

12 | P a g e

2.3.1.2 CMOS Inverter Oscillator

Oscillators that use CMOS inverters can have a distinct advantage of having very low noise content or

low side noise. Figure 10, illustrates a simple circuit that shares this desirable quality. A pair of CMOS

inverters (typically used for digital logic) are connected in series to form an RC relaxation oscillator. As

well as producing low noise qualities, even at higher frequencies (i.e 100 kHz) it also has the added

advantage of outputting a squarewave at digital logic voltages. [6]

Figure 10, CMOS Inverter Oscillator

[Image created by Author]

2.3.2 Sensing Capacitance Using A Microcontroller

2.3.2.1 Astable Multivibrator Using A Microcontroller

Figure 11 is an astable multivibrator circuit that uses a microcontroller. This simple circuit has a

microcontroller that calculates the capacitance through a frequency determining component of the

astable multivibrator. The capacitance, Cx is to be measured by repeatedly charging and discharging the

capacitor via digital output pin A. The firmware is simple; suppose that the input voltage at pin B is ‘low’,

causing pin A to output high-voltage (typically 5 V). This eventually charges pin B to a digital logic ‘high’.

The firmware then causes pin A to output ‘low’. To summarise, if input ‘pin B’ is low, output pin A is set

to ‘high’ and if input ‘pin B’ is high, output pin A is set to ‘low’. Consequently this circuit produces a

squarewave signal at pin A, with a frequency that can be used to calculate Cx, based on a known R. [8]

Page 23: ENG460 Engineering Thesis - Murdoch University

13 | P a g e

Figure 11, Microcontroller-Astable Multivibrator

[Image created by Author]

While this setup is good at measuring larger capacitances, it is not very good at measuring capacitances

in the lower picoFarads range. The lower the capacitance, the higher the output frequency for a fixed R,

as capacitance is what determines an RC time constant. Under these circumstances, to keep frequencies

slow enough when monitoring capacitors in the picoFarads range with a micro controller, the resistance

needs to be increased to the mega Ohms region. However increasing the resistance to this range will

jeopardise reliability of capacitive measurements because of the internal input resistance at pin B, which

is rated at 100 MΩ. Moreover say R is also 100 MΩ; when Pin A is high, the impedance from pin B is in

parallel with the capacitor. When Pin A is low, Pin B is in parallel with R, draining the capacitor with an

equivalent 50 MΩ Circuit, which again jeopardises the reliability of the frequency and calculated

capacitive measurement. [8]

2.3.2.2 QTouch

The QTouch technique uses a charge transfer scheme, with a setup shown in Figure 12. Here, the charge

from the small capacitor, Cx is incrementally stored into the large capacitor, CL. As indicated in Figure 12,

there are very few components required to create this circuitry. In comparison with Figure 11, only an

extra capacitor is required to replace the existing resistor.

The small capacitor Cx is cyclically charged and then discharged into the larger capacitor CL, until the

voltage across it meets a threshold. When this threshold voltage is met, the microcontroller counts the

Page 24: ENG460 Engineering Thesis - Murdoch University

14 | P a g e

number of charge cycles completed. Finally all capacitors are discharged so that the process can begin

again. The QTouch system uses the number of counts to identify any changes in the capacitance of Cx.

Because QTouch measures the summation of charge over a number of intervals; it is a technique that

has an added benefit of being reasonably immune to interfering signals. For further information refer to

Figure 12. [8]

Figure 12, QTouch Technique

Pseudo Code from [9]

[Image created by Author]

Page 25: ENG460 Engineering Thesis - Murdoch University

15 | P a g e

Chapter 3 Approach

3.1 Chapter Overview In the previous chapters, key objectives for the design of a total capacitance measurement system for

water level sensing were described, and four existing capacitance sensing circuits were explored for

inclusion in this system. This chapter presents a design overview for the total capacitance measurement

system and the selection of peripheral components, based on these objectives. Finally, out of the four

sensing circuits that were explored, the QTouch technique was selected for use, and the relevance of its

benefits and limitations to this project are explained.

3.2 Peripheral Design Overview Figure 13 below illustrates the design overview that combines key and peripheral objectives discussed in

chapter 1. Each component has been selected for a unique reason that will be discussed in the following

‘3.3 Selection’ section.

Figure 13, Peripheral Design Overview

[Image created by Author]

Page 26: ENG460 Engineering Thesis - Murdoch University

16 | P a g e

3.3 Peripheral Selection

3.3.1 Eleven Microcontroller

The Eleven microcontroller board, shown in Figure 14, was selected because it was compatible with the

Arduino development environment. This development environment has an extensive range of libraries

that allow easy control of Arduino-compatible components, such as the Arduino LCD shield and the

MCP4725 DAC. The Eleven is 100% compatible with and is based on the existing Arduino Uno board [9].

The ICSP, headers and power jack are in identical locations to the Arduino Uno; enabling full

compatibility for all Arduino projects, sketches and shields. [9] The specifications of the Eleven

microcontroller are given in 3.3.1.1 Specifications.

3.3.1.1 Specifications

MCU Type Atmel ATMega328P

Input Voltage 7-12 V DC

Maximum Input Voltage Range

6-20 V DC

Operating Voltage 5 V

Digital I/O Pins 14 (with 6 able to provide PWM output)

Analogue Input Pins 6 (also has digital I/O pin functionality)

Analog Resolution 10 bits

Current Per I/O Pin 40 mA

Total Current For All I/O Pins

200 mA

Flash Memory 32 kB, with less than 1 kB occupied for Boot Loader.

SRAM, EEPROM 2 kB SRAM, 1 kB EEPROM

Serial 1 x hardware USART, SPI (Serial Peripheral Interface), I2C

Other Integrated Micro USB Port for programming and communication

[9]

Page 27: ENG460 Engineering Thesis - Murdoch University

17 | P a g e

Figure 14, Freetronics Eleven Board

3.3.1.2 Arduino Development Environment

The Arduino development environment controls any Arduino or Arduino-compatible microcontroller.

Software written within the Arduino development environment are called sketches. Sketches can be

managed with the typical Libraries, C files (.c), header files (.h) and C++ files (.cpp). Sketches are written

in the text editor. To assist debugging within the Arduino environment there is also a message area

toolbar with common functions (i.e. verify/upload) and a serial monitor with a text console. Arduino is

an electronic prototyping platform that utilises easy-to-use and flexible hardware/software. The Eleven

microcontroller platform was selected because it is 100% compatible with the Arduino development

environment and relatively affordable compared to other platforms. [10]

3.3.2 Freetronics LCD Display

The Freetronics LCD display, shown in Figure 15, [11] is an Arduino shield as it is capable of plugging into

an Arduino Uno compatible board. This shield can display 16×2 characters any one time and it is also

capable of being directly plugged in to a bread board. The LCD screen was set to operate in 4 bit mode

via the ‘LiquidCrystal’ library provided by the Arduino IDE. The ‘LiquidCrystal’ library allows an Arduino

board to control an LCD display in 4 or 8 bit mode and is based upon the Hitachi HD44780 chipset [11]. 8

bit mode can transfer twice as many bits as 4 bit mode; however 4 bit mode requires fewer I/O pins to

operate.

Page 28: ENG460 Engineering Thesis - Murdoch University

18 | P a g e

Figure 15, Freetronics LCD Display

3.3.3 MCP4725 12-bit DAC

The MCP4725 12-bit breakout board, shown in Figure 16, is used to output a variable voltage between 0

to 5 volts. The output voltage is controlled via I2C that allows the microcontroller to signal the desired

output voltage. I2C is a communication protocol that transmits data over two wires. The breakout board

also has an EEPROM so that any output voltages can be restored if the device is power cycled. In total

the breakout board has 6 pins: the supply voltage, ground, I2C address, voltage out, and both an SCL pin

and SDA pin to facilitate I2C Communication. The I2C address pin is left completely unconnected since

the default hex address 0x62 is used. [12]

One of the advantages of the MCP4725 breakout board was that it comes with an Adafruit MCP4725

library that does all the interfacing [12]. Although the library is very simple it also introduces some

additional functions that are used to control the breakout board. Firstly the function to set the I2C

protocol address was called begin(addr), where addr is 0x62-the default address for I2C. Also the

function to output a voltage value was setVoltage(value, storeflag) where value ranges from 0 to 4095,

and fractionally represents a proportion of the maximum operational voltage. If the storeflag is set to

‘true’ it tells the DAC to store the value in EEPROM for next time it starts: if storeflag is set to ‘false’

nothing will be stored to EEPROM. [12]

Page 29: ENG460 Engineering Thesis - Murdoch University

19 | P a g e

Figure 16, MCP4725 12-bit Break Outboard

3.3.4 Analogue Voltage To Current Circuit

In an industrial setting DC signals can be used to represent physical measurements such as motion,

pressure, flow, temperature and weight. Typically a DC current is preferenced over a DC voltage signal. A

DC voltage signal circuit varies when there is a change of resistance across a signalling wire, because of

resistive power losses. A DC current signal circuit, however, will transmit a constant current across a

circuit regardless of any changes in resistance. Also, current sensing instruments usually use lower

impedances to reduce power consumption, and noise immunity for current sensing instruments is

significantly improved compared to that of DC voltage signals. [13]

In order to represent a “physical quantity” with a current signal, a circuit that can produce a signal

current with precision is required. The use of an operational amplifier can hold a current to a prescribed

value, via outputting the necessary voltage to the load. An amplifier with negative feedback can perform

the same function as the current source. This amplifier circuitry can generate a precise current signal

across an unknown load resistance. [13]

Page 30: ENG460 Engineering Thesis - Murdoch University

20 | P a g e

[Image created by Author]

Figure 17, Transconductance Amplifier

Figure 17 illustrates the circuit diagram of a transconductance amplifier. The transconductance is

measured in Siemens and is the measure of ‘change in current divided by change in voltage’ (ΔI/ΔV). The

transconductance ratio is made constant by the 250 Ω resistor resulting in a linear ‘voltage in’ to

‘current out’ relationship. Moreover an input voltage range of 1-5V linearly corresponds to an output

current range of 4-20mA. [13]

3.4 Primary Selection

3.4.1 Conclusion And Choice For Capacitive Sensing

As discussed in Section ‘1.2 Objectives’ the key objectives in regards to the capacitive level sensing

circuitry are to seek to optimise the following:

Accuracy

Disturbance rejection

Noise rejection

Sampling rate

Economical operations

Construction cost

Each of these objectives will now be discussed in relation to the proposed solution in this thesis.

Page 31: ENG460 Engineering Thesis - Murdoch University

21 | P a g e

3.4.1.1 Accuracy

The charge transfer QTouch system was selected because; out of all the researched capacitive sensing

circuits it satisfied the most objectives. As the QTouch system is designed for detecting finger proximity

it has typically not been concerned with measuring actual capacitance values, such as a relaxation

oscillator used in a digital multimeter. Leakage (that is measured in charge per second or amps) that

exists within all electrical components from dielectrics to transistors/MOSFETs will undermine the

accuracy of the QTouch system, as it samples accumulated charge. In short, the alternative proposed

designs, such as the oscillators are better at detecting actual capacitance; however, the QTouch system

is very good at detecting changes in capacitance. For the purpose of developing a level sensor, the

detection of changes in capacitance within a set range aligns with this project.

3.4.1.1.1 Law of Large Numbers

The Law of Large Numbers is typically a justification for assuming statistical normality. It says that any

average set of independent random variables will converge to the mean as the number of samples

increase. For instance, when flipping a coin four times and the results may yield 75% heads and 25%

tales; however, if the number of coin flips were to approach infinity the results will always converge

towards its true mean of 50-50. Moreover the mean of heads will approach 0.5. [14]

3.4.1.2 Noise And Disturbance Rejection

For the application of detecting the liquid level within a tank, the types of noises or disturbances that

are undesirable are small fluctuations caused by electromagnetic interference (EMI) or slower

fluctuation caused by rippling waves on the water’s surface [15]. It is therefore desirable that a system

that can filter out ‘sudden pulses’. The procedure behind the QTouch system is that for each ‘capacitive

sense operation’ there is a small amount of corresponding charge stored into the larger capacitor. A

voltage threshold for the larger capacitor is set so that when it is met, the microcontroller counts the

number of cycles required. The microcontroller then uses this information to perform an averaging

calculation. The threshold voltage indicates the total charge stored and ‘the number of cycles’ indicates

how many ‘sets of charge’ were required. This information allows the microcontroller to perform a

‘summation of charge’ divided by the ‘sets of charge’ averaging function, that will reduce undesired

noise and disturbances being sensed. Note that one ‘set of charge’ can be considered equivalent to the

‘Count’ variable in both Figure 23 and Figure 12 pseudo code.

3.4.1.3 Economic And Construction Costs

The bulk of the materials cost of the QTouch system is in the microcontroller. Arduino-clone

microcontrollers can be priced as low as $10 on eBay. The rest of the circuitry is just the cost of the

associated wires, two 150 ohm resistors and the reference capacitor. The circuitry can be adapted to

increase sampling rate at the expense of increased power consumption, or the power consumption can

be decreased along with the sampling rate. Methods of decreasing power consumption and methods to

increase sampling rate are explored later in section ‘7.1 Future Work’. The QTouch system may

potentially offer a simple configuration where capacitive sampling is undertaken per each cyclical

charge.

Page 32: ENG460 Engineering Thesis - Murdoch University

22 | P a g e

3.4.2 QTouch Background

The QTouch proximity sensor, patented in 2011 was invented by both Harold Phillips and Kevin Snoad

[16]. It is a capacitive charge transfer based proximity sensor that includes a sensing element and a

known reference capacitor. This invention exclusively relates to proximity sensing, which is an high

demand function as human interfaces are increasingly leaning towards capacitive over mechanical touch

sensing. In the interfaces of everyday appliances such as phones, MP3 players and some modern panels

it is typical to find plastic panels or glass with a capacitive touch control system behind. [16]

The current QTouch system is designed for detecting objects such as fingers. Detecting the presence of a

finger is not as simple as typically there is only a very small capacitance in the order of a few picoFarads

( Farads). Furthermore this infinitesimal change in capacitance, for many systems, needs to be

detected upon an existing background capacitance in the order of tens of nanoFarads. This is where the

technology of the QTouch charge transfer excels. QTouch has been shown to sense in the most

challenging environments as it mandates a high signal to noise ratio (SNR). [17]

3.4.3 Further QTouch Development Requirements

The QTouch proximity sensor circuit as it stands infers the capacitance through counting the amount of

completed charge cycles. The design does not directly measure capacitance. For a capacitor level sensor

it is preferable to measure the capacitance directly; because from Equation 3 in Section ’2.2.4

Characteristics Of Parallel Plated Capacitors’, the capacitance will be directly proportional to the water

level. In this equation, the area and distance between the plates remains constant while the dielectric

ratio of ‘air to water’ varies; thus causing the capacitance to be directly proportional to the ‘dielectric

ratio’ and through it the water level. Therefore, further changes to the QTouch system are required to

create a capacitive meter.

The solution may rest in a physics problem from a textbook [3]. There is an example problem where two

capacitors connected in series, 6 µF and 12 µF, each initially uncharged experience a 12 V voltage

difference induced by a battery, refer to Figure 18.

Figure 18, Series Capacitors, Charge and Voltage

[Image created by Author]

Vs

Page 33: ENG460 Engineering Thesis - Murdoch University

23 | P a g e

The voltage between the capacitors is calculated by noting that the charge that goes through the first

capacitor also must pass through the second. Also a traditional KVL voltage loop is used to identify that

the voltage across the first capacitor and the second must equal the supply voltage. Therefore the

equations that describe Figure 18 are the following:

(4)

Equation 4, KVL Series Capacitors

Letting C1 and C2 be the capacitance across V1 and V2 respectively. Also by using Equation 1, and noting

that the charge across each capacitor must be equal:

(5)

Equation 5, Equivalent Charge

By using both the above equations, the voltage between the two capacitors may be solved. Furthermore

suppose that the voltage between the capacitors could be measured. In this scenario it is possible that if

the voltage at each node is known and one of the capacitor values the remaining unknown capacitor

may be solved for. In effect this circuit may operate as a capacitance meter that works by using a

reference capacitor. The following chapters will explore how this circuit can be used to further develop

the QTouch circuit into a capacitance meter. To achieve this certain questions will require answers, such

as ‘what happens to the charge across each capacitor if the first capacitor is holding an initial voltage?’

Simulations and real world testing will be used to identify these relationships in the preceding chapters.

Page 34: ENG460 Engineering Thesis - Murdoch University

24 | P a g e

Chapter 4 Assumptions

4.1 Chapter Overview

This chapter highlights some of the common assumptions made in electronic design, all of which fall

under the “ideal circuit” concept, such as perfect operation of circuit elements and absence of parasitic

effects. The effect of assuming an infinite impedance state for input pins in the QTouch circuit is also

discussed. These assumptions are then assessed and compensatory measures discussed.

4.2 Common Assumptions

In electronic system design it is common to use ideal circuit concepts or assumptions. These include

ideal operations of a perfect ground, the perfect amplifier, the perfect voltage or current supply and no

parasitic effects for all circuit components. Also in the context of the microcontroller, assuming infinite

impedance for input pins and zero impedance for output pins is another example.

In reality these perfect circuit elements do not exist. For instance a perfect ideal voltage source would

have zero impedance and would be able to maintain voltage supply across any load no matter what

current is required. For an ideal voltage source, as the resistance applied across it is reduced towards 0

Ω both the current and power required to maintain voltage would be increased towards infinity.

Furthermore suppose that a 5 V supply was to deliver a current of 2 A, if the voltage supply drops from

5.001 to 4.999 V the voltage source must have an internal impedance of approximately one milliohm.

[18]

One of the more unreliable suppositions that may undermine the accuracy of the QTouch sensor is

assuming an infinite impedance state for pins that are configured as inputs. In reality, because

capacitors are being charged up and left at static voltage levels, a very small amount of leakage will

undermine the capacitor’s expected ideal voltage levels. This may adversely affect the solving of any

ideal equations that use voltage levels across capacitors. Furthermore because input pins produce a high

impedance state, with nothing connected to them they may experience random changes in the form of

the surrounding environment’s electrical noise or capacitive coupling produced by nearby electronics

(i.e. such as other pins). [19]

4.3 Assessing the Assumptions

In electrical circuit design, real circuits are taken to be approximations of ideal circuits, and typically, it is

considered practicable to assume ideal circuit behaviour. However, it is important to realize that,

depending on the circuit design, discrepancies between modelled behaviour and actual behaviour may

be significant. In adapting the QTouch technique to this project, it was considered practicable to assume

ideal circuit behaviour and in Chapter 3 and later Chapter 5, ideal equations are used to model the

relationship between voltage and capacitance. However, ideal equations such as the charge transfer

equation (Equation 5) ignore small leakages of charge to the microcontroller which occur with the

QTouch technology. Since the charge transfer equation deals with static voltage, where it is difficult to

approximate the actual leakage, small leaks to the microcontroller may have a significant impact on the

accuracy of voltage measurements.

Page 35: ENG460 Engineering Thesis - Murdoch University

25 | P a g e

To compensate for this, the QTouch system was made to operate with very short delays between

iterations, to reduce the time for potential leakage before each sample is taken. The code for this is

provided in Appendix A.3.

Page 36: ENG460 Engineering Thesis - Murdoch University

26 | P a g e

Chapter 5 Methodology

5.1 Chapter Overview In previous chapters, the benefits and limitations of using QTouch for capacitance sensing in a water

level sensor were presented and discussed. Specifically, in 3.4.3 Further QTouch Development

Requirements, the approach taken to adapting the QTouch technology to meet the requirements of the

water level sensor was introduced, namely, to enable it to directly measure capacitance. In this chapter,

this approach is expanded upon in a mathematical investigation showing how the relationship between

iterated measurements of voltage and capacitance can enable the QTouch to measure capacitance using

the relationship equation. Next, circuit design for the water level sensor is discussed, and two designs

for the system are proposed. The final section in this chapter follows construction of the water elvel

sensing probes.

5.2 Evolving QTouch Into A Capacitance Meter: A Mathematical Investigation

5.2.1 Introduction

To develop the existing QTouch system into a capacitance meter a mathematical analysis of the system

is required. There is little information available in most textbooks about the behavior of capacitors in

series when there is charge initially stored in either capacitor. It is therefore important that a series of

mathematical investigations and/or simulations are required to map initial voltage and capacitance

relationships. These circuit simulations are run in Intusoft ICAP/4 Spice software package [20].

5.2.2 Investigation Objectives

The QTouch method cyclically charges the second capacitor into the first capacitor for a limited amount

of times, and then afterwards grounds both capacitors before continuing further cyclical charge

operations. This investigation seeks to identify the mathematical relationship between both capacitors,

supply voltage, the voltage across each capacitor and the voltage during each iteration of passing charge

through the coupled capacitors.

Page 37: ENG460 Engineering Thesis - Murdoch University

27 | P a g e

5.2.3 Investigation

To replicate the QTouch charging process a Spice (ICAP) simulation was performed based on a model

using ideal equations. A capacitor of 10 nF was put in series with a 1 nF capacitor as shown in Figure 19.

Figure 19, QTouch Simulation

Initially the spice simulation was run with a voltage of 100 V applied across both capacitors. The initial

voltages for both the capacitors where set to 0. After the simulation was run, the’ transient response’ of

the voltage at node 2 (voltage across C2) was graphed and the steady state voltage was computed as

90.909 volts. To parallel the QTouch technique described in section ‘2.2.2.2 QTouch’, the steady state

voltage (at node 2) of the first Spice simulation (90.901 volts) was used to calculate the initial voltage of

capacitor C1 for the next iterative simulation. Moreover, to achieve this initial voltage at node 2, the

initial condition across C1 was set to ‘node 2 voltage subtract the supply voltage’ or 9.09 volts, see

Figure 20. The simulation was again run and the second steady-state response at node 2 was 82.644

Volts. This action of observing the voltage at node 2, to use it for the initial voltage of the next

simulation was carried out 10 times. The results are tabled below in Figure 21 and Table 2.

Node 2

Page 38: ENG460 Engineering Thesis - Murdoch University

28 | P a g e

Figure 20, QTouch Spice Simulation Initial Condition

Figure 21, QTouch Simulation Results

Page 39: ENG460 Engineering Thesis - Murdoch University

29 | P a g e

Voltage (V) @ Node 2

Simulation Iteration

90.9091 1

82.6446 2

75.1315 3

68.3013 4

62.0921 5

56.4474 6

51.3158 7

46.6507 8

42.4098 9

38.5543 10 Table 2, QTouch Voltage Per Iteration

5.2.3.1 Iteration One

Both capacitors in series will have no initial voltage across them when the 100 V is applied. As such the

total charge across the first capacitor is going to be equal to the total charge across the second

capacitor. It is therefore that Equation 4 and Equation 5 maybe combined to solve for the voltage at

node 2.

( )

( )

This calculated result is the same result produced from the first iteration of the spice simulation.

5.2.3.2 Other Iterations

In the second simulation iteration, C1 had an initial voltage of 9.0909 volts. All the charge that goes

through the first capacitor must also go through the second capacitor, regardless of the initial voltage

across C1. However, according to Kirchhoff’s voltage law, one must now consider the initial voltage

across C1 as it is a part of the loop. Consequently the new equation is as follows:

( ) ( )

( )

Through defining as (n) - (n-1) both these equations may be rewritten as:

( ) ( ) (6)

Equation 6, KVL With Initial Conditions

( ( ) ( )) (7)

Equation 7, Equivalent Charge With Initial Condition

Page 40: ENG460 Engineering Thesis - Murdoch University

30 | P a g e

Through equating Equation 6 and Equation 7 the combined equation is:

( ( ) ( )) ( ( )) (8)

Equation 8, Both Equations 6 And 7 Combined

Later in this section a recursive solution for Equation 8 will be obtained, as there are further advantages,

later discussed. For now the mathematics program ’scientific notebook’ by Mackichan Software Inc [21],

will be employed to provide the recursive solution for Equation 8 and will later be used to compare with

our calculated solution. To allow ‘Scientific Notebook’ to compute Equation 8 we replace our variables

with one letter symbols, see Table 3. For instance:

Our Variable Symbol Used In Scientific Notebook Name

C1 A Capacitor One

C2 B Capacitor Two

Vs V Supply Voltage

V1(n) y(n) Voltage Across Capacitor One Table 3, Scientific Notebook Variables

Figure 22, Scientific Notebook Recursive Solution

By taking the recursive solution from Figure 22 and substituting V1(n) with ‘Vs – V2(n)’ (in accordance with

KVL) the resulting solution is:

( ) (

) (9)

Equation 9, Recursive Solution For 'Node 2' Voltage

Where V2(n) is the voltage at node 2.

-

Page 41: ENG460 Engineering Thesis - Murdoch University

31 | P a g e

Iteration (n) Equation 9, Recursive Solution For 'Node 2' VoltageEquation9 applied to Figure 19

Calculated Voltage At Node 2

1 (

)

90.9091

2 (

)

82.6446

3 (

)

75.1315

4 (

)

68.3013

5 (

)

62.0921

6 (

)

56.4474

7 (

)

51.3158

8 (

)

46.6507

9 (

)

42.4098

10 (

)

38.5543

Table 4, Calculated Iteration Voltage

The calculated results from Equation 9 of Table 4 are the same results that were computed from the

Spice simulation in Table 2.

5.2.3.3 Solving/Enhancing The Recursive Formula

By Using Equation 8 and substituting V1(n) with ‘Vs-V2(n)’ or V1(n-1) with ‘Vs-V2(n-1)’ as in accordance with

KVL, we get:

( ( ) ( )) ( ) (10)

Equation 10, QTouch Recursive Formula At Node 2

The simplification involving cancelling out the supply voltages in Equation 10assumes that the supply

voltage will remain constant throughout iteration cycles. By taking Equation 10 and adding 1 to each ‘n’

term the equation becomes:

( ( ) ( )) ( ) (11)

Equation 11,QTouch (n+1) Recursive Formula

Page 42: ENG460 Engineering Thesis - Murdoch University

32 | P a g e

By equating both Equation 11 and Equation 10 through the common V2(n) term:

( ) ( ( )) ( ) ( )

To again substitute Equation 11 a second time the resulting equation would be:

( ) ( ( )) ( ) ( )

The pattern that emerges from this series of consistent substitution is the following:

( ) (

) ( ) (12)

Equation 12, The Recursive Moving Average Equation

Notice how this equation will allow us to solve for C2 using any two voltage iterations sampled from the

QTouch’s cyclical measurements. Moreover if we set x to equal n and assumed that V2(0) is equal to the

supply voltage

( ( ) (

)

) ( )

And assuming V2(0)=Vs

(

) ( )

Note how this is the same solution as Equation 9 that was computed by scientific notebook.

5.2.4 Investigation Conclusion

The investigation was successful in the sense that it was able to identify some significant mathematical

relationships. Firstly Equation 9, allows the microcontroller to calculate a corresponding average

capacitance over the course of consecutive charges from both any voltage detected at node 2 and by

counting the number of charges executed. Secondly Equation 12 may be used to calculate a

corresponding moving average capacitance between two sampled voltages, at different iterations, at

node 2. Finally both Equation 4and Equation 5 may be used to calculate a capacitance from a single

charge and the voltage difference applied across both series capacitors.

The current QTouch design does not sense voltage between the capacitors. Therefore the circuit must

be altered so that the equations from this investigation may be applied and the initial QTouch proximity

sensor may be developed into a ‘capacitance meter’. The algebra required to manipulate the equations

discovered in this investigation so that they can be used with Arduino’s C language, is provided in the

Appendices.

Page 43: ENG460 Engineering Thesis - Murdoch University

33 | P a g e

5.3 Adapted QTouch Capacitance Meter Circuitry

5.3.1 The QTouchvs ‘QTouch Analogue’ Design

The analogue QTouch design is almost identical to the pre-existing QTouch proximity sensor. The only

difference between the two is that the digital read pin is substituted with an analogue read pin. Also the

pseudo code is changed to accommodate for this hardware difference (see Figure 23). While the

differences between ‘QTouch’ and ‘QTouch analogue’ are difficult to explain, a simplified water analogy

can still illustrate key operations.

Figure 23, QTouch Analogue Design

[Image created by Author]

5.3.1.1 The QTouch Design Analogy

Suppose a person pours a bucket of unknown volume into a larger tank with a known volume. One

method to determine the volume of the bucket is to count how many times the bucket is emptied into

the tank to fill it to a set level. The volume of the small bucket can be calculated by dividing the occupied

volume in the tank with the number of fills, as shown in Figure 24. In essence this is how the ‘QTouch’

system operates, where the small capacitor constantly fills a large capacitor until a ‘digital low’ is

sampled at which point the ‘number of fills’ is counted to provide an indication of the small capacitor’s

value capacitance.

Page 44: ENG460 Engineering Thesis - Murdoch University

34 | P a g e

Figure 24, Qtouch Analogy

[Image created by Author]

5.3.1.2 QTouch Analogue Analogy

5.3.1.2.1 Equation 9

‘QTouch Analogue’ has two key equations that operate in slightly varying ways, Equation 9 behaving

most similarly to the initial QTouch system. This equation operates identically with initial designs but

with one difference. Rather than waiting for the system to reach a threshold voltage to calculate the

capacitance; it senses the voltage level across the capacitor and calculates the average capacitance at

any measurement.

A real-world analogy of this, a small bucket of unknown volume is repeatedly poured into a tank with

known volume. Whenever the observer wants he can measure the tank level while also knowing the

number of pours transpired. Again with the total volume divided by the number of pours the observer

can calculate the volume in the small bucket without waiting for the level to reach threshold, as the

threshold is now always set to the water level, see Figure 25.

Page 45: ENG460 Engineering Thesis - Murdoch University

35 | P a g e

Figure 25,QTouch Analogue Equation 9 Analogy

[Image created by Author]

5.3.1.2.2 Equation 12

Within the QTouch Analogue design, Equation 12 measures the unknown capacitance through detecting

the difference between two voltages and counts the iterations between both samples. It is similar to

Equation 9, only that it will calculate the capacitance from any reference voltage rather than just the

initial supply voltage at the beginning of the cycle. Moreover Equation 12 calculates the capacitance

from a recent change in voltage instead of the total change in voltage.

An analogy for Equation 12 is it determines the volume in the unknown bucket by measuring change in

level over a series of set bucket emptying actions. In other words an observer measures the level in the

tank then leaves to come back after the tank has accumulated two more bucket pours. The observer

then measures the water levels difference, and notes that only two bucket pours have occurred and

calculates the volume of the unknown bucket, see Figure 26.

Page 46: ENG460 Engineering Thesis - Murdoch University

36 | P a g e

Figure 26, QTouch Analogue Equation 12 Analogy

[Image created by Author]

5.4 Single Charge Based Capacitance Meter Circuitry

5.4.1 Introduction

As previously discussed, Figure 18 and its applied Equation 5 can be used to create a type of capacitance

meter that functions through using a reference capacitor. The Arduino UNO compatible or Eleven

microcontroller boards have an analogue reference capability that allows the user to set the top input

range of the 10 bit analogue input. For instance the default 0 to 5 V range can be altered to 0 to 2.5 V.

[22] knowing this, the locations reference capacitor and measured capacitor must be selected.

As shown in Figure 27, the pin above C1 is switched between output high and low. The pin below C1 is

switched between an analogue input to output low (or ground). The high state can be assumed to be 5

V, as that is the operating voltage for Arduino Uno compatible boards. The sampling resolution and/or

range of the analogue input pins will contribute to the accuracy of the capacitance measurement. The

capacitance vs voltage (at pin B) relationship will also affect accuracy. Therefore the mathematical

relationship between the voltage at pin B, and the allocation (at C1 or C2) of the unknown capacitance

was investigated.

Page 47: ENG460 Engineering Thesis - Murdoch University

37 | P a g e

Figure 27, Single Charge Based Capacitance Meter

[Image created by Author]

5.4.2 Investigation

The relationship between both capacitors and the voltage at pin B (V2) (Figure 27) can be mathematically

modeled by combining Equation 4 and Equation 5. Both these equations can be combined to form either

the ratio of C1/C2, see Figure 28 or the ratio of C2/C1, see Figure 29.These equations and corresponding

graphs are shown below, with the supply voltage assumed to be 5 V.

Page 48: ENG460 Engineering Thesis - Murdoch University

38 | P a g e

Figure 28, C1 Vs C2 Ratio

Figure 29, C2 Vs C1 Ratio

Page 49: ENG460 Engineering Thesis - Murdoch University

39 | P a g e

5.4.3 Conclusion

It is more desirable to make C1 the unknown capacitance as the voltage-capacitance relationship will

mimic the behavior of the graph in Figure 28. This is desirable because the AREF Arduino IDE function

[22] can set the analogue input pin with 10 bit resolution to sample a ‘0 to 2.5 V’ range. This is more

preferable than the whole default ‘0 to 5 V’ range as it will focus on the more linear behaving section of

the curve. The trade-off is that if C1is larger than C2 it will cause the voltage at pin B to exceed 2.5 V. It is

therefore important to ensure that C2 is always larger than C1.Figure 30 illustrates how closely the ‘0 to

2.5 V’ analogue input range is to a perfect linear equation.

Figure 30, C1/C2 Line Versus Linear Comparison

The nonlinearity of the C1/C2 ratio means that unlike the linear counterpart it will not share uniform

accuracy across the whole range. For instance this line will give better resolution for smaller C1/C2 ratios

at the expense of ratios that are closer to 1. As it is very close to a linear line it should still provide a

highly reasonable 10 bit resolution across the 0 to 2.5 V range. Thus the final circuit diagram for the

‘Single Charge Based Capacitance Meter’ is indicated in Figure 31 .

0

0.2

0.4

0.6

0.8

1

1.2

0 0.5 1 1.5 2 2.5 3

C1/C2 Ratio

Linear y=x/2.5

C1/C2 C1/C2

Voltage

Page 50: ENG460 Engineering Thesis - Murdoch University

40 | P a g e

Figure 31, Final Single Charge Circuit Diagram

[Image created by Author]

5.5 Construction

5.5.1 Introduction to Capacitive Plate Design

Capacitor probe instruments operate from sensing the variation in capacitance that is caused by a

change in the dielectric material between probes. Parallel plated capacitors are constructed with two

plates that are isolated from each other and are also separated by a dielectric. The capacitance, or the

electron storage capability of a capacitor, is dependent on the distance between the coupled plates, the

dielectric constant or material between the coupled plates, and the area of the plate, as was established

in Equation 3.

Page 51: ENG460 Engineering Thesis - Murdoch University

41 | P a g e

5.5.2 Capacitive Plate Design And Error Considerations

One of the most important aspects of a capacitor level sensor is the dielectric constant of the process

material. It must be considered that the dielectric constant of the processing material may be

dependent on any internal change in temperature, humidity, moisture content and density. It is easier

and more reliable to measure the level of process materials with a higher dielectric constant. Materials

with a higher dielectric constant are ideal candidates for capacitive level measurement because they

induce a pronounced and greater change in capacitance that is less likely to be mistaken for

environmental noise. In comparison, materials with low dielectric constants such as sand, plastics and

glass do not make great candidates for capacitive measurement applications.

Sensitivity of a parallel capacitive probe can be increased in two ways, by decreasing the distance

between or by increasing the area of the coupled plates. It is important that the plates are close

together but also not too close so the processing material does not get trapped between them or be

prevented from flowing freely. High viscosity, wet and sticky materials may cause coating or permanent

build up within the probes and cause level measurement errors.

In the case of a water level sensor, as the water level drops the probes could remain wet resulting in a

water-air dielectric insulation combination. A quicker fall in water level results in larger false readings of

level measurements. It is also important to ensure that capacitive plates are well insulated, to prevent

the water, which is highly conductive due to dissolved ions, from short-circuiting between electrodes.

5.5.3 Capacitive Plate Construction

The Capacitive level sensing probes were constructed from two long, flat aluminium plates. Aluminium

was selected for the material as it was cheaper than copper but also highly conductive [3]. Each

capacitive plate was 1.05 m in length and 5 cm in width. Initially the distance between the plates was 4

mm but the capacitor probe had to be dismantled and reconstructed because of insulation problems.

The original capacitive probe construction is shown in Figure 32.

Page 52: ENG460 Engineering Thesis - Murdoch University

42 | P a g e

Figure 32, Initial Capacitive Probe Construction

Two coats of Electrical insulation varnish (also known as ‘ULTIMEG 2000 372’) were used to cover both

capacitive electrodes. This approach was not successful in that microscopic spots were left uncovered,

and enabled the water to conduct electricity through the plates. Also both plates would easily obtain

small scrapes when their edges and corners touched other objects, such as the ground. Because the

capacitive plates were not properly electrically insulated, the acrylic plastic that was used to separate

the plates had to be destroyed. This allowed for further attempts to re-insulate both capacitive plates.

To ensure both capacitor probes were electrically insulated they were taken to a facility run by ‘Global

Rewinds Pty Ltd’, a company that makes and sells customized motors. At the facility there was a

varnishing pool and a large 12.5 tonne varnishing oven, traditionally used to insulate internal motor

coils. Both capacitive plates were dipped in this varnishing pool and then afterwards left in the

varnishing oven for three hours.

Even capacitive plates need shoes right?

The bottom corners of the plates were most susceptible to high-pressure contact with other objects that

would result in small scratches that would prevent proper insulation. To prevent scratches from

occurring a rubber coating was applied to the bottom 5 cm of the plates. Masking tape was used to

ensure that the rubber would not be applied above the 5 cm threshold (Refer to Figure 33).

Page 53: ENG460 Engineering Thesis - Murdoch University

43 | P a g e

Figure 33, The Capacitor Plates Preparation For Rubber Boots

After the rubber coating was applied, duct tape was used to wrap the rubber coating to further protect

against any potential knocks (see Figure 34). Finally a rubber coating (Figure 35) was applied across the

whole capacitive probe. The rubber coating is designed to prevent the insulating varnish from being

scratched, as the rubber helps distribute the force from foreign objects and maintain insulating integrity.

To separate the electrodes, square plastic, toothpicks-sized blocks were placed against a capacitive plate

and wrapped up with a single plate in electrical insulation tape (Figure 36). Finally the coupled

electrodes were held together by rubber bands (Figure 37).

Figure 34, Capacitor Probes Duct Tape

Page 54: ENG460 Engineering Thesis - Murdoch University

44 | P a g e

Figure 35, Leak Seal Used For Rubber Coating

Figure 36, Rubber Coating And Wrapped Plastic Spacing

Page 55: ENG460 Engineering Thesis - Murdoch University

45 | P a g e

Figure 37, Capacitive Probes Held Together With Rubber Bands

5.5.5 Conclusion

The capacitive probes have a submergible length of 1.05 m and a width of 5 cm and a coupled spacing

distance of 2 mm. The rubber coating along the plates was applied equally; however the extra

reinforcing duct tape at the bottom alters the distance between the plates for the first 5 cm. The

application of the duct tape and rubber coating was to create a more robust capacitor probe that could

sustain physical scratches without causing a reduction in accuracy.

Page 56: ENG460 Engineering Thesis - Murdoch University

46 | P a g e

Chapter 6 Results

6.1 Chapter Overview Following on from the methodology and design discussed in Chapter 5, this chapter presents the results

of three experiments. The first experiment compared the measured capacitance of different capacitors

as taken by a high-accuracy digital multimeter, the QTouch Analogue Circuit and the Single Charge

Circuit. This compared the accuracy of the three technologies. In the second experiment, capacitor

probes were used in the developed water level sensor, utilising the QTouch Analogue Circuit, to

measure the water level of a tank, to test the relationship between measured capacitance and water

level.

6.2 Experiment 1 In Table 6 a range of ceramic capacitors from 1.8 pF to 10 nF were measured with a high-accuracy digital

multimeter Q1156, the Single Charge circuit, (discussed in 5.3 Single Charge Based Capacitance Meter

Circuitry) and the QTouch Analogue Circuit (discussed in 5.2 Adapted QTouch Capacitance Meter

Circuitry). The rated tolerance across the set of ceramic capacitance was ±10%. The rated accuracy for

the Q1156 DMM, is indicated in Table 5 below and also is included in the appendix. It is also important

to note that alligator probes are used, which could easily induce a further measurement error on

account of the capacitance induced from the probes.

Table 5, DMM Q1156 Accuracy

For a 0 to 200 nF range the accuracy of the Q1156 DMM is defined by ±(1%+5d), where ‘d’ is the

resolution. Therefore for measuring a 1.8 pF capacitor the multimeter has a rated uncertainty of

±(1.8pF×0.01+5×1pF) or ±5.018pF.

The experiment that produced the results in Table 6 was conducted in the following way. A set of

ceramic capacitors with 10% tolerances were measured by the DMM Q1156, Single Charge Circuit and

the QTouch Analogue Circuit. The goal of this experiment was to measure the change in capacitance as a

ceramic capacitor was introduced to each measuring system. Both circuits measured a certain amount

of picoFarads when there was no capacitor present. This amount was subtracted from the result of the

measurement devices.

The analogue QTouch system would run until, the voltage on the measured capacitor would be more

than a 2.5 V threshold. At this point the average charge would be inferred from the voltage to calculate

the capacitance measurements. The Single Charge Circuit was run for 10 seconds and the results were

Page 57: ENG460 Engineering Thesis - Murdoch University

47 | P a g e

averaged then recorded. Both programs used for these experiments are provided in the appendices of

this thesis.

Rated Ceramic Capacitance

DMM Q1156 Single Charge (14.39nF) No Tear

Analogue Qtouch (101.2nF)

0pF (capacitor removed) 10pF 23.5pF 54.5pF

Rated Ceramic Capacitance (with subtracted initial 0pF reading)

DMM Q1156 Change

Single Charge (14.39nF)

Analogue Qtouch (101.2nF)

0pf (capacitor removed) 1pF 1.5pF -0.07pF

1.8pF 2pF 6.5pF 2.56pF

4.7pF 7pF 8.05pF 5.22pF

8.2pF 11pF 13pF 8.68pF

33pF 35pF 39.5pF 33.66pF

47pF 47pF 53.22pF 45.9pF

101pF 107pF 104.8pF 102.19pF

331pF 331pF 347pF 339pF

471pF 440pF 466.4pF 451pF

681pF 647pF 687pF 663pF

1nF 942pF 968pF 964pF

2.2nF 2.2nF 2352pF 2275pF

10nF 10.6nF 12856pF - Table 6, Measured Capacitances

6.2.1 Discussion

From these results it appears that the analogue QTouch system is more correlated to the capacitor

ratings than the single charge circuit. As the single charge circuit would typically read a slightly higher

capacitance then both the competing capacitive measurement devices and the ratings for the ceramic

capacitors. It is difficult to totally dismiss any measuring system here as the ceramic capacitors only have

a ±10% tolerance. Also the Q1156 at small values is not reliable because 5d is more than 1%, refer to

Table 5. Therefore it is reasonable to conclude that the actual capacitor value is not known in this

experiment.

There are a few ways in which this experiment could have been improved. Firstly smaller alligator

probes could have been used to reduce the capacitance caused by the parasitic effects upon the leads.

Secondly upon reflection each capacitor may have been mixed up with another identically rated ceramic

capacitor upon being retrieved for measurement. This could have induced a perceived error across the

tolerance of the ceramic capacitors. Finally an additional DMM Q1156 could be used to create a dataset

and identify any measurement outliers that may be produced.

6.3 Experiment 2 The following experiment has been conducted in the interests of satisfying all the recommendations

that were discussed in section ’6.2.1 Discussion’. That is smaller alligator leads, an additional DMM and a

single capacitor was used for each rating-variation. Also more capacitors were used as well as a larger 0-

Page 58: ENG460 Engineering Thesis - Murdoch University

48 | P a g e

15.3nF range to better reflect the capacitance variation for the capacitor probes. In addition the single

charge transfer circuit has been excluded from the experiment as it has not produced the same level of

accuracy as the analogue QTouch circuit in experiment 1, as shown in Table 6.

Capacitor(pF) 10%

An-QTouch (101.2nF)

Within Rated Capacitance

No1.Q1156 Within Rated Capacitance

No2.Q1156 Within Rated Capacitance

1.8 1.99 FALSE 3 FALSE 4 FALSE

2.2 2.51 FALSE 3 FALSE 3 FALSE

4.7 4.9 TRUE 6 FALSE 7 FALSE

8.2 8.68 TRUE 9 TRUE 10 FALSE

33 33.5 TRUE 33 TRUE 34 TRUE

47 45.27 TRUE 46 TRUE 47 TRUE

82 83.1 TRUE 85 TRUE 86 TRUE

101 102.66 TRUE 104 TRUE 104 TRUE

151 150.33 TRUE 153 TRUE 151 TRUE

221 229.77 TRUE 225 TRUE 230 TRUE

331 332.6 TRUE 322 TRUE 330 TRUE

471 471.14 TRUE 463 TRUE 469 TRUE

681 662.01 TRUE 650 TRUE 660 TRUE

1000 954 TRUE 950 TRUE 997 TRUE

2220 2234 TRUE 2280 TRUE 2280 TRUE

2720 2626 TRUE 2620 TRUE 2670 TRUE

3920 4133 TRUE 4150 TRUE 4250 TRUE

6820 6663 TRUE 6660 TRUE 6760 TRUE

15300 14576 TRUE 14554 TRUE 14770 TRUE Table 7, Measured Capacitance Treating Rated Capacitors As Oracle

6.3.1 Discussion

From these results it is impossible to determine which measuring system is more accurately measuring

each capacitor. As Table 7 indicates almost all measurements are taken within the tolerance of the rated

capacitors. The results cells that are filled in with colour are the measurements that exceed the

capacitor’s tolerance ratings. It is noted that the analogue QTouch system is the better system to

measure within lower capacitor ratings. This could be because of the rated resolution of the DMM or

perhaps could even be a consequence of surrounding EMI, received via the DMM’s leads.

Page 59: ENG460 Engineering Thesis - Murdoch University

49 | P a g e

Capacitor(pF) 10% An-QTouch (101.2nF)

No1.Q1156 No2.Q1156

1.8 TRUE 1.99 TRUE 3 4 TRUE

2.2 TRUE 2.51 TRUE 3 3 TRUE

4.7 TRUE 4.9 TRUE 6 7 TRUE

8.2 TRUE 8.68 TRUE 9 10 TRUE

33 TRUE 33.5 TRUE 33 34 TRUE

47 TRUE 45.27 TRUE 46 47 TRUE

82 TRUE 83.1 TRUE 85 86 TRUE

101 TRUE 102.66 TRUE 104 104 TRUE

151 TRUE 150.33 TRUE 153 151 TRUE

221 TRUE 229.77 TRUE 225 230 TRUE

331 FALSE 332.6 FALSE 322 330 TRUE

471 TRUE 471.14 TRUE 463 469 TRUE

681 FALSE 662.01 FALSE 650 660 TRUE

1000 FALSE 954 TRUE 950 997 FALSE

2220 TRUE 2234 TRUE 2280 2280 TRUE

2720 FALSE 2626 TRUE 2620 2670 TRUE

3920 FALSE 4133 TRUE 4150 4250 FALSE

6820 FALSE 6663 TRUE 6660 6760 TRUE

15300 FALSE 14576 TRUE 14554 14770 FALSE Table 8, No1.Q1156 As Oracle

Table 8, treats DMM No1.Q1156 as an Oracle (the DMM is assumed to read with 100% accuracy), and all

the measurements or rated capacitance that exceed the rated accuracy of this meter are highlighted,

refer to Table 5. The assumption of this table is that the true capacitance must be within the rated

accuracy limits of the capacitance that are measured by “No1.Q1156”. If this assumption is correct it

will mean that two measurements from the analogue QTouch device are incorrect and three

measurements from No2.Q1156 are incorrect.

Page 60: ENG460 Engineering Thesis - Murdoch University

50 | P a g e

Capacitor(pF) 10% An-QTouch (101.2nF)

No1.Q1156 No2.Q1156

1.8 TRUE 1.99 TRUE 3 TRUE 4

2.2 TRUE 2.51 TRUE 3 TRUE 3

4.7 TRUE 4.9 TRUE 6 TRUE 7

8.2 TRUE 8.68 TRUE 9 TRUE 10

33 TRUE 33.5 TRUE 33 TRUE 34

47 TRUE 45.27 TRUE 46 TRUE 47

82 TRUE 83.1 TRUE 85 TRUE 86

101 TRUE 102.66 TRUE 104 TRUE 104

151 TRUE 150.33 TRUE 153 TRUE 151

221 FALSE 229.77 TRUE 225 TRUE 230

331 TRUE 332.6 TRUE 322 TRUE 330

471 TRUE 471.14 TRUE 463 TRUE 469

681 FALSE 662.01 TRUE 650 TRUE 660

1000 TRUE 954 FALSE 950 FALSE 997

2220 TRUE 2234 TRUE 2280 TRUE 2280

2720 TRUE 2626 TRUE 2620 TRUE 2670

3920 FALSE 4133 FALSE 4150 FALSE 4250

6820 TRUE 6663 TRUE 6660 TRUE 6760

15300 FALSE 14576 TRUE 14554 FALSE 14770 Table 9, No2.Q1156As Oracle

Table 9, assumes DMM No2.Q1156 as an Oracle. If this assumption is correct it would again indicate that

two measurements of the analogue QTouch system are incorrect and three measurements from

theDMM No1.Q1156 incorrect. However the fact 4/5 of the assumed incorrect samples across the

QTouch and No1.Q1156 are on the same capacitor ratings may indicate that for both these samples the

No2.Q1156 itself is incorrect.

Page 61: ENG460 Engineering Thesis - Murdoch University

51 | P a g e

6.4 Experiment 3 – Capacitive Probes

6.4.1 Objective

The objective of this experiment is to observe the functionality of the constructed capacitive water level

sensor. That is to map the relationship between capacitance versus water level. Also another objective is

to approximate the capacitance range of the constructed probe. Finally it is also desired to note any

possible improvements so that they can be added to future capacitor probe designs.

6.4.2 Methodology

The capacitive probes were put into a large tank. The water in the tank was accumulated to submerge

the capacitor probes to the desired depth. Each depth measurement was taken with 5 cm intervals. The

QTouch analogue device was used to measure the capacitance and a tape measure was used to ensure

the water was accumulated to the specified height. After a capacitance measurement was taken the

probe was retracted from the tank and the residual capacitance was measured after 10 seconds. The

results are shown in Table 10 and graphed in Figure 38.

Cm Deep

QTouch Reading (pF)

Reading After Probe is Removed for 10 seconds (pF)

0 303

5 404

10 800 392

15 1200 572

20 1560 797

25 2130 960

30 2320 1050

35 2531 1140

40 2902 1181

45 3202 1301

50 3515 1401

55 3867 1380

60 4218 1348

65 4735 1401 Table 10, Capacitive Probe Measurements

Page 62: ENG460 Engineering Thesis - Murdoch University

52 | P a g e

Figure 38, Capacitor Probe Measurements Graph

6.4.3 Discussion

The measured capacitance appears to behave in a linear fashion. The water builds up on the capacitor

plates due to surface tension and induces an error in the level measurement. This becomes apparent

when the capacitor probe is removed in total from the tank and a residual capacitance is measured from

residual water. The rubber coating outside the capacitor probes provides a rough surface with high

friction to hold residual water. In hindsight it may have been more preferable to use smooth layers of

varnish to insulate the capacitive probes to reduce residual water hold. Another solution may have been

to increase the gap between the plates and increase the surface area of the plates. Increasing the area

of the plates would increase the sensitivity of measurement. Increasing the gap between the plates

would decrease the sensitivity but would also however decrease the error caused by residual water.

With any capacitor level sensing device, the probes will remain wetted as the liquid level decreases,

providing a dielectric insulation along the vessel walls. Consequently an error is incurred with any drop

in level. Typically the quicker the level drops the larger the error will be. At least until the recently un-

submerged section of the probe dries.

To map the relationship a line of best fit was applied between the ‘measured capacitance’ and the

‘submerged depth’ for the capacitor probes. The R squared value for this line of best fit is 0.99,

indicating that there is a low level of deviation from the line of best fit. This small amount of deviation

could be because of measurement errors with a tape measure or perhaps also due to measurement

errors from the QTouch analogue system. See Figure 39 for the graphed ‘line of best fit’.

0

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

0 20 40 60 80

PicoFaradQTouch Reading

pF Reading AfterProbe isRemoved for 10seconds

Page 63: ENG460 Engineering Thesis - Murdoch University

53 | P a g e

Figure 39, Capacitor Probe Linear Approximation

y = 65.556x + 303 R² = 0.9922

0

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

0 20 40 60 80

PicoFarad QTouch Reading

PicoFaradQTouchReading

Linear(PicoFaradQTouchReading)

Page 64: ENG460 Engineering Thesis - Murdoch University

54 | P a g e

Chapter 7 Conclusion

7.1 Chapter Overview

7.2 Future Work 7.2.1 Accuracy

The accuracy of the QTouch analogue system has been indicated but not demonstrated. Future work is

required to compare the QTouch analogue measurement system with an Oracle. This Oracle could be in

the form of high tolerance capacitors or maybe a capacitance sensing meter with high accuracy for

measuring fine capacitances. A further statistical investigation may be required to investigate the

measurement error for the QTouch analogue system.

An investigation into the behavior of leakage through the input pins and the leakage effects across each

capacitor should also be undertaken. Understanding the relationship between leakage over a set

amount of iterations per time will allow, through compensation, increased accuracy for capacitance

measurements. Furthermore there may be microcontrollers or other hardware components (such as

transistors) with lower leakages during high impedance states. Even taking the initial analogue QTouch

system and operating it with a faster iteration cycle may reduce leakage effects.

A further method to increase the accuracy of the analogue QTouch is by substituting the 5 V power

regulator with a 3.3 V regulator. Each I/O pin of the Arduino can output 40 mA at a 5 V operation

voltage. At 3.3 V however each pin can output 50 mA. [23] Having a higher maximum current means

that a lower resistor may be used to allow the capacitors to charge at a faster rate. The 5 V linear

regulator can be replaced with a 3.3 V less power hungry regulator which will decrease power

consumption across both the regulator and the ATmega 328P processor. This action will increase the

accuracy of the ‘analogue QTouch’ system as well as decrease the overall power consumption of the

microprocessor in idle mode.

7.2.2 Capacitors versus energy relationship

The charging of a capacitor, typically involves the movement of electrons and the accumulation of

electrons on the negatively charged plate. Either way work must be done to both charge the capacitor

and store electrostatic potential energy. The power that is consumed while charging a capacitor is due

to the resistance I2R power losses. The potential energy that is stored in the capacitor is measured in

joules (J) and can be modeled by Equation 13. [3]

(13)

Equation 13, Energy Stored In A Capacitor

In the context of both the charge transfer circuits used in this thesis there is one clearway to reduce

power consumption. That is by decreasing the frequency of the charge/discharge cycles. Firstly the

charging of a capacitor results in the storing of electrostatic potential energy, measured in joules (J).

Power is measured in watts (W) or joules per second (J/S); thus suppose a 2 nF capacitor was to be

Page 65: ENG460 Engineering Thesis - Murdoch University

55 | P a g e

charged to 5 V, the energy stored in the capacitor would be 250 micro (u) joules. If this capacitor was to

be fully charged and discharged once per second a power consumption of 250 uW would result.

However if instead it was to be charged and discharged at a half second rate the corresponding power

consumption would be doubled at 500 uW. Finally having a slower charge/discharge rate would allow

the charge transfer circuits to be constructed with high resistances. Using higher resistances will prevent

high consumption power pulses that may result as a capacitor is being initially charged. [3]

7.3 Thesis Conclusion The aim of this thesis has been to design a capacitive level sensor, with a focus on accuracy,

disturbance/noise rejection, practical sampling-rates and cost. It has been found that a charge transfer

technology developed in this thesis can offer higher accuracy, noise immunity, and custom sampling

rates all at negligible cost. The presented results stand to confirm that the accuracy of the ‘analogue

QTouch system’ is more or equally competitive than with capacitance meter designs currently on the

market.

One of the important aspects of the analogue QTouch system is how it is able to detect dynamic

capacitance changes and then reset the averaging equation so to only function when the measured

capacitance is static. During transient changes in capacitance the moving average equation (Equation

12) is used to calculate the capacitance. It also does not require consistent sampling to increase

accuracy as the accumulated charge is always stored for later measurements, to be averaged.

The ‘QTouch analogue’ measures the capacitance with a micro controller and operates using DC

circuitry. This is attractive because no external circuitry or more expensive operational amplifiers are

required to measure the capacitance. The ‘QTouch analogue’ system has demonstrated high levels of

measurement accuracy and offers a simple programming alternative as it does not observe transient

responses, measure frequencies, all against time. Instead it operates by measuring charge and counts

the number of iterations. This offers a nice sequential based measuring alternative that can operate in

microcontrollers with the lowest internal oscillators.

Finally due to the hydrophilic behavior of the rubber coating on the capacitor probes, the probes dry at

slower rates. This causes a measurement error when the capacitive probes are used to detect decreases

in level. As such it is desirable to redesign and reconstruct capacitor probes in accordance with the

recommendations provided in section ’6.3.3 Discussion’.

Page 66: ENG460 Engineering Thesis - Murdoch University

56 | P a g e

Appendices

Pictures

Microcontroller LCD display DAC transconductance circuit all wired together

Single charge circuit

Page 67: ENG460 Engineering Thesis - Murdoch University

57 | P a g e

Analogue QTouch circuit

Page 68: ENG460 Engineering Thesis - Murdoch University

58 | P a g e

Solutions for Computational Mathematics

Page 69: ENG460 Engineering Thesis - Murdoch University

59 | P a g e

Page 70: ENG460 Engineering Thesis - Murdoch University

60 | P a g e

Page 71: ENG460 Engineering Thesis - Murdoch University

61 | P a g e

Arduino Code

Analogue QTouch program used in experiments. No LCD display or DAC

Page 72: ENG460 Engineering Thesis - Murdoch University

62 | P a g e

Page 73: ENG460 Engineering Thesis - Murdoch University

63 | P a g e

Single Charge Program

Page 74: ENG460 Engineering Thesis - Murdoch University

64 | P a g e

Page 75: ENG460 Engineering Thesis - Murdoch University

65 | P a g e

Final Project Code

Page 76: ENG460 Engineering Thesis - Murdoch University

66 | P a g e

Page 77: ENG460 Engineering Thesis - Murdoch University

67 | P a g e

Page 78: ENG460 Engineering Thesis - Murdoch University

68 | P a g e

Q1156 DMM Data Sheet

Page 79: ENG460 Engineering Thesis - Murdoch University

69 | P a g e

Page 80: ENG460 Engineering Thesis - Murdoch University

70 | P a g e

Bibliography

[1] A. R. Hambley, "Chapter 3 Inductance and Capacitance," in Electrical Engineering Principles and

Applications Fourth Edition, New Jersey, Pearson Education, 2008, pp. 121-125.

[2] Inductiveload, "Wikimedia Commons," 25 November 2006. [Online]. Available:

http://commons.wikimedia.org/wiki/File:Parallel_plate_capacitor.svg. [Accessed 16 October 2013].

[3] P. A. Tipler and G. Mosca, "Chapter 24 Electrostatic Energy And Capacitance," in Fifth Edition

Physics For Scientists And Engineers, New York, W.H Freeman and Company, 2004, pp. 752-776.

[4] Smack, "File:Dielectric.png - Wikimedia Commons," 16 May 2004. [Online]. Available:

http://commons.wikimedia.org/wiki/File:Dielectric.png. [Accessed 16 October 2013].

[5] Elcap, "File:Capacitor-Series-Equivalent-Circuit-.png - Wikimedia Commons," 28 November 2012.

[Online]. Available: http://commons.wikimedia.org/wiki/File:Capacitor-Series-Equivalent-Circuit-

.png. [Accessed 16 October 2013].

[6] P. Horowitz and W. Hill, "Chapter 5 Oscillators," in The Art Of Electronics 2nd Edition, New York,

Cambridge University Press, 1989, pp. 284-303.

[7] Inductiveload, "File:Op-Amp Relaxation Oscillator.svg - Wikimedia Commons," 7 February 2009.

[Online]. Available: http://commons.wikimedia.org/wiki/File:Op-Amp_Relaxation_Oscillator.svg.

[Accessed 10 October 2013].

[8] M. Jepkens, D. T. Scherer and D. Wunsch, "Capacitive Proximity Switch," Elektor-Magazine, no. 433,

pp. 86-89, 2013.

[9] "Wiltronics - ELEVEN by Freetronics," Wiltronics, [Online]. Available:

http://www.wiltronics.com.au/catalogue/200428/arduino/arduino-compatibles-by-

freetronics/freetronics-development-boards-shields-and-sensors/arduino-compatible-

development-boards-by-freetronics/eleven-by-freetronics. [Accessed 23 October 2013].

[10] "Arduino - Environment," Arduino, [Online]. Available: http://arduino.cc/en/Guide/Environment.

[Accessed 10 October 2013].

[11] "Arduino - LiquidCrystal," Arduino, [Online]. Available:

http://arduino.cc/en/Reference/LiquidCrystal. [Accessed 24 October 2013].

[12] Ladyada, "MCP4725 12-Bit DAC Tutorial," adafruit, 05 September 2013. [Online]. Available:

http://learn.adafruit.com/mcp4725-12-bit-dac-tutorial. [Accessed 24 October 2013].

Page 81: ENG460 Engineering Thesis - Murdoch University

71 | P a g e

[13] T. R. Kuphaldt, "Voltage-to-current signal conversion," All About Circuits, 29 March 2009. [Online].

Available: http://www.allaboutcircuits.com/vol_3/chpt_8/7.html. [Accessed 25 October 2013].

[14] D. C. Montgomery, "The Lognotmal Distribution," in Introduction to Statistical Quality Control 6th

Edition, Arizona, John Wiley & Sons, Inc, 2009, pp. 85-86.

[15] M. Simmons, "QT100 - Charge Transfer IC," Quanturn Rearch Group, Pittsburgh, 2006.

[16] H. Philipp and K. Snoad, "PROXIMITY SENSOR". United States Patent 7,952,366, 31 May 2011.

[17] J. Carey, "Getting In Touch With Capacitance Sensor Algorithms," Atmel, September 2009. [Online].

Available: http://www.embedded.com/design/prototyping-and-development/4008781/Getting-in-

touch-with-capacitance-sensor-algorithms. [Accessed 27 October 2013].

[18] "Wikipedia - Negligible," Wikimedia Foundation, [Online]. Available:

http://en.wikipedia.org/wiki/Negligible#In_electrical_engineering. [Accessed 30 October 2013].

[19] "Arduino - DigitalPins," Arduino, [Online]. Available: http://arduino.cc/en/Tutorial/DigitalPins.

[Accessed 31 October 2013].

[20] "Intusoft's Home on the Web," Intusoft's Home on the Web: SPICE Simulation, Analog and Mixed-

Signal Circuit Design Tools, Magnetics Transformer Design Software, and Test Program Software ,

[Online]. Available: http://www.intusoft.com/ . [Accessed 17 January 2014].

[21] "MacKichan Software - The Home of Scientific WorkPlace, Scientific Word and Scientific Notebook,"

MacKichan Software , [Online]. Available: http://www.mackichan.com/. [Accessed 17 January

2014].

[22] "Arduino - AnalogReference," Arduino , [Online]. Available:

http://arduino.cc/en/Reference/AnalogReference?from=Reference.AREF. [Accessed 5 November

2013].

[23] "Arduino - ArduinoBoardUno," Arduino, [Online]. Available:

http://arduino.cc/en/Main/arduinoBoardUno. [Accessed 14 November 2023].