# Charging a capacitor

A capacitor is a device capable of storing electrical charges. To load is applied a potential difference and accumulate charges to its full capacity. The maximum amount of charge that can accumulate divided potential difference is a property called capacitor capacitance , and is an indicator of the amount of energy it can store.

Capacitance is measured in farads, with 1 being equal to 1 Coulomb Farad / 1 Volt. The usual capacitors have a capacitance in the order ranging from the picoFarads (10 -12 ) to the microfarads (10 -6 ).

The theory is that the capacitors are charged according to time by the equation:

Q being the maximum load, the circuit resistance R and capacitance C.

In the circuit we set up we use a load resistor and capacitor

Therefore the value RC = 4.7 and is called . characteristic time represents the time in seconds in which the capacitor has been charged time:

namely 63%. It is usually considered that the capacitor is already loaded almost entirely after 5 characteristic times.

With analog sensor Arduino can not directly measure the electric charge, but the potential difference at the terminals of the capacitor, thus dividing both sides of the equation of charge, capacitance, we obtain:

so we can work with the voltage.

With these values, and taking into account that the arduino works in a range of 0 to 5 volts, the ideal graph of load capacitor would be similiar to this:

Where A indicates the characteristic time (4.7 s) and point B five times the characteristic time (23.5 s) which shows that the capacitor has almost reached its maximum capacity.

We will practice

To verify this behavior armarmos previously proposed circuit and connect the arduino:

Arduino 1023 returns a range of values ​​for the 5 volts, therefore 63% is equal to 647 and the values ​​for the 5 Tc (time characteristic) is 1016.

The logic of the experience is:

1. Download the capacitor putting the outputs 11 and 13 in LOW
2. A0 input sensing until the value is zero. At that time the capacitor is already fully downloaded.
3. Put exit 11 mode INPUT and 13 in HIGH , to begin charging the capacitor.
4. Sensar A0 input until the value is 1016.

The Arduino sketch code at the end of the post.

The values ​​are printed on the serial console. Can be recorded in a text file and imported into a spreadsheet. In particular I used Google Docs.

The results for the capacitor are in the following file: Cap470microF.txt

There you can see that for 63% of the load, ie the value 647, spent 4.382440 seconds. The theory indicated that 4.7 seconds should pass (one characteristic time), which is an error of 10% which, in principle, within the tolerance of the capacitor. For five times the characteristic (23.5 seconds), the value is 1003, corresponding to 98% of the maximum load.

The graph of the load curve is:

Which is very close to that predicted by theory.

Another test with a capacitor to give to the value 647, 34.412440 seconds against 33 of the theory. A 10% error. And for the 5 Tc (165 seconds), a value of 994, a 97% load.

The file with the values: Cap3300microF.txt

The graph was:

Sketch de arduino:

Referencies:
http://www.arduino.cc/playground/Portugues/LearningCapacitanceMeter