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.

High res cap meter with PIC 16F628

Elekktrishun

New Member
Built the circuit as shown in this thread:


capmeter_4.gif


The meter works fine when the capacitor under test is determined by the PIC programming to be a "Small Cap" as shown in the LCD text display.

Once I test a capacitor that is determined to be a "Large Cap" there is about a 5-6 second delay before the LCD text display starts to show strange results. For example, the text "Large" will become "Largg". This continues to worsen and more letters and numbers become scrambled, nonsensical.

Based on what I have seen, Small Cap are measured in pF and Large Cap are measured in nF and mF.

I have tried numerous things to resolve the scrambled text issue including:

- checking my wiring and solder joints for errors
- check voltages at 9V and 5V
- measure oscillations with an oscilloscope
- place additional filtering caps at +/- terminals of the PIC 16F128 and LCD
- try a different PIC
- try a different LCD
- use a 9V power supply instead of a battery

Everything seems to be working properly.

Starting to think that maybe the HEX file I used is corrupt? I downloaded the file from the source page:


I used a PIC kit 4 and MPLAB IPE to program the PIC 16F628. The circuit is built on a perf board.

Any ideas to troubleshoot further would be appreciated. Thank-you
 
Last edited:
The schematic looks OK, so I might suspect bugs in the code.

When large Caps are used there may be some threshold in frequency or or code where instead of computing frequency to C, it measures time interval for 1/2 or 1 cycle then converts to C that it gets into trouble with the LCD timing, refresh or IRQ. That's up to someone else to debug.

For now , you can change the 10.0k to 1.00 k and operate at a higher frequency to measure bigger caps.
If the bugs occur at 10x bigger caps it may be the time interval code, which may have been near 1Hz oscillations.
 
Last edited:
On the original website, he states that the program space is 99.9% full. So, I suspect some programming issue like a stack overflow or even RAM shortage that is causing the uF/nF code to start to corrupt as it "loops" through some of the code.
There is a remote chance you have a fake batch of 16F628 chips as well. Have you tried the 16F628A chip?
Also, check the programming bits when programming, like watchdog timer, brown out reset (should be off) and check FOSC is set for HS (though XT setting may still work)
Finally, maybe try a 16F648A chip, it has a bit more ram, which may solve any ram issues.
The only real solution is to get the source code of course, but I doubt the original programmer will give it to you...
 
Note, old LCD displays required a critical boot up sequence including various delays. Modern ones don't.
He may have used a modern one and you're using an old one.
The required boot up sequence is,
1717884684095.png

Does anyone have more information regarding old/new display differences?

Mike.
 
I appreciate the feedback but now, after switching LCD displays again, it appears everything is working. I used different and shorter wires for the display. This required de-soldering both connections at the LCD and PIC 16F628 and re-soldering both connections with the new shorter wire. I can only assume there was a PIC connection that was causing the previous issue. I have tried measuring capacitors in both the pF and nF range numerous times and the display is now stable.

Meter.jpg
 
Was the "new" LCD different from the previous two tried? If so it could still be a timing problem. If not then it sounds like you had a dodgy joint or piece of wire.

Either way, well done and congratulations.

Mike.
 
Was the "new" LCD different from the previous two tried? If so it could still be a timing problem. If not then it sounds like you had a dodgy joint or piece of wire.

Either way, well done and congratulations.

Mike.
No, it is the original LCD but with entirely new wires connected.

Typical perf board drama. Just when you think you've gone over the connections enough times that it can't be the source of the problem you later discover it is

For now, I have the repurposed device box lid fastened down and added an additional label for the Zero Cal button.

Hopefully, it will work well for measuring diode capacitance in a powered test circuit. I have a DE-5000 LCR meter but this meter was built for that specific purpose.
 

Latest threads

New Articles From Microcontroller Tips

Back
Top