I have built the HiRes Capmeter and it is really a helpful tool to own.
A few posts popped up in this long discussion thread regarding excess error about the linearity of measurement results, which were explained away with reasons of bad bread boarding and various other factors. The author Roman Black maintains that the meter is perfectly linear because the underlying principle is so simple. A capacitor is charged and discharge between two well defined voltage levels of 33.3% and 66.6% supply voltage via a fixed resistor and thus the frequency of switching is proportional only to the capacitance. Yes, very true indeed.
The following describes how the problem was located and how I resolve the issues and ended up with a great meter.
After building and rebuilding the meter for a second time, I still encountered the same non-linearity problem that several posters here had reported. You can check by yourself too. Get ready a 22pF(less than 100pF will do) capacitor and a 1000pF or higher capacitor. Measure the capacitance of each and then do a final measurement with both capacitors in parallel. If your measurement result of the paralleled capacitors don't match the sum of the two individual measured values to within a few picoFarads, then your meter is non-linear.
By then I was convinced that the meter is non-linear, but why? It seems all Roman Black said in his previous posts were indeed simple truth which is indisputable. In desperation, I poked around with my scope probe on various PIC pins and did the measurement again. Then, I noticed something unusual. The pk-pk voltage level on the PIC comparator inverting input(RA0) is not the same when measuring different capacitors. In theory, this should be switching between 33% and 66% of 5V, and should be the same as the Vref pin(RA2). Capacitance calculation depends on this voltage to be switching exactly as the Vref, namely 33.33% and 66.66% of supply positive. Suspecting the comparator inside the PIC, I built on my breadboard the same oscillator using the well known LM393 instead. Well, the result was still the same, the pk-pk voltage was not stable. It seems the comparator inside the PIC was not the culprit after all.
In order to locate what actually causes the discrepancy, I simulated the oscillator circuit in LTspice. The simulation result is attached below. In the simulation, I used a control switch U1 to change the capacitor value from 0.2uF into 200pF and observe the change of pk-pk voltage on the capacitor(Vcap). The oscillator frequency changes from 700Hz up to 200KHz. In the top graph, the difference in levels is clearly seen which matches exactly my physical scope test on the breadboard. In the expanded time scale graph below, both the Vref and Vcap are plotted. The reason is now plain. The comparator output is NOT switching well after Vcap has reached Vref, in both directions. The switching only comes after some 300ns later. Well now you know this is the propagation delay of the comparator. It is this propagation delay that led to the non-linearity when the capacitance is small and the switching frequency is in the high 200KHz range.
Now I have located the cause, what can I do about it?
My first solution is to lower the switching PIC comparator frequency ten times from 200KHz to 20KHz so the propagation delay affects the linearity less. This is easy to do by using a 10 times higher charge/discharge resistor and changing the scaling factor inside the PIC firmware to ten times more. The result is satisfactory but the range of the meter had decreased by 10. Now the meter can only measure a maximum 5uF capacitor before overflowing. Obvious that's not good.
My final solution is to do away with the PIC comparator and use an ultra fast external comparator LT1016 instead. I used the typical circuit inside the data sheet and got very good results, as seen in the attached image. The difference I got in the above linearity test was within half a picoFarad. The modified schematic is also attached should you wish to make the change. I have to stress that this will only made a difference if you often measure small capacitors in the pF range. It might not worth the effort for capacitor higher than several thousand picoFarad.
Again, my thanks to Roman Black for providing us such an useful meter in the first place.