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.
Hi JonG, you are welcome! :) That was why I wrote the project and posted on my web page and here, so people could easily build a high-res cap meter with a few cheap parts and not having to write code etc.

I look forward to seeing your build.
 
Hi Roman,

I have just finished a copy of the Cap Meter and it is great!

May I have your permission to do a write up for another group?

Ron
 
Hi Ron, glad you liked it! :)

Sure I don't have a problem if you do a write up, but I ask that you mention me as the author of the original project and give them a link to my web page so they can see my version of the project ie direct from the horses mouth. ;)

Also people reading this thread here might want to go look at your project write up too, so it would be nice if you posted a link here so people can check it out. Thanks! :)
 
Thanks Roman, I will do that.

capmeter.jpgcapmeter2.jpg

First run on a 9 volt battery and "in the box" and a wall wart (so as I could run the back light First cap was a supposed 1 MFD, second pic is a 104.

Working great... not a hint of a problem, good directions, clear and concise. Thank you for sharing this wunder bar project... Cost? 9 dollars for the Hamond box. LCD from an old piece of gear,
628a on hand, even had a 16 mHz in the crystal junk box!

Ron
 
Last edited:
Problem

Hi Roman,

I have encountered a problem, twice now as I make connection to the cap the screen goes dark and the pic blows. Any ideas? My 7805 is putting out 5.1 volts.

Would there be any problem with the unused pins?

Ron
 
Nice construction work there Ron! It looks great and your PCB layout seems pretty good with nothing too close to the cap testing analogue parts (the comparator).
:)

Ok, re the screen going dark etc that sounds like a PIC reset issue. Like some noise from touching the leads is making the PIC reset.

Mine gets used all the time and has never had a reset issue, so I think you might need to check the CONFIG flags where you programmed the PIC. The config flags do important things like set the MCLR pin off, and LVP off etc. Your programmer might have over-ridden the configs and if the MCLR pin is enabled then noise will reset the PIC which will likely "blacksquare" the display.

The PIC config flags should be as follows;
_BODEN_OFF
_PWRTE_ON
_WDT_OFF
_LVP_OFF
_MCLRE_OFF (important! this turns off the reset pin)
_HS_OSC

A couple of other suggestions;
1. Your 0.1uF decouple cap is a long way from the PIC, it's worth soldering one on the bottom of the PCB directly under the PIC Vdd and Vss pins.
2. Your PCB layout looks good but it's probably worth putting some spots of hot melt glue on the wires to make sure they don't move, especially the orange and blue wires. That will improve accuracy measuring very small caps. Also keeping the LCD wires well away from the cap test wires and also glued down will help too. :)
 
Problem

Thanks Roman,

I am using your Hex file in a Pickit 2 clone to program. I don't get any warnings that there are any config errors.

How would it be if I put a pull up on MCLR?

What happens after this is it only says "big cap" The pic is toast and is 'not found' in the Pickit2
so unable to reprogram.

Ron
 
Problem

Oh, did I mention I was using a 16f628A?

Ron

Edit: Could it be as simple as voltage being present on the test caps? All the caps in the 'office' tested fine, it was just in the basement and testing a couple of 1 mfd, a 2 and a 6 mfd film cap that had been used since the summer in motor tests that the problem surfaced.

IF the cap had 1 or 2 volts present there would only be a 50 50 chance that it was not connected so as to drive the input RA0 negative???

R
 
Last edited:
There is nothing that should "blow up" the PIC, that would be a very unusual situation. In my 15+ years of using PICs I have only blown 2 up that I can remember, and both times was from connecting a high-current +12v supply to the Vdd pin. I have also killed a couple of ADC pins on PICs, due to overvoltage etc but that never stopped the PIC from being programmable.

If something is killing your PIC so it cannot be programmed you must be doing something seriously wrong! :eek:

You should be aware that the PIC16F628 and 16F628A have a LVP pin, so your programmer needs to handle the LVP pin properly to program the PIC, which means the LVP pin RB4 must be kept LOW (a 1k resistor to 0v) to do the programming. If for some reason your programmer has programmed the CONFIG to be _LVP_ON then you need a programmer that pulls the LVP pin low as required. You did not say what programmer you were using? :)

If the cap is charged up to a high voltage and you connect it to the cap meter then there is a possibility it can damage the PIC RA0 pin. But the voltage would need to be > 5v and have enough energy (a large enough cap) to blow the PIC pin protection diode on RA0! That is not that easy, the pin protect diodes are good for a couple hundred mA peak, so you must be doing something pretty bad there!

If you really think you might be connecting large charged-up caps to the meter(!) then you can add a resistor in series with the RA0 pin, this will limit peak currents into the PIC RA0 pin protection diode.

However you said "... testing a couple of 1 mfd, a 2 and a 6 mfd film cap that had been used since the summer in motor tests that the problem surfaced." I really doubt that you blew the PIC by connecting a 6uF cap that "was used last summer".

The RA0 pin is rugged, the PIC comparators are rugged and proven, the most likely thing is a PIC latchup reset issue. Possibly with a CONFIG issue that has programmed the PIC with _MCLR_ON (which explains the PIC reset issue) and LVP_ON, (which explains the unable to program issue).

Like I said my meter gets used all the time and I don't baby it, it has had caps connected that have been pulled from the breadboard and may have been charged to 12v or so, and the cap meter has not played up in any way not even as much as a single latch-up. Please check your programmer and CONFIG settings. :)
 
The RA0 pin is rugged, the PIC comparators are rugged and proven, the most likely thing is a PIC latchup reset issue. Possibly with a CONFIG issue that has programmed the PIC with _MCLR_ON (which explains the PIC reset issue) and LVP_ON, (which explains the unable to program issue).

Like I said my meter gets used all the time and I don't baby it, it has had caps connected that have been pulled from the breadboard and may have been charged to 12v or so, and the cap meter has not played up in any way not even as much as a single latch-up. Please check your programmer and CONFIG settings. :)

config... 0x3F02

disasm.JPG

This is your file and programming the pic and reading it back shows 0x3F02

One difference between the 628 and the 628A is the A uses BOREN and not BODEN

Ron
 
Last edited:
If something is killing your PIC so it cannot be programmed you must be doing something seriously wrong! :eek:

)

Thank you for being so patient. I think now what it was, was the coaxial power connector was making an intermittent contact and as I connected the cap the unit moved causing the problem.

When the unit is fastened down and the connector is fully seated I can not duplicate the crash.

Fortunately the pic's are only two dollars apiece, if you buy 10, so not a major cost item.

Thanks again for your support

Ron
 
...
This is your file and programming the pic and reading it back shows 0x3F02
...

I know what is in the HEX file, I created it! :D

However you still did not say which programmer you are using or provide any details. One some programmers (like the one I use) the programmer has edit boxes that can over-ride the config settings, so someone can deliberately (or mistakenly) over-ride the CONFIG settings that are in the HEX file.

...
Thank you for being so patient. I think now what it was, was the coaxial power connector was making an intermittent contact and as I connected the cap the unit moved causing the problem.

When the unit is fastened down and the connector is fully seated I can not duplicate the crash.

Fortunately the pic's are only two dollars apiece, if you buy 10, so not a major cost item.

I'm glad you got it sorted! Congrats! :)

After the CONFIG discussion my next suggestion was going to be that you look for a wiring problem, as it is very hard for a PIC to "blow up" unless something serious happens like a loose wire (or wiring short) connects 12v to one of the PIC pins.

Anyway I'm sorry you got a dead PIC, may he rest in peace. ;)
 
Last edited:
mr. RB, how hard would it be to make it into something a little more flexible, like combining it with an ESR meter or capability to measure inductance?
 
Hi Kubeek, there are some threads on ESR measuring here on the forum, it is not that hard with a microcontroller but would require some extra parts, making the project more complex.

I'm curious to hear people's suggestions on adding ESR testing to this design, if it can be done very simply with minimal external parts so as not to make the project too complex for a beginner.

LC meters usually involve more complexity, and L is difficult to measure with a lot of resolution as it usually requires a square or square root in the math, if you use a simple comparator LC oscillator.

Another reason I did not bother with LC is because there are some very nice performance designs and kits already out there, like this one;
https://www.rfcandy.biz/communication/imp_lc.html
which you can build yourself or is also available in kit form. It took a smart guy 8 months to design and refine so no point trying to design one when that LC meter kit is so nicely done.
 
Cap Meter

Hi Mr R B

Write up now posted at < http://www.pcbheaven.com/> Scroll down to Electronic projects/Project Details/Worklog

Ron

edit: direct link,

**broken link removed**
 
Last edited:
Hi RB, personaly i think a ESR meter add on would make it a must have no question about it kinda thing :D yeah i would be very very keen to build one
 
Hi RB, personaly i think a ESR meter add on would make it a must have no question about it kinda thing :D yeah i would be very very keen to build one
Exactly my thoughts, I have a so-so cap meter on my multimeter so I don´t need another one, but with an ESR meter added it would be a great troubleshooting tool and I´m building it ASAP :)
 
To Ronee- thanks for posting the link. That is a very nice write up and well done it is simple and easy to read and looks professional. :) I had not visited Giorgos' site in a while.

To Ghostman11 and Kubeek, ok I will have a think about ways to implement ESR function.

The way this cap meter works at the moment includes ESR in the measurement, so if an electro is bad and has a high ESR the oscillator frequency will be higher (and the cap value will read very low). This is basically mimicing the actual problem of ESR, in a high frequency power supply the caps perform like much smaller caps, which is what the Cap meter will also read, even in its present form.

But as for measuring small values of ESR or actually quantifying the ESR (in ohms) I really would welcome any suggestions on a good way to do it. I have a couple of dedicated digital ESR meters, which I used to use a lot, but they are only a 2 digit reading. However they have a good feature of using a <0.3v signal into the cap, so they can still measure cap ESR in circuit even when a diode junction etc might also be connected across the cap.

The PIC comparator could be changed in software to oscillate with <0.3v input so that may be do-able with very minimal hardware changes.

What I am not sure about is the best way to test the ESR. One way would be to switch a resistor in series with the cap (using a relay? or FET?) and compare the 2 frequencies in software math. But that requires a lot of annoying extra hardware.

I'm open to suggestions! :)
 
Last edited:
I've had a bit of a think about this, and I'm not sure it would be easy (or even a good idea) to try to add a few parts to this project to make it measure ESR.

This meter was optimised for low cap current, and a large voltage swing to give good accuracy and high resolution measuring capacitance.

If you need an ESR meter for fault finding, it is important to have a very small voltage swing <0.3v maybe even <0.1v (so as not to activate any semi junctions in the target PCB). Also the fault ESR of many caps that you need to test are PSU caps and might have a fault ESR as low as 1 or 2 ohms. So the cap ESR needs to be measured in a way to give good low-ohms measuring which means higher cap currents and an opamp system set up for very low voltage oscillation at a fairly high current (tens to hundreds of mA).

Really I think a good ESR test meter for electros 1uF to 2200uF (especially an in-circuit ESR tester) would need a very different circuit approach to the one I chose for this project, which was chosen for beginner simplicity and high resolution measuring of caps from 50uF down to the sub pF range.

Sorry guys! But if someone is interested in designing a good ESR meter (which would deserve its own thread) I have a few ideas to throw into the mix. :)
 
Last edited:
Roman what op-amp would be a good substitute for a TL062 And I'll see if I can make a ESR meter to go with your cap tester. if you don't care they will share the LCD na a sand alone would be better.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top