Chris,
I finally tried some larger-valued capacitors: a 10 uF, 100 uF and 470 uF. The reason I did not start off with them is electrolytics are not meant to be precise. They are meant to act like the air tank on an air compressor, or a battery, just a reserve supply. Plus they don't measure the same two times in a row. I had to re-assemble my circuit, which only took a minute, after which I re-measured one of the 0.1 uF caps from the other day. It was exactly the same to four significant digits!
Here are the electrolytics I measured today:
The 10 uF cap. (using a 100K charge resistor) measured 10.9 uF. The 100 uF cap. (using 100K, 10K, 1K) measured 119 uF, 116 uF and 118 uF. The 470 uF cap/ (using 100k, 10K, 1K) measured 517 uF, 498 uF and 506 uF. (Each value posted is an average of three readings.)
I did not have time to check these on the multimeter and capacitance meter, but these values look good. If you look in an electronic parts catalog it is common for electrolytic caps to have a tolerance of +/-20% in value.
Getting back to your circuit, the layout looks correct. I would use a smaller value discharge resistor to ensure the cap is fully discharged. I use 100 ohms, which is safe because even when the cap is fully charged to 3.3 V and the discharge pin is low the most current that flows is (3.3 - 0.0)/100 or 33 mA. The mbed can source or sink 40 mA, so we are okay. The same can be said for using a 100 ohm charge resistor for large caps of 10,000 uF and above. Initially the cap is 0 V, so the current pours in as if it were a short circuit, limited only by the resistor value. The initial charging current would be 33 mA and then taper off from there as the voltage on the cap increases. Some of your posted values are below 10 uF, meaning a shorter charging time, which may indicate the cap was not fully discharged. Judging by some of the other values, though, I would say something else is happening.
If you look at the holes in your breadboard just above where the positive lead of the capacitor is inserted you can see the metal contact inside blocking about half of the hole. That's the way they should look. The metal contact also has a semi-circular notch to help it make more contact with wires and component leads. Now look at some of the other holes in the vicinity of your resistors. The holes appear empty. This can happen if a large diameter wire or lead has been jammed in, forcing the contact back. I would pull out your wires and resistors one-by-one and then take a straight piece of solid, 22 AWG wire (or a new, straight resistor) and test each hole for contact by inserting the wire and then gently pulling it part way out and then back in again, trying to feel the drag of the metal contact on the wire.
Bad contacts would explain the flakey readings you are getting. If the charging circuit is not in contact some of the time, the program has to run longer to get up to 63.2%, resulting in a larger timer value and calculated capacitance value. If the AnalogIn "sense" wire is making poor contact, the program will really be confused. One loop it could be reading nothing, and the next loop it could be over the limit.
Hi everyone,
I'm new here, and fairly new to electronics. I've been programming for a couple of decades, mostly in Perl, PHP, and so on. I've taken some C courses, but that was too long ago to think about.
I had read online about all the fun that people are having with Arduino, and was inspired. I started reading about the great number of people that are transitioning from 8-bit up to 32-bit micro-controllers and then I started reading up on the LPC Expresso boards. This is when I found Mbed and ordered one.
I've so far done some little projects with the Mbed, including Hello World, a bunch of "blink or dim these LEDs" projects, a basic voltmeter (amazingly accurate on an "AA" cell), and so on. I've built a nice little power supply that takes 9V in from a wall-wart and brings it down to a nice 5V to run the Mbed. I've also hooked up a 40x4 LED display and that works (mostly) fine. I'm impressed and excited to hone my skills and have spent a ton of my spare time learning more about electronics. I'm hooked.
I would like to build a capacitance meter. I found something for an Arduino here: http://arduino.cc/it/Tutorial/CapacitanceMeter and tried to build that. I carefully followed the schematic as closely as I could, and wrote some code to measure the voltage on the capacitor; if the capacitor is close to 0V, then my code turns on a DigitalOut pin to charge it up. The problem I have is that as soon as the charge pin comes on, the voltage read pin "sees" the 3.3 V and assumes the capacitor is charged, then turns off.
I'm stuck. Not sure whether I screwed up wiring up my breadboard, in my code, or both.
Any tips, thoughts, or information would be very much appreciated.
Chris