electronic instrumentation capacitance...

18
Electronic Instrumentation Capacitance Measurements * In this presentation definitions and examples from Wikipedia, HowStaffWorks and some other sources were used Lecturer: Dr. Samuel Kosolapov

Upload: others

Post on 20-Aug-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Electronic InstrumentationCapacitance Measurements

* In this presentation definitions and examplesfrom Wikipedia, HowStaffWorks and some other sources

were used

Lecturer: Dr. Samuel Kosolapov

Page 2: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Items to be defined/refreshed/discussed

• Measuring capacitance by using

sinus wave

Wheatstone bridge

Wheatstone bridge with Instrumental amplifier

Square wave

• Arduino-based capacitance measurements

2

Page 3: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance measurement with sinus wavehttp://meettechniek.info/passive/capacitance.html

3

Equations are trivialAs voltages as phase can be used…(… prepare them for exam…)

The resistor Rs must have approximately the same value as the impedance of the capacitor

Page 4: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance measurement with Wheatstone Bridgehttp://www.play-hookey.com/ac_theory/randr/wheatstone_ac_apps.html

4

Instrumental Amplifier must be used for “professional measurements”

Earphones can be usedas “null” indicator !!!!

Page 5: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Instrumental Amplifierhttps://en.wikipedia.org/wiki/Instrumentation_amplifier

5

CMRR can arrive to 120 dB !!!! Vout = A1*V1 –A2*V2

A1 == A2

Page 6: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Instrumental Amplifier with Wheatstone Bridgehttp://forum.allaboutcircuits.com/threads/wheatstone-bridge-amplifier-circuit.34804/

6

Why Instrumentation Amplifier is better in this case ?

Page 7: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements with Square Wavehttp://forum.arduino.cc/index.php?topic=173708.0

7

1 kHz signal and 1 Vpp

find the point where the voltage reaches63.2% (that is, 632 mV).

Switching to the "time" cursor we measure how long it takes to charge to this point (47 mkS )

C is equal to T / RC = 0.000047 / 1000In other words, 47 nF, which is in fact the capacitor that was used. the theory agrees with practice

Page 8: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements by using T = R*Chttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

8

The voltage at 1 Time Constant equals 63.2% of the charging voltage.

A resistor will charge a capacitor in TC seconds, whereTC = R * CTC = time constant in secondsR = resistance in ohmsC = capacitance in farads (1 microfarad [ufd] = 10E-6 farads )

Page 9: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements Arduinohttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

9

Arduino pins can be in one of two states:Input State (set with pinMode(pin, INPUT);)High Impedance (resistance)

- Makes very little demand on the circuit that it is samplingGood for reading sensors but not lighting LED's

Output State (set with pinMode(pin, OUTPUT);)Low Impedance - Can provide 40 mA source (positive voltage)Good for lighting LED's, driving other circuits

Additionally the pins can be HIGH (+5 volts), to charge the capacitor; or LOW (ground) to discharge the capacitor

Page 10: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements Arduinohttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

10

Alogrithm for capacitance meter sketch1. Set discharge pin to INPUT (so it can't discharge the capacitor)2. Record the start time with millis()3. Set charge pin to OUTPUT and make it HIGH4. Check the voltage repeatedly in a loop

until it gets to 63.2% of total voltage.5. After the cap is charged, subtract the current time from the start time to find out how long the capacitor took to charge.6. Divide the Time in seconds by the charging Resistance in ohms to find the Capacitance.7. Report the value with serial.print8. Discharge the capacitor. To do this:

8.1 Set the charge pin to Input8.2 Set the discharge pin to OUTPUT and make it LOW8.3Read the voltage to make sure the capacitor is fully discharged

9. Loop and do it again

Page 11: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements Arduinohttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

11

/* RCTiming_capacitance_meter* Paul Badger 2008* Demonstrates use of RC time constants to measure the value of a capacitor** Theory A capcitor will charge, through a resistor, in one time constant, defined as T seconds where* TC = R * C** TC = time constant period in seconds* R = resistance in ohms* C = capacitance in farads (1 microfarad (ufd) = .0000001 farad = 10^-6 farads )** The capacitor's voltage at one time constant is defined as 63.2% of the charging voltage.** Hardware setup:* Test Capacitor between common point and ground (positive side of an electrolytic capacitor to common)* Test Resistor between chargePin and common point* 220 ohm resistor between dischargePin and common point* Wire between common point and analogPin (A/D input)*/

Page 12: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements Arduinohttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

12

#define analogPin 0 // analog pin for measuring capacitor voltage#define chargePin 13 // pin to charge the capacitor - connected to one end of the charging resistor#define dischargePin 11 // pin to discharge the capacitor#define resistorValue 10000.0F // change this to whatever resistor value you are using

// F formatter tells compliler it's a floating point value

unsigned long startTime;unsigned long elapsedTime;float microFarads; // floating point variable to preserve precision, make calculationsfloat nanoFarads;

void setup(){pinMode(chargePin, OUTPUT); // set chargePin to outputdigitalWrite(chargePin, LOW);

Serial.begin(9600); // initialize serial transmission for debugging}

Page 13: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements Arduinohttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

13

void loop(){digitalWrite(chargePin, HIGH); // set chargePin HIGH and capacitor chargingstartTime = millis();

while(analogRead(analogPin) < 648){ // 647 is 63.2% of 1023, which corresponds to full-scale voltage}

elapsedTime= millis() - startTime;// convert milliseconds to seconds ( 10^-3 ) and Farads to microFarads ( 10^6 ), net 10^3 (1000) microFarads = ((float)elapsedTime / resistorValue) * 1000;Serial.print(elapsedTime); // print the value to serial portSerial.print(" mS "); // print units and carriage return

……………………………..

Page 14: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements Arduinohttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

14

void loop(){……………………………..

if (microFarads > 1){Serial.print((long)microFarads); // print the value to serial portSerial.println(" microFarads"); // print units and carriage return

}else{

// if value is smaller than one microFarad, convert to nanoFarads (10^-9 Farad).// This is a workaround because Serial.print will not print floats

nanoFarads = microFarads * 1000.0; // multiply by 1000 to convert to nanoFarads (10^-9 Farads)Serial.print((long)nanoFarads); // print the value to serial portSerial.println(" nanoFarads"); // print units and carriage return

}………………………..

Page 15: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements Arduinohttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

15

void loop(){……………………………..

/* dicharge the capacitor */digitalWrite(chargePin, LOW); // set charge pin to LOWpinMode(dischargePin, OUTPUT); // set discharge pin to outputdigitalWrite(dischargePin, LOW); // set discharge pin LOWwhile(analogRead(analogPin) > 0){ // wait until capacitor is completely discharged}

pinMode(dischargePin, INPUT); // set discharge pin back to input}

Page 16: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Capacitance Measurements Arduinohttps://www.arduino.cc/en/Tutorial/CapacitanceMeter

16

Some tips (to think before exam):

1. Use larger resistor R if the charging time is too short, smaller resistor R if the charging time is too long.

2. Use Averaging a group of readings for more accuracy3. Swap out several charging resistors on different pins to make an "auto-ranging" capacitance meter4. Modify the sketch to have the charging resistor also discharge the capacitor.

Think about “equations”.5. Think about error of measurements

Page 17: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Control Questions

• What have I learned ?

17

Page 18: Electronic Instrumentation Capacitance Measurementsbrd4.ort.org.il/~ksamuel/ElIn.31361/Lectures/046-Measuring of... · Electronic Instrumentation Capacitance Measurements * In this

Literature to read

1. TBD

18