Merry almost Christmas everyone!
Decided to make a small tutorial for anyone interested to make their own Christmas Lighting from basic electronic components because I thought it would be a fun way to pick up electronics while spending a little time getting into the Christmas mood :] Basically what we will be trying to complete in this tutorial is a circuit that causes two groups of LEDs (light emitting diodes) to flash one group at a time, repeatedly (a common oscillating circuit).
Aside from teaching you how to complete this "Blinky" project, we will be going into a little detail regarding how this circuit works so that you can take away some knowledge together with some Christmas lightings. Feel free to share this project with anyone you know - use it to introduce your kids to electronics or for your students as a small holiday project!
The components you will require for this project are (actual components used in demo are bracketed):
2X PNP Transistors (2N2907A: http://belchip.by/sitedocs/28790.pdf)
2X Capacitors (14uF, Polarized)
2X 50K-200K Resistors (100kΩ)
2X 10-200 Ohm Resistors (100Ω)
nX Jumper cables/wire (as desired)
nX LEDs (as desired)
1X Breadboard + 1X 4AA Battery Case (Tested my PlusBoard Prototype in the demo, its a project I did on Kickstarter and was labelled as a "Project We Love" by the Kickstarter Staff, check it out if you are interested! The campaign is actually still on-going HERE.
A quick search will show you what these components are and where to buy them (taobao or alibaba recommended, but you'll have to wait for delivery), and with that, let's get started!
Step 1: First Off... Studying the Schematic
Before we begin constructing a circuit, it is critical to understand the "map" of electronics that will guide our path. In the two diagrams above we have an oscillator (periodic changing of signals) build from PNP Transistors (these turn on and off depending on the voltage we feed into their bases - labeled with B and normally the middle leg). Once the voltage at B is sufficiently large, a current flows through the emitter to the collector (the terminology is unintuitive in this case, but accept it for now, the nomenclature was determined by NPN Transistor conventions). The two capacitors we see are linked from the collector of each transistor to the base of the other. From here, if we understand that the capacitors here are just really tiny batteries that can be charged (thus experiencing an increase in voltage), we can already guess that this circuit's periodic characteristics are based off the charging and discharging of our capacitors.
How exactly this occurs is nicely simulated by Faustad in the short clip below (built from NPN Transistors, but exactly the same theory). Basically, once the base of a transistor-one has been sufficiently charged, it allows current to flow through it. When this occurs, two things happen:
1. The capacitor linked to its own base discharges, causing the voltage across transistor-one's base to drop
2. The capacitor linked to the base of transistor-two is being charged, eventually reaching a value where current flows through it as well.
This cycle continues so long as power is fed into the transistors as seen by the "Transient Analysis" Graph (red lines representing voltage across the red LEDs and green lines representing the voltage across the green LEDs, notice that they peak periodically and in an alternate fashion) Got it? Don't worry, it sounds simple but isn't exactly trivial. Looking at the video clip really helps with understanding this system, regardless, on to the fun part! Construction time! :]
Step 2: Connect Power to Transistor
Connect your power, anything from 5V to 12V to your transistor's emitter terminals! Easy~
Step 3: Insert Capacitors
To ensure the transistors on-off states are oppositely linked, we will now insert the capacitors from the base of one transistor to the collector of the other! Note that if you are using polarized capacitors, do plug the positive end towards the collector. If your capacitor is not polarized (typically ceramic, or identified as the non-cylindrical, but pancake like sort), the direction does not matter.
Step 4: Insert Large Resistance
Now we will plug the 100kΩ resistors from the base of each transistor to your Ground. Ground typically refers to the negative terminal (black/brown) wire of your battery case, or negative power line on your breadboard. The reason we have such a large resistance, R, here is to ensure that the current, I (given by I=V/R, where V = input voltage and R = 100k,in this case) is tiny. This way, the transistor will not get damaged even if there is a power surge because the current flowing through it will still be tiny. Transistors are somewhat sensitive, so treat them with care :]
Step 5: LED Protection Resistors
Almost there, now we just need one small resistor (100Ω in my case) to limit the current that will flow through the LEDs once we power the circuit up. Note that my LEDs here are relatively less sensitive to a current surge from small power sources such as a battery pack or portable charger as compared to the transistor. We place this resistor between the collector and a long line of pins which will eventually act as a bunch of positive terminals for our LEDs, the longer this conducting strip, the more LED's you can add later. For those who are more experienced, yes, the negative terminals (shorter leg) of the LEDs are going to be plugged straight into the common ground!
NOTE: For the PlusBoard Prototype I am using, the power is fed straight into the Blue and Red lines seen at the top of my black breadboard-like thing, take it that the entire blue line is plugged into the negative terminal of a power source, while the entire red line is plugged into the positive terminal of the power source.
Step 6: Check the Circuit and Troubleshoot~
Plug in your LED to a male-female jumper cable. The plug the male ends of the jumper cable into the respective power lines you assigned for each color you are going to use. I used the conducting strip beneath the red line as my power line for the red LEDs and the blue line as my power line for the green LEDs, all the negative terminals of the LED's go straight to the power line's ground! Making sure the polarity of the LED is correct is critical!
NOTE: If your capacitor's capacitance is too small, or your input voltage is too high, you may find that the frequency with which the LED's are turning on and off may be too fast for your eyes to catch. The reason for this is that if the capacitor used has a small capacitance, it will be fully charged to the transistor's minimum on-voltage by the power source too quickly, allowing current to flow through it and cycling immediately to the next transistor which does the same. Likewise, if the input voltage is too large, the rate at which the capacitor is filled with charge will be high, resulting in the same consequence. You can check out the video below to see what happens when I tune the voltage on the PlusBoard's power supply!
Step 7: LED Parteeehhh
With that, you may now continue to plug in LED's into each powerline. Remember, each powerline is tagged to a respective transistor which allows a fixed amount of current to flow through it once the voltage at the transistor's base is high enough. This means that if you put too many LED's there may not be enough current to drive all the LEDs and they may be dim or not light up at all as a result.
You don't need to use the same colored LEDs for each strip, feel free to go crazy! However, because this circuit only cycles between on-off states of two sets of LEDs, you'll only get to turn each set on alternately.
Also, be creative with the applications of your LED's, feel free to share your creations in the comments section of this tutorial. Good luck and have fun! :]
P.S. A little shameless promotion of the other project that I used to demonstrate this one, the cool-looking board used in the video is known as a PlusBoard and is currently on Kickstarter, you can support my friends and I by checking out the campaign HERE if you think it'll be useful! It comes with quite a few other super useful tricks as well;]