Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC based high-resolution cap meter

Status
Not open for further replies.
...
A second process is used to convert that result to picofarads;
(9195399*100)/scale = 919539900/919 = 1000587
1000587 is then displayed as; 10005.87 pF [/I]

I don't understand what "scale" means, or why you multiply 9195399 * 100. What does the 100 represent?

"Scale" is scaling from time measurement units to picofarads. It depends on your time unit size, and your charge/discharge impedances (resistor values).

The 100 enlarges the number from 9 million to 900 million, giving much more accurate math when the next process is a division.

...
I was also wondering where you take into account the 10k resistor? What if I used a different value resistor...
...

The simple way to approach it is to assume that the time period from the oscillator is proportionate to the capacitance. Basically you measure and add multiple period samples to increase the accuracy, then you multiply the number with a constant to give a very large number (but that still fits within a 32bit signed or unsligned long variable), then you divide by the scaling factor (which converts from time units to picofarads).

In your case the scaling factor will be found the easiest by measuring some 1% tolerance caps and doing it empirically rather than trying to calc it and still needing to tweak it empirically later. :)

...
I notice your website is not update quite as often as it used to be. Do you just not have many new projects going or not have the time to update your website with them?
...

Thanks for the nice words about my hobby site, yes I do miss the hobby projects and have a few fun ideas going in the background but unfortunately have too little time at the moment to complete them and write up the page. I'll make some time sooner or later. ;)
 
Last edited:
Quick question before taking the plunge!
Everyone except me already figured it out i guess, but whats the lcd controller type?
HD44780?
 
Yep or compatible. Pretty much any 12pin (or 14pin which has +2 backlight LED pins) LCD should work.

I keep an eye out for (older style) non-backlit LCDs as they only use 4 or 5mA and give great battery life.
 
Hi, I have not tried that but I think it would work, as the config settings etc should all be the same between the original 16F628A and the 16F648A.

Please let me know how it goes. :)
 
No, it's not worth the work as the two lines displa different things I would need to rewrite some code. The 16x2 LCD version has gone though polishing and testing so I would not care to rip the code apart and make changes in it, to end up with a reduced functionality (ie less display) and possible bugs.

The best advice would be to get a 16x2 display from somewhere, they are VERY standard now as the most common display type sourced at parts outlets. :)
 
Poor accuracy of C meter

Hello Mr.RB

I build meter with 0.05% smd resistors ,condenser 270p 1%(although there is no need 1%), but results is no good. Condenser 150nF 0.625% meter show 146.411 nF(too small value), 47nF 0.625% meter show 46.224nF(too small value) ,1nF 1% meter show 1.063 nF(too high a value), 2nF 1% meter show 2.070 nF(too high a value) . This is not good accuracy.Somewhere there is a problem.Be a processor problem?View attachment 66820 Mine is 16F628A .Thanks for the reply.
 
It's not a processor problem as the math uses 32bit and is accurate to quite a few decimal places even though it has different "ranges".

The most likely thing is the tolerance of your caps, even though caps are marked as 1% this is +/-1% which is a 2% range. You should check 10 or more of each value cap even when they are 1% caps, as if you only check 2 or 3 you might get a couple of low or high ones.

Also please understand that for the small cap values the leads are contributing to the capacitance, and when you zero the meter the leads may be in a different position to when the cap is clipped onto the leads. This can often make small caps read higher.

Construction might also be an issue! If you have a photo of your setup that will help, so we can see the stray capacitances that might be making the small caps read high. As far as general tuning goes you can put a 200 or 500 ohm trimpot in series with the 10.00k resistor, then tweak this to set the calibration.

And finally I would not expect the cap meter to be of a really high accuracy, especially over a very large range of cap sizes. It should be better than 1% accuracy over most sizes.
 
Thanks for posting the pictures, your layout looks ok. :)

You really should add a 0.1uF or 0.22uF decoupling cap directly under the PIC, between the power pins. Your circuit only has a electro cap for 5v Vdd, and it is far away from the PIC.

The only measurement problem I can see is the two wires to the cap under test, as I said before this can have some effect when measuring small caps because of the wire position and the wire capacitance. It is good to keep those wires short, and when measuring small caps to zero the device when the wires are in the same position as measuring the small cap.

Re the non-linearity you seem to have measured, I cannot see why it is happening as suspect it is just the tolerances of your cap values. The frequency of oscillation is dependant on cap under test and on all the circuit resistances. We have to assume the circuit resistances are constant even when you change caps, so the only thing being measured is the cap itself. The freq of the oscillator is measured by averaging a very large number of cycles against a xtal, so it is very accurate, as is the software math that is done using 32bit values.

If you are seeing a non-linearity the only issues would be the capacitance tolerances of the caps you are testing, (and most cap values are all over the place, even in the same batch). Another issue might be the ESR of the cap under test, but the ESR of a cap will be quite small compared to the total circuit resistances used in the RC oscillator.
 
Last edited:
Hello Roman. I'm a little concerned with your cap meter and frequency criteria directly on the 16F628. If the frequency is 1516Hz RA3, display shows 45.612 nF, and it should 47.6nF, if the frequency is 474Hz to RA3 would display should show 152nF, it shows 146.4nF. Try it with your and let me know. Thank you.
View attachment 67774
**broken link removed**
 
You can't simulate it that easily. The PIC output uses push-pull FET drivers, and will pull down harder (lower NFET Rdson) than it pushes up (with a higher PFET Rdson).

I tuned the circuit with an actual PIC16F628A, and chose the software calibration to suit the real world result. :)

In any case, if you think the software calibration I used is a couple of percent out, all you need to do it "tweak" the value of the 10k resistor up or down (with a small calibration trimpot if you like) until you are happy it is the best calibration.

I'm not going to keep answering questions on the accuracy of the capmeter as the software I released is adjusted already to better than 1% accuracy in my actual-hardware testing. And if people want better accuracy than that, you can adjust the value of the 10k resistor as mentioned above. :)
 
Hello,

Having searched the internet, i came upon this meter and built it.
Using an old remote control unit for a slide projector,i managed to put the meter in this 85x62x22mm box. A smal PCB was made and everything, including an LCD with a 33x10mm viewing area, battery etc. was mounted in the box.
The unit worked from the start. There are however some remarks.
When zeroed, the display gives a decimal point, then a blank and then 1,2, or another small cap value. It seems the decimal point position is fixed.
When in AutoCal, the minus sign jumps between front and back of the decimal point, depending on the actual value.
I know these are not fundamental issues, but being a perfectionist, i would like to correct these anomalies. Is this somthing you could do, because with only the hex listing this is not an easy if not impossible task.
For the rest, the meter is very good and fast, as i have checked with a variaty of accurate capacitors. Especialy the differential feature is nice, but could probably be extended to the higher cap ranges.

thanks
 
Hi Wjhos. I'd love to see photos of your build. :)

OK, regarding the "small cap value" after zeroing, that is because of the very high resolution of the meter. As the leads move (even with no cap connected) it creates fractional changes in pF and since the capmeter shows resolution of 0.01pF there will be a few counts showing. Same result if you put your fingertip near a lead, the capmeter will detect it.

I can help better after seeing your photos, but it helps if all the leads inside the box are glued down so they don't move. Also any flyleads to the cap under test should be short (<3 inches, and <2 inches is better).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top