## Education – the RC circuit

Today we continue down the path of analog electronics theory by stopping by for an introductory look at the RC circuit. That’s R for resistor, and C for capacitor. As we know from previous articles, resistors can resist or limit the flow of current in a circuit, and a capacitor stores electric current for use in the future. And – when used together – these two simple components can be used for many interesting applications such as timing and creating oscillators of various frequencies.

How is this so? Please consider the following simple circuit:

When the switch is in position A, current flows through R1 and into the capacitor C1 until it is fully charged. During this charging process, the voltage across the capacitor will change, starting from zero until fully charged, at which point the voltage will be the same as if the capacitor had been replaced by a break in the circuit – in this case 6V. Fair enough. But how long will the capacitor take to reach this state? Well the time taken is a function of several things – including the value of the resistor (R1) as it limits the flow of current; and the size of the capacitor – which determines how much charge can be stored.

If we know these two values, we can calculate the time constant of the circuit. The time constant is denoted by the character zeta (lower-case Greek Z).

The time constant is the time taken (in seconds) by the capacitor C that is fed from a resistor R to charge to a certain level. The capacitor will charge to 63% of the final voltage in one time constant, 85% in two time constants, and 100% in five time constants. If you graphed the % charge against time constant, the result is exponential. That is:

Now enough theory – let’s put this RC circuit to practice to see the voltage change across the capacitor as it charges. The resistor R1 will be 20k ohm, the capacitor 1000 uF.

Our time constant will be R x C which will be 20000 ohms x 0.001 farads, which equals 20 (seconds).  Notice the unit conversion – you need to go back to ohms and farads not micro-, pico- or nanofarads. So our example will take 20 seconds to reach 63% of final voltage, and 100 seconds to reach almost full voltage. This is assuming the values of the resistor and capacitor are accurate. The capacitor will have to be taken on face value as I can’t measure it with my equipment, and don’t have the data sheet to know the tolerance. The resistor measured at 19.84 k ohms, and the battery measured 6.27 volts. Therefore our real time constant should be around 19.84 seconds, give or take.

First of all, here is a shot of the little oscilloscope measuring the change in voltage over the capacitor with respect to time. The vertical scale is 1v/division:

And here is the multimeter measuring the voltage next to a stopwatch. (crude yet effective, no?)

The two videos were not the most accurate, as it was difficult to synchronise the stopwatch and start the circuit, but I hope you could see the exponential relationship between time and voltage.

What about discharging? Using the circuit above, if we moved the switch to B after charging the capacitor –  and R2 was also 20k ohm – how long would it take to discharge the capacitor? Exactly the same as charging it! So one time constant to discharge 63% and so on. So you can take the graph from above and invert it as such:

How can we make use of an RC circuit?

When power is applied, the capacitor starts to charge, and in doing so allows current to flow to the emitter of the transistor, which turns on the LED. However as the capacitor charges, less current passes to the base of the transistor, eventually turning it off. Therefore you can calculate time constants and experiment to create an off timer. However, a preferable way would be to make use of a 555 timer. For example, an RC combination is used to set the pulse length used in astable timing applications, for example using R1, R2 and C1:

Another use of the RC circuit is oscillating. Due to varying capacitor values due to tolerance, you most likely cannot make precision frequency generators, but you can still have some fun and make useful things. Here is a classic oscillator example – an astable multivibrator:

What is going on here? Here it is in action:

and here is one side being measured on the little scope:

We have two RC circuits, each controlling a transistor. When power is applied, there is no way to determine which side will start first, as this depends on the latent charge in the capacitors and the exact values of the resistors and capacitors. So to start let’s assume the left transistor (Q1) and LED are on; and the right transistor (Q2) and LED are off. The voltage at collector of Q1 will be close to zero as it is on. And the voltage at the base of Q2 will also be close to zero as C2 will initially be discharged. But C2 will now start charging via R4 and base of Q1 to around 5.4V (remember the 0.6v loss over the base-emitter junction of a transistor). While this is happening, C1 starts charging through R2. Once the voltage difference reaches 0.6V over the capacitor, Q2 is turned on.

But when Q2 is on, the voltage at the collector drops to zero, and C2 is charged, so it pulls the voltage at the base of Q1 to -5.4v, turning it off and the left LED. C1 starts charging via R1, and C2 starts charging via R3 until it reaches 0.6v. Then Q1 turns on, bringing the base of Q2 down to -5.4V – switching it off. And the whole process repeats itself. Argh. Now you can see why Arduino is so popular.

Time for a laugh – here is the result of too much current through a trimpot:

So there you have it – the RC circuit. Part of the magic of analogue electronics! And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

## Electronic components – the Capacitor

Today we continue with the series of articles on basic electronics with this introductory article about the capacitor.

What is a capacitor? A very simple answer to that question is a part that stores electric current for use in the future. How is this so? A capacitor is made up of two conductive plates, separated by a dielectric. The plates can be made from conductive material such as aluminium, and the dielectric is between these conductive plates. Dielectrics can be made from nothing (i.e. be a tiny gap between the plates or a vacuum), paper, plastic film, glass, a special kind of fluid, or ceramic material:

When a difference in potential exists across the plates (a change in voltage) an electric field is created between the plates, which stores electrical energy – charging the capacitor. When the potential difference is removed, the energy will leak through the dielectric until the potential no longer exists – in other words discharging the capacitor. The amount of energy that a capacitor can hold – its capacitance, is a unit of measure called the Farad.

The term farad is named after an Englishman by the name of Michael Faraday, a genius chemist and physicist that discovered (amongst many other things) the concept of electromagnetic fields. Anyhow, one farad (F) is quite a lot of energy, so capacitors usually store much less. The most common units of measurement are the following:

• picofarads – pF – 10^-12 – 0.000 000 000 001 F
• nanofarads – nF – 10^-9 – 0.000 000 001 F
• microfarads – uF – 10^-6 – 0.000 001 F

As well as the capacitance value, the other common parameters of a capacitor are:

• the voltage (never exceed your voltage!)
• leakage current – capacitors are not perfect and do leak a very tiny amount of current, usually in the micro-ampere range
• tolerance – similar to resistors, actual versus manufactured values can vary – sometimes up to 20% either way
• working temperature – always check this if your project involves extreme temperatures

It is always interesting to read component data sheets, and this is no exception for capacitors. You can learn a lot about the individual parameters and design your project accordingly. Here is a typical example of a data sheet for an electrolytic capacitor from Vishay. And here are the schematic symbols for non-polarised and then polarised capacitors:

At this point let’s have a look at the various types of popular capacitors:

Electrolytic Capacitors

These are used when very high values of capacitance are required, for power smoothing, spike suppression and so on. They consist of two sheets of aluminium foil, one sheet covered with an oxide coating, separated by paper soaked in electrolye – this is rolled up and inserted into a cylinder, with two wires inserted. As the electrolyte is a liquid, it is affected by ambient temperature. Therefore as temperature increases, the capacitance increases – and vice versa. Therefore temperature extremes need to be taken into account, and perhaps other types of capacitors used. The capacitors in the photo above are radial capacitors; you can also find axial capacitors with one lead at each end. Note that electrolytics are polarised! They have a positive and negative lead – the negative is normally indicated by the striped-arrow line (see above).

V-chip capacitors

These are surface-mount electrolytic capacitors, for example these two on my Arduino (below):

Ceramic capacitors

These are very small, constructed from layers of aluminium and ceramic material:

Their capacitance is also very low, the lowest I have seen is 0.015 picofarads. Typically used in situations that have high frequencies, such as spike protection for integrated circuits. Reading the value is quite simple, the first two digits are the significant figures, and the third is the multiplier. The result is always picofarads. For example. 121 is 120 picofarads, 8.2 is 8.2 picofarads, 12 is 12 picofarads. If there is a letter suffix, this indicates the tolerance:

• C = +/1 0.25pF
• D = +/- 0.5 pF
• J = 5%
• K = 10%
• M = 20%
• P = +100%/-0%
• Y = -20%/+50%
• Z = -20%/+80%

If there are numbers after the tolerance, they normally state the maximum working voltage. If your capacitor does not have a tolerance printed on it, assume it is between 10 and 20%. Or better yet, replace it with a better capacitor that states the tolerance.

Polyester capacitors

These are also very popular for high-frequency circuits, as they can discharge very quickly and have a very low leakage. The older styles (green/brown above) – read their values is the same as the ceramic capacitors (above), with a slight difference – sometimes (!) the voltage rating is before/above/below the value code. So using the green example above which reads “2A683J”, this breaks down to the voltage rating 2A, and the value 683, then the tolerance J. Voltage ratings are:

• 2A – 100V DC
• 2E – 250V DC
• 2G – 400 V DC
• 2J = 630V DC

So the 2A683J will have a voltage rating of 100V, a tolerance of 5%, and a capacitance of 68000 picofarads (0.068 uF or 68 nF).

Please note – this coding does seem to vary by manufacturer. Some will actually have (e.g.) 630V printed on them, and some even have their own coding. If you are unsure of the voltage rating, one has to really examine the circuit the capacitor is located in, or hunt down the data sheet. When buying new parts, it pays to get the data sheet from the distributor, then file it away indexed with your stock control database.

The newer styles (blue above) are different again. This one is 0.47 uF 63 volts 10% tolerance.

Variable capacitors

There are two main types – trimmer capacitors (above right) used for fine-tuning; and normal variable (or mini-tuning) capacitors (above left) used for applications such as radio tuning. Usually have a set range, for example the tuning capacitor’s range is 60 to 160 picofarads. The schematic symbol for trimmer capacitors is:

and for variable capacitors is:

Tantalum capacitors

Can be used as a replacement for electrolytic capacitors where space is at a premium, and a more accurate and less leaky (electrically that is) solution is required. Tantalums are also polarised (see the tiny ‘+’ in the photo above).

Surface-mount capacitors

There are many types of capacitor in surface-mount packaging. Hover over the images below for descriptions:

Mathematics of capacitors

Working with capacitors is easy, however some mathematics may be required. If you recall the formulae associated with resistors, you will find this quite easy.

Capacitors in parallel

This is simple – the total capacitance of parallel capacitors is the sum of the lot. However – the voltage parameter of the group is the minimum value used. Furthermore, do not mix capacitor types.

For example – C1 is 10 uF, 63V; C2 is 470 uF 25V; C3 is 1000 uF 16V. With these three in parallel, the capacitance is 1480 uF; and the maximum voltage is 16 volts.

{Thank you readers for checking my maths! – John :)}

Capacitors in series

This is somewhat complex, but can be done!

Again, always use the same type of capacitor, and the lowest voltage rating applies to the entire group.

Smoothing DC current with a capacitor

When AC current is converted to DC current using a bridge rectifier (four diodes) the resulting DC current is not very smooth… that is the actual voltage changes between zero and the maximum over very short periods of time. A capacitor can be placed between the positive and negative rails immediately after the bridge rectifier to solve this problem. It does this by charging to capacity when the DC current is above zero, then when the voltage from the rectifier drops the capacitor supplies current, acting as a reservoir. This in turn maintains the supply voltage:

Using the circuit above, we will demonstrate the smoothing process in the video clip below. The first part shows the AC current on the oscilloscope; the second part shows the noisy DC current at the points 4 and 8 on the circuit above. Then a 470 uF electrolytic capacitor is inserted across points 4 and 8 – you can see the difference and how smooth the current has become. There is still a slight ripple, but I cannot show this due to the low resolution of my oscilloscope. When building a power supply, one would place the linear regulator after the capacitor in our example.

Some information for this post is from Wikipedia; various technical information and inspiration from books by Forrest Mims III;  tantalum and SMD capacitor photos from element14 Australia.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

## Kit Review – Seeedstudio Capacitance Meter

[Updated 17/01/2013]

This is the first of many (hopefully) reviews of electronics kits. In the past I have often wondered what a kit would be like, as they aren’t something you can look at in a store, apart from a box of components or a magazine review. Especially products that need to be imported from abroad. So now I’m going to do some legwork for you! Let’s begin…

Recently several retailers had been offering a capacitance meter kit which seemed too cheap, however looking at the specifications it was too good to pass up.

But on with the review. From placing the order on the web (paying with Paypal) to receiving the package took eleven working days. It was sent via registered airmail. Your time will vary wildly, depending on the time of year. For example, during Chinese New Year, nothing happens! Another benefit of using local retailers, no delay. Anyhow, thankfully the kit was packaged well with bubble wrap in a sturdy cardboard box.

After opening the box and attacking the bubble wrap I opened the package to check the parts against the list, and they were all there. The kit I received was a version 2.0, which would explain the part outlines and holes on the PCB but not in the list. There are also pads for external leads, and and holes for header pins if you wish to reprogram the microcontroller (but the pins were not included). The resistors were metal film 1% values, and the board was silk-screened and solder masked. However, an IC socket was not included… I feel this should have been – for the price this kit will attract many beginners who may overheat the microcontroller IC.

Also note that there is a plastic layer over the LED display, this took me by surprise as have not seen this happen on other displays in the past.
So it was time to get started. Being colourblind I measure all the resistors and place them in numerical order (from R1…Rx) on a breadboard to avoid mistakes. Then before soldering the overhead light, fume extractor and helping hands are moved into place to make life healthier and easier.

And using a magnifying glass is also very useful in spotting soldering mistakes and generally helping poor eyesight…

The layout of the components is screened on top of the PCB, so you can merrily go forth and solder. However, the polarity of the electrolytic capacitors is not shown clearly or mentioned in the instructions. After some detective work it turns out the positive pin of the electrolytics goes into the square pad. First I soldered in the hardware (switch, push button, DC socket), then the resistors, then the capacitors…

Then the crystal. semiconductors, ending with the microcontoller. As mentioned earlier, an IC socket should have been included to save a lot of people a lot of worry. Not everyone has steady hands or a good sense of timing! The extra ten cents wouldn’t have hurt the retail price. Anyhow…

I plug in my 9V DC plugpack, turn it on … and it worked first time! Woohoo. Note that due to the use of an LM78L05 voltage regulator, the meter runs on around 8 to 16 volts DC, using less than 100mA current. Watching the display was almost mesmerising, there’s nothing like that feeling of assembling something and seeing it work.

But did it really work? Let’s see… where are my capacitors?
The specifications state it can measure between 1 picofarad and 500 microfarads. The manual states that for better accuracy with measuring small values to enclose the meter in a metal box and attached the ground to the box. No time for that! Made do with four 20mm spacers to raise it from the desk. The specs state it is accurate to less than 2%. The user also needs to take note that the capacitor tolerance levels can vary, especially with electrolytics. Always try and check the manufacturer’s data sheet if possible. Supplier websites such as element14, Digikey and Mouser can be useful for that purpose.

So, first of all I tried a 0.1uF greencap, and it measured 99.3 nanofarads. Not a bad start. Always remember to press the ‘zero’ button before each measurement.

Next a 0.01 uF greencap, returning 10.2~10.3 nF. Fair enough.

Then a 330 picofarad ceramic. Just to note at this point, one should clean the component leads before measuring, dirty leads will affect the value measured. Furthermore, short the capactor by crossing the leads over to discharge it completely. Anyway, that 330 pF returned 319 pF

How low can we go? Let’s try a 1.5 pF…

At this level, the metal shielding would be a good idea. The meter returned a floating reading 1.4~2.1 pF. Finally, an electrolytic. 330 uF.

Which returned 343 uF. Not bad considering the tolerance of electrolytics can vary, at the minimum they can be +/-10%. Now let’s see it action! The first capacitor tested is a 4.7uF electrolytic, the second a 1.5 pF ceramic. There is no audio in this clip.

So there you have it. For less than twenty US dollars you can have a decent capacitor meter that is easy to construct, quite sturdy, and very useful for the electronics enthusiast. This kit is available from Seeedstudio, Sparkfun and others.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

[Note – this kit was purchased by myself personally and reviewed without notifying the manufacturer or retailer]

Posted in kit review, KIT-09485Comments (0)

### Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.