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.
Excellent! :)

To Throbscottle; You can measure and match the resistors if you like.

If you are after higher accuracy then you can replace the 10k with one fractionally less in value (like a low 10k 5% resistor ie 9.8k) and a small trimpot in series (500 ohm?). Then calibrate compared to known value caps.
 
Waiting for PIC to arrive in post from China now. Will be first test of homebrew PIC programmer. Photo's of top and bottom of board. The SMD's on the bottom are decoupling cap for the PIC and the 10K resistor. SMD resistor was cheaper since I decided to use 0.1%. Cap is board pull. Other caps also board pulls. The big black thing is a buck module I used instead of a 7805. The headers with the wires I pulled out of an old monitor or something. Had to chop them up a bit. Didn't have a 270pF cap so used 220pF - hope is ok.

I put the 22pF caps too close to the crystal and had to re-drill. Pity. It's because Design Spark's standard xtal case is smaller than the real one. Anyway, it's my first proper toner-transfer pcb. It's just about acceptable.

Soldering looks rough because I'm waiting for a new element for my soldering iron, so I used a home-made blowlamp-heated one. Drilling is a bit off because I'm waiting for collet chucks for home-made pcb drill so did it by hand. Switch is a long way from front panel, but I'm getting quite good at making little button extension type thingies out of plastic tube from hand-soap bottles now....
 

Attachments

  • bottom.JPG
    bottom.JPG
    1,012.1 KB · Views: 651
  • top.JPG
    top.JPG
    674.7 KB · Views: 634
Last edited:
That PCB looks pretty good for a "first proper toner transfer PCB". :)

The 220pF/270pF cap swap should not matter, because it is zeroed out later anyway.

Why the two trimpots? I assume the 10k is for the LCD contrast, but the 100k trimpot? Is that something to do with the PSU buck converter module?

Anyway congrats it looks like it should be nice and functional, those little cosmetic issues (soldering drilling etc) should not affect operation.
 
Buck converter voltage setting - exactly that. The module is set for 3.3v, but has an adjust pin. I'll put a blob of paint or something on the preset after final setting.
 
Will it adjust to 5v or are you going to run on 3.3v (or as high as it adjusts)?

The LCD needs 5v, they do not work well below 5v. I'm not sure about the PIC, it might work fine on <5v but I have not tested the comparator oscillator (the capacitor based osc) for accuracy under 5v.
 
Mr RB - the adjustment works really well, goes to nearly the supply voltage, so I'll set it to 5v and run it off a 9v battery. Works with input down to a volt above output voltage too.

Hi picbits - yes it is :) I finally got round to using it after all this time :D
 
I finally built a PicKit 2 clone with some help from friends on here, so was able to finish the cap meter. You can see in the photo how a backlit LCD looks without the backlight, too...

BUT, I tested it with a fairly ancient 1% 39nF cap, the meter reads it as 35.8somehing nF, way out of tolerance, even though I used a 0.1% resistor for the 10K. I suppose it's possible I've cooked the resistor, but I don't think so. I tried some other caps as well, all read low. What else could be upsetting the reading?

(edit: actually, maybe I should crank the voltage up a little - it's set for exactly 5v, maybe it needs closer to 5.5v)
 

Attachments

  • complete.JPG
    complete.JPG
    697.6 KB · Views: 590
Last edited:
Congrats on getting it up and running. :)

Hmm, I'm not sure about why the calibration is out, reading 36nF on a 39nF cap is a fair size error. The osc is running about 7-8% fast. I assume you zeroed the meter before testing?

I would leave the Vdd voltage at 5.0v, but add a decent sized tantalum (>=10uF) under the PIC on the bottom of the PCB right between the Vdd and Vss pins. If the PIC is not decoupled well with a cap then the Vdd might be pulled down as the comparator oscillator switches which could affect the 1/3 and 2/3 threshold points the comparator oscillates between. What tolerance are your 1k5 resistors?

Otherwise if none of that helps it is no big deal, you just need to change the 10k resistor until you are happy it is right. As the oscillator period is linear to the cap value, changing the resistor to be correct at 39nF will make it pretty accurate across the whole range.

Since your osc is running fast, all you need to do is add a 500 ohm or 1k trimpot in series with the 10k resistor (ie needs >10k), and adjust the trimpot until the meter reads exact. :)
 
There's a 0.1uF SMD ceramic cap under the PIC, but I'll try stuffing a tantalum (or bigger ceramic) one under there. The 1k5 resistors are 1%. The crystal was in a pack of 2 - if better decoupling doesn't work maybe I should try the other one? Actually now I read a little, is it possible I have series cut crystal? The Microchip doc on oscillators says it must be parallel cut or the frequency might be off. I just got the cheapest ones, from here: https://www.ebay.co.uk/itm/11107354...eName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649 This is the datasheet: https://www.electro-tech-online.com/custompdfs/2013/08/hc49slf.pdf. Can't actually tell which I have.

Of course it's possible I copied the schematic over to DesignSpark wrongly...

Edit: since it's reading low, it it possible this is because I put a 220pF instead of the 270pF? Going to try 330 after I've had another hunt for a 270. Hey I now have a nearly working cap meter to help find one!
 
Last edited:
Mystery solved. I cut and rerouted the track leading to the test lead pads after I realised it passed close to the oscillator, also added an extra decoupling cap to the vcc end of the top 1k5 divider resistor. So doing those increased the reading by 400pF - shows what a difference board layout can make!

The biggest difference appeared when I tested some 2.5% and 5% caps which measured ok. Seems my 1% cap is out of tolerance. Duh. Suppose I should get a new one to test...

Going to make a case for it now.

Picture attached of the probe I made - someone might find it useful. The handle is cut from a piece of pipe from a household cleaner spray bottle.

Oh yes, thanks for a great project, Roman :D
 

Attachments

  • probe.JPG
    probe.JPG
    120.9 KB · Views: 562
This ones going into my (Project list)

Thanks, Roman.

Good job, Throbs.
 
I mounted the pcb and display on a chassis, then made a box for it out of an old scanner lid. The zero button is from a biro, it pushes the tactile switch via a mis-align-able push rod. I made a test pad so it can be used for smd caps... See photos (I am very pleased with it!)

(had to re-upload photos since they got lost with the site change)
 

Attachments

  • button-rear.JPG
    button-rear.JPG
    698 KB · Views: 535
  • chassis.JPG
    chassis.JPG
    875.1 KB · Views: 538
  • chassis-built.JPG
    chassis-built.JPG
    580 KB · Views: 545
  • chassis-built-rear.JPG
    chassis-built-rear.JPG
    626.5 KB · Views: 609
  • complete-and-cased.JPG
    complete-and-cased.JPG
    655 KB · Views: 612
  • front-panel.JPG
    front-panel.JPG
    522 KB · Views: 519
Last edited:
Hi Roman, Your cap meter sounds great based on the reviews I've read! tried to simulate it with proteus but failed. was wondering if u ever tested it with proteus simulator ?
my goal, is to build a capacitive fluid meter which requires a resolution of about 100pf.full schematics and source codes will be posted.
Also, i'll re-write the firmware for your cap meter in C code and post it if you don't mind
thank you and great job
 
tried to simulate it with proteus but failed.
Failed how? That kind of application is very hard to simulate. If the simulator assumes perfect capacitor with no resistance, it will charge up instantly etc. I don't think that the simulation (interaction) between code and analog signals is very accurate in proteus.

Your fluid meter project sounds interesting. I hope it goes well and that you post the results.
 
Failed how?
well it seems like what u v said. proteus is unable to simulate tricky things in analog mode. the lcd is always displaying error, large cap. the PIC opamp simulation is not working at all with proteus.
regarding the fluid meter, all schemas and code will be posted online once done
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top