Measure Capacitor

Status
Not open for further replies.
ok Comparators seem really cool! can someone link me to a tutorial heh? I have no clue how to use them. Also can you use external comparators? I would like to play with external ones also to better understand how they are used.
 
Here is an "improved" way of using the comparator. Note that I'm now using an external means of setting the trip level that makes the math from converting timer reading to capacitance easy. The underlying math is shown here.

Also note that I am using the same PIC pin to initially discharge the capacitor by initially setting the pin as a low digital output, and then subsequently setting it to an analog input, which allows the capacitor to begin charging. The comparator trips and generates the interrupt to save the timer value when the capacitor charges to ~3.79V, which is one RC time constant, which makes the math easy.
 

Attachments

  • DF115.png
    52.4 KB · Views: 132
Last edited:
im sorry for not understanding much still maybe because i dont know how comparators work or how to set one up but i still dont understand why you need that Pot. there? Why do i need a external reference voltage? Why not use internal VDD,VSS ?
 
im sorry for not understanding much still maybe because i dont know how comparators work or how to set one up but i still dont understand why you need that Pot. there? Why do i need a external reference voltage? Why not use internal VDD,VSS ?

hi atom,
Just in case Mike is off line.
The Vref is the +5Vdd and the pot is to SET the 0.631*Vref point.


Mike,
I am not sure that a PORT pin can 'dump' a 10uF or higher cap without damage.?????
 
Last edited:
so its 3.155v ? Wouldnt it be simpler to just say that Thanks!

Should i use a transistor
 
Last edited:
i meant ... have the vref point 3.155v

Like: Set POT to get 3.155v vref at A1
 
Last edited:
ok im lost in this Capture/Compare stuff. I dont understand what needs to be setup.

Do i use compare mode or capture mode, i know i have to setup timer 1 or 3 for timer mode. How do i setup everything.

How do i set this up? lol im going nuts!
 
I wanted to use external comparator because i intend to port this to ARM. Hence why i wanted to use the ADC.
 
Last edited:
i might just do this in PIC form and use the pic as a SLAVE in SPI or just UART the data over to ARM.
 
I will try to make this with a PIC16F630.. i have like 20 of these heh... it has a comparator and i think i may understand it a bit more
 
im working my way there heh. I am going to try and use 16F630. I wrote some code for UART where i can send and receive at 9600bps. All software which was tough in boostC heh...

going to play with comparator now... wish me luck!
 
You know your ARM chip is loaded with comparators, make them part of your arsenal! They are much faster than an ADC, issue an output as soon as your input exceeds your reference. I'm sure you've googled off on comparators; you know where to find the info you need.
 
If anyone who can help has proteus and can test the attached. It has a breakpoint in MPLAB. Can someone just tell me if im going about correctly?
 

Attachments

  • LC24k20.zip
    51.9 KB · Views: 77
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…