Capacitor, updated
So here is the new method to measure capacitor :
First, identify if it is a low cap, medium cap or high cap.
If it is medium cap we select the right range and capture 512 samples of the charging voltage.
When we have those 512 points , we take 2 points at ~ 10% and ~ 70% to compute the capacitor value
C= (t2-t1)/Rcharge*Ln((4095.-V1)/(4095.-V2));
If it is a low cap, we take the 2nd point at ~ 90% to have a better accuracy (it takes 2.3x more time to go to 90% compared to 70%)
If it is a high cap, we do the same thing but poll the ADC instead of doing dma capture (it takes a long time, the error introduced by polling is very small).
But how do we select the right method ?
First do a high speed dma capture.
If we are under 10% of the 512 samples to reach 70% of the charge, it means it is a low cap.
If not, do a slow speed dma capture. If the 512 samples are not enough to charge the cap > 70%, it is a high cap.
If neither are true, try the other ones, one per one until we go the full charge within 512 sampling points.
The results are not bad at all.
Measured down to ~5pf, up to 400 us
Accuracy seems to be ~ 2% (except very small cap), but i don't have a trustworthy measuring tool to compute the actual error.
Comments
Post a Comment