Microbit Capacitance Meter
Introduction: Microbit Capacitance Meter
What is a capacitor?
A device that stores electrical charge which in its basic form consists of two conducting plates separated by a dielectric.
In addition to the basic parallel plate several other forms of construction exist an example being that the plates in the form of a metal foil allow the capacitor to be formed into a roll reducing its size.
These basic types tend to be of low capacitance, polystyrene film being an example with capacitance of <=10nF and single layer ceramic up to ~1uF.
Variants of these forms exist using different dielectrics and construction for a variety of different uses.
Beyond the basic forms are the polarised (Electrolytic), types which employ a gel or liquid electrolyte with capacitance up to ~1F, used in coupling, decoupling, supply and timing applications.
This brings us on to the subject of timing which is a property which we will be making use of in this project.
Supplies
Microbit (V1 or V2)
Microbit Breakout board or equivalent
BS270 NFET or equivalent
10K resistor
56k resistor
1k resistor - Qty 2
Stripboard (24 Holes x 12 Holes)
PCB Screw Terminal Block 5mm pitch
SIL pin header
*** There is no affiliation to any of the sites linked from this list and it simply presents possible sources. ***
Step 1: Theory
If we connect a capacitor across a a low voltage source (3V), as used by the Microbit (voltages exceeding the maximum specified on the capacitor will result in it's damage as will applying the wrong polarity), in series with a resistor.
Whilst, at the same time measuring the voltage across the capacitor, relative large values of capacitance will allow you to see the increasing voltage using a DMM or an oscilloscope.
If for example we choose of capacitor of 47uF and a resistor of 10K we can determine the charging characteristics.
If we assume that the capacitor is fully discharged prior to applying the voltage at time = 0 and current = 0.
At switch on the initial voltage across the capacitor is zero therefore the current is at its maximum I=V/R = 3V/10K = 300uA.
The capacitor charges exponentially (voltage increasing whilst the current is decreasing), up to the maximum voltage.
The time that it takes to reach 63% of the supply voltage is called the time constant (1T), meanwhile the capacitor continues to charge until at 5T its effectively fully charged and I=0.
The Time constant is calculated from C*R.
In this case 47uF * 10K = 470mS (1T), meaning it will take 0.47 seconds to reach 3V*0.63 = 1.89V.
But why is 1T, 63% of the applied voltage.
We can calculate the voltage at any instant of time with the following equation:
Vc = Vs*(1-e(-t/CR))
Vc = Capacitor Voltage
Vs = Supply Voltage
e = Euler Number (~2.78)
t = elapsed since charge initiation for the capacitor in question.
CR = the time constant for the circuit.
Taking our example earlier for C=47uF, R=10K, Vs=3V and CR=470mS measuring the voltage at t=470mS, gives the following:
Vc = 3*(1-(e(-470mS/470mS)) = 3*(1-e(-1)) = 3*(1-0.367) = 3*0.6321 = 1.896V = 63% of Vs
Taking this equation and plotting a chart for the values from 0T up to and beyond 5T we can see the charging process.
Step 2: Circuit
The circuit consists of a charging element a 10K resistor connected to P0, configured as a digital output this is set to logic 1 (3V), to begin charging the unknown capacitor.
Connected to P1 via a 1k resistor is the voltage monitoring pin set as an analogue input.
The remaining pin P2 is connected to the input of the discharge circuit which consists of a bias resistor network, 1k in parallel with a 56K, with the junction of these connected to the gate of the N channel FET. This is used to ensure the capacitor is fully discharged prior to initiating charging.
Therefore with this circuit charging, monitoring and discharging can be accomplished with the control of the microcontroller and also serves as protection against possible excessive conditions by isolating it from an unknown pre charged capacitor.
The resistors limiting current and the NFET providing reverse polarity protection. 134