Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

Capacitance Measurement
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Capacitance Measurement

by mikewitt on Fri Oct 10, 2008 11:02 pm

It was more of a problem of noise, and by inserting Q1, I isolated it (almost) entirely from the circuit. I also didn't think about using the *reset pin, because, well, I didn't know what it did exactly, and I didn't need it otherwise.
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

Re: Capacitance Measurement

by Amberwolf on Fri Oct 10, 2008 11:30 pm

Ah, well, if you like in later revisions, you can leave it out and use the reset pin instead, and it will perform the same noise-removal function for you. :)

BTW, whenever a Reset pin is labelled with a negative-level marker (the bubble, line over name, etc), it is also convenient to think of them as Enable lines instead. That way as long as they're getting a 1 at the pin, the chip does it's thing, and when you no longer have a 1 there, they're "turned off".

Doesn't *always* work like that, but usually does.
Watch me build an electric bike from assorted junk!
Alternative Energy Sources for the Home from Recycled Junk
A subsidiary of Cybernetic Necromancers, Discorporated:
"We Bring Dead Things To Life"
Amberwolf
 
Posts: 310
Joined: Wed Oct 08, 2008 2:42 am
Location: Phoenix, AZ, USA

Re: Capacitance Measurement

by Amberwolf on Sat Oct 11, 2008 5:12 am

Oh, also, using the TLC555 may eliminate using the decoupling caps that you had to add to keep it from restarting the AVR. Meant to mention that before.
Watch me build an electric bike from assorted junk!
Alternative Energy Sources for the Home from Recycled Junk
A subsidiary of Cybernetic Necromancers, Discorporated:
"We Bring Dead Things To Life"
Amberwolf
 
Posts: 310
Joined: Wed Oct 08, 2008 2:42 am
Location: Phoenix, AZ, USA

Re: Capacitance Measurement

by Olaf Marzocchi on Sun Nov 30, 2008 9:27 am

Just a question: why using T0, the 8 bit timer, instead of the T1? T1 should fire less frequently, therefore it should be better for long measurements.
Just thinking of course, but let's say we want to measure up to 600 kHz, this is 1/10 of the main clock frequency, so we need a prescaler of 1 to get good accuracy. Every 255 cycles we have something like 15 clock cycles to check the value of the status variable and to increase it if we are counting, that's almost 6% of the time. If an interrupt fires during this period, it is lost right?
Maybe better to use the other timer?

I have some time and I am correcting my version, that uses 4 7-segment displays, so I would like to hear opinions about the choice of timers. My idea was to use t0 to push the values on the displays and to multiplex them, while t1 measures the frequency and to calculates the digits for the display.
Olaf Marzocchi
 
Posts: 73
Joined: Mon May 08, 2006 3:29 am

Re: Capacitance Measurement

by halley on Sun Nov 30, 2008 11:11 am

mikewitt, your project totally rocks, and it was cool to read through this whole thread to see it evolve to a working solution.

I don't have a lot to add (other than "I'll probably build one of these from your examples"), but I noticed a lot of #define and const static char constants to deal with various ASCII matters. Unless you're running your compiler from a rare EBCDIC-standard machine, this is unnecessary and makes the code harder to follow naturally. Is there some other reason you can't use char literals?

Code: Select all | TOGGLE FULL SIZE
int value = 234;
char hundreds = '0' + (value / 100);     // no need for a "#define ASCII_ZERO 0x30"
[ e d @ h a l l e y . c c ]

halley
 
Posts: 73
Joined: Fri Nov 21, 2008 11:07 pm

Re: Capacitance Measurement

by mikewitt on Sun Nov 30, 2008 1:00 pm

halley wrote:mikewitt, your project totally rocks, and it was cool to read through this whole thread to see it evolve to a working solution.

I don't have a lot to add (other than "I'll probably build one of these from your examples"), but I noticed a lot of #define and const static char constants to deal with various ASCII matters. Unless you're running your compiler from a rare EBCDIC-standard machine, this is unnecessary and makes the code harder to follow naturally. Is there some other reason you can't use char literals?

Code: Select all | TOGGLE FULL SIZE
int value = 234;
char hundreds = '0' + (value / 100);     // no need for a "#define ASCII_ZERO 0x30"

Thanks for the compliment! :D

I used some char literals (like '0') in my final code; at http://witt.michael.googlepages.com/cap_src_v2.zip. But no, there isn't any reason you can't just use char literals.

Olaf:
T0 is used because I didn't write the code, and had/have no idea how to rewrite it (much of what was written was written in assembly, and uses explicit references to the timers. I have no idea how to change the references, because I would have to change the references AND rewrite the assembly for 16-bit registers.
mikewitt
 
Posts: 111
Joined: Thu Jan 04, 2007 9:18 pm
Location: KB9YJY, Wilmette, IL

Re: Capacitance Measurement

by Olaf Marzocchi on Wed Dec 17, 2008 12:57 pm

Ah, well, if you like in later revisions, you can leave it out and use the reset pin instead, and it will perform the same noise-removal function for you.


Amberwolf, how would you connect it? AFAIK, the reset pin is floating, unless kept low during programming. Doesn't the 555 expect a 1?
Olaf Marzocchi
 
Posts: 73
Joined: Mon May 08, 2006 3:29 am

Re: Capacitance Measurement

by Amberwolf on Sat Dec 20, 2008 3:06 am

AFAICR, the 555's /Reset pin is active low. Sometimes it's called an Enable pin, active high. Same difference. :)

Since the 555 doesn't have any programming states (it's "programmed" by using the calculated resistor/capacitor values) then /Reset is only used to force the output to the reset or low state, and discharge the capacitor, etc.

I don't think it's a good idea to leave it floating at all, because it might stay high, but it could go low enough to trigger a reset when you don't want one, if the right conditions were allowed by the rest of the circuit around it.
Watch me build an electric bike from assorted junk!
Alternative Energy Sources for the Home from Recycled Junk
A subsidiary of Cybernetic Necromancers, Discorporated:
"We Bring Dead Things To Life"
Amberwolf
 
Posts: 310
Joined: Wed Oct 08, 2008 2:42 am
Location: Phoenix, AZ, USA

Re:

by jeff58 on Sun Feb 06, 2011 10:52 am

Olaf Marzocchi wrote:Yes, I agree.

Only the LCD, with its price, is a bit overkill to me (I live in Europe and I would spend more than 30 euros for it, for the same price I can find a complete capacimeter), so I will have to find something to replace it. Maybe a 7-segment led, or maybe an lcd from a broken nokia phone. I saw some ready libraries.

But this is a really good project, you can also see clearly the development.

BTW: have you tried it with big capacitors? something in the mF range.


Another possibility is lcd's from pagers. There are abundance of them at the flea market. Any comments please?
jeff58
 
Posts: 1
Joined: Sun Feb 06, 2011 10:41 am

Please be positive and constructive with your questions and comments.