General area when it fits no where else

Moderator: Mmiscool

User avatar
By ardhuru
#62955 I wonder if there's a way to measure an external capacitance of a few 10s of pf by indulging in some I/O manipulation trickery?

I'm hoping there is, because on the pics, using the Picbasicpro compiler, there's a 'POT' command that reads the value of an external resistance *or* capacitor using any single digital pin.

Alternately, I could pop the capacitor into an astable 555 and measure its frequency, but I'm hoping to achieve this without the 555. I dont need super-accurate results.

Best Regards,

Anand
User avatar
By PhilTilson
#63041 Not sure how one would do this with one pin, but there might be a way with two!

Pin1 (output) connects to capacitor to be measured via a resistor. Pin 2 (A/D input) connects to top of capacitor.

Pin 1 goes high and charges capacitor via resistor. Pin 2 measures fully charged voltage. Pin 1 then goes low, discharging capacitor via resistor. Pin 2 detects when Vcap drops to 0.69 of original fully charged value. Then capacitor value can be found from t = 0.69CR.

Only problem is, with the kinds of value you mention, a 40pF capacitor with a 1Meg resistor would take around 28uS to discharge to that level, and I don't know any way of measuring periods that short using ESPbasic.

Which brings me to a general point for MM: the TIMER function is very useful, but only has a resolution of milliseconds. Is there any chance of getting a similar function for microseconds?
User avatar
By danbicks
#63059
PhilTilson wrote:Not sure how one would do this with one pin, but there might be a way with two!

Pin1 (output) connects to capacitor to be measured via a resistor. Pin 2 (A/D input) connects to top of capacitor.

Pin 1 goes high and charges capacitor via resistor. Pin 2 measures fully charged voltage. Pin 1 then goes low, discharging capacitor via resistor. Pin 2 detects when Vcap drops to 0.69 of original fully charged value. Then capacitor value can be found from t = 0.69CR.

Only problem is, with the kinds of value you mention, a 40pF capacitor with a 1Meg resistor would take around 28uS to discharge to that level, and I don't know any way of measuring periods that short using ESPbasic.

Which brings me to a general point for MM: the TIMER function is very useful, but only has a resolution of milliseconds. Is there any chance of getting a similar function for microseconds?


Phil should it not be 0.63 which is one time constant as opposed to 0.69 ?

Dans
User avatar
By PhilTilson
#63098
Phil should it not be 0.63 which is one time constant as opposed to 0.69 ?

So it seems! :oops:

Funny how you have something in the back of your mind from years ago and it turns out to be wrong! Let's be nit-picky - 0.63212 !! :mrgreen:

I'm not even sure that the method would work, but it's worth a try.

Phil