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.

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
    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:
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 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
 
Why not just built one of these? It's cheaper than trying to build one yourself.
 
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! :D
 
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. :D
 
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.

Latest threads

Back
Top