Project: Build a Slow Switch
The simplest timer we can create uses just a capacitor, a resistor, an LED, and a switch. We will build the second simplest timer, by adding another resistor.
In the schematic shown above you can see that we have a resistor near the battery labeled R1. That is the charging resistor, and it determines how fast the capacitor will charge. In the middle you see the LED and its current limiting resistor.
When you push the "on" button, the switch closes, and the capacitor begins to charge. The voltage across the LED and its current limiting resistor is at first not high enough to turn the LED on. The LED is acting as a second (open) switch, keeping any of the current from going through it or its resistor.
At some point, however, the voltage gets high enough (in this case about 1.7 volts) that the LED turns on, and current starts to flow through it and through its resistor.
Now the capacitor starts to charge more slowly, since some of the current is being diverted to the LED.
As the voltage on the capacitor rises, the current through the LED increases, and it gets brighter. In this simulation, when the LED current exceeds 20 milliamperes, the LED turns yellow, as a warning that the current is higher than the LED is rated for. If the current ever exceeds twice the rated current, the diode turns brown, and stops emitting light, and stops allowing current to flow through it. It is now a DED.
After the capacitor has charged for a while, click on the "off" button. The battery and its resistor are now disconnected, and the capacitor discharges through the LED and its current limiting resistor. The size of that resistor not only protects the LED from getting too much current, but it also determines how long it takes the capacitor to discharge.
What we have built is a slow switch. When we turn it on, the LED slowly gets brighter. When we turn it off, the LED slowly gets dimmer.
Notice that once the LED has stopped glowing, very little current goes through it, and the capacitor seems to almost stop discharging. Diodes have a very small conductance (a very high resistance) when the voltage is below their "on" threshold. So the capacitor can only drain very slowly through the unlit LED. Capacitors also have some internal resistance, although it is also very high. It will take a long time for the capacitor to completely drain to zero.
You can play with the values of the resistors and the size of the capacitor to set the timing to your liking. Because the current limiting resistor for the LED serves two purposes (limiting the LED current and determining the time it takes the LED to fade), you will find that it is simplest to select a value for it first, with the idea of protecting the LED, and then select the size of the capacitor (the other determinant of the fade time) to set the fade time. When you are happy with the fade time, select the charging resistor to set the charging time.
You can thus have complete control over how long it takes to light the LED fully, and how long it takes for it to fade completely.
The photo above shows the circuit built on a solderless breadboard. I used simple home-made switch, just a bit of yellow wire that we plug into the breadboard to complete the circuit.
Above you can see the circuit in the "on" state.
Solderless breadboards have rows and columns of holes into which you can plug components and wires. The top and bottom rows of holes are all electrically connected to one another. Between those rows are two areas where the holes in the columns are all electrically connected.
You can see how these features are used in the photo below, where I have drawn arrows showing how the electrons flow through the circuit.
The big round thing on the right is an aluminum electrolytic capacitor. We see it here only in the top view, but it is a cylinder about an inch tall.
The LED is easy to spot by the difference between the "on" and "off" photos. It is the green square object.