Image Description
Using a capacitor for analogue inputs
Capacitors are electrical components that store charge.
When current is fed into a capacitor, it will begin to store charge. The voltage across the capacitor will start off low, and increase as the charge builds up.
By putting a resistor in series with the capacitor, you can slow the speed at which it charges. With a high resistance, the capacitor will charge slowly, whereas a low resistance will let it charge quickly.
If you time how long it takes the capacitor’s voltage to get over 1.8V (or be on), you can work out the resistance of the component in series with it.
Many, but not all, capacitors are polarised which means they have a positive and a negative leg. In this case, the negative leg is shorter and should be marked with a ‘-‘ symbol.
Image Description
Light-dependent resistors
An LDR (sometimes called a photocell) is a special type of resistor.
When light hits the LDR, its resistance is very low, but when it’s in the dark its resistance is very high.
By placing a capacitor in series with an LDR, the capacitor will charge at different speeds depending on whether it’s light or dark.
Creating a light-sensing circuit
Place an LDR into your breadboard, as shown below:
Now place a capacitor in series with the LDR. As the capacitor is a polar component, you must make sure the positive, long leg is on the same track as the LDR leg.
Finally, add jumper leads to connect the two components to your Raspberry Pi.
Image Description
Image Description
Web page was started with Mobirise