10 LED Projects for Geeks: Build Light-Up Costumes, Sci-Fi Gadgets, and Other Clever Inventions
Figure 2 A bicolor LED has two LEDs connected anode-to cathode A bicolor LED contains two LEDs in the same two-lead package typically with the individual LEDs connected anode-to-cathode as shown in Figure 2 Usually the two LEDs have different colors enabling the circuit to display two different colors using only two leads For example if cur rent travels through the circuit from left to right the lower LED turns on If current travels through the circuit from right to left the upper LED turns on Another fun type is the candle flicker LED which contains a small computer chip that turns the LED on and off in a flickering pattern designed to emulate the natural flicker of a candle You’ve probably seen these LEDs at fancy restaurants or wedding receptions or anywhere you want to have the ambiance of a candle without the risk of fire red-green-blue lED The red-green-blue RGB LED packages three LEDs into one and actually allows you to create a whole spectrum of colors not just red green and blue For example you can combine red and green light to make yellow green and blue light to create cyan and red and blue light to make violet Mixing all three colors of light at the same intensity produces white light By combining these three colors of light at varying levels of brightness for each individual color you can make millions of colors this is the same method your TV and phone use to display full-color images Usually to vary the brightness each color is switched on and off very rapidly which tricks our eyes into seeing each color at a different level of intensity The simplest RGB LED has four connec tions one for each of the three colors plus one connection common to all three LEDs This common connection can be either a common anode CA or common cathode CC which describes the internal connections of a four-pin RGB LED Figure 3 shows a diagram of the connections of a common anode RGB LED 5 i n t rO d u c t i O n
Figure 3 A common anode RGB LED contains red green and blue LEDs and has four wire leads red cathode common anode blue cathode green cathode Another common type of RGB LED is the digitally controlled RGB LED which contains a tiny computer chip used to control the brightness of each color Your microcontroller communicates with the chip in each RGB LED and sets the desired color The chips in the RGB LEDs are often either the WS2812B or the SK6812 and soft ware libraries exist for almost any system you want to use with them including Arduino Raspberry Pi and many others The biggest benefit of using digitally controlled RGB LEDs is that you can set and forget them so your microcontroller can update the LED with the latest desired color then move on to other tasks instead of having to constantly update the LED brightness You can also chain RGB LEDs together to form large strings or arrays of full color RGB LEDs making them useful for art projects and outdoor displays These LEDs are available in a variety of form factors as shown in Figures 4 and 5 Figure 4 A variety of RGB LEDs tiny surface-mount chips four-pin through hole package LEDs preattached to small circuit boards Figure 5 A flexible grid of digitally controlled RGB LEDs 6 i n t rO d u c t i O n
These figures show the digitally controlled RGB LEDs in a variety of packages including tiny surface-mount chips four-pin through hole packages LEDs attached to little circuit boards and even LEDs preattached in flexible grids A final type of RGB LED is a two-connection internally controlled LED These are a good option if you’re looking for really cheap RGB LEDs with only two leads These LEDs have a small control chip inside but unlike with the digitally controlled RGB LEDs you can’t actually control what they do For example as soon as you provide power to these LEDs the internal control chip starts displaying a prerecorded sequence of colors on the RGB LED usually cycling through each primary and secondary color with a nice color fade between each one reading an lED Datasheet The manufacturer of any LED usually provides a technical datasheet full of facts and figures It can seem overwhelming but don’t worry For the purposes of this book you need to know only two important numbers to use the LED safely Figure 6 shows a typical LED data sheet that you’ll use to find the critical details which are highlighted here in red Figure 6 An LED datasheet with forward current and forward voltage highlighted in red 7 i n t rO d u c t i O n
An LED produces light when electrical current flows through it but too much current can overheat and damage it Using the forward voltage and the maximum current parameters from the datasheet we can figure out what size resistor we need to operate the LED safely forward Voltage The forward voltage or Vf of an LED is the minimum amount of voltage the LED needs to start conducting electricity It measures the difference in voltage between the anode and cathode when it’s on If you apply a voltage below Vf the LED will not conduct any electricity or light up When the LED is operating normally the voltage across the LED will be equal to Vf We’ll use this fact later on when we start calculating circuit parameters The Vf of an LED depends on the chemistry of the materials used which also determines the color of the LED For example red LEDs have a typical Vf of 1 5 to 2 V while blue or white LEDs tend to have higher Vf values in the range of 2 to 3 V Maximum Current If your voltage exceeds Vf the LED conducts as much electricity as possible which can overheat and damage it To prevent this we need a second value from the datasheet the maximum current which is the maximum electrical current that can pass through the LED without overheating it Most LEDs have a maximum steady current and a higher maxi mum pulsed current Usually we use the maximum steady current for our calculations We measure current in units of amperes or amps abbreviated as A and in thousandths of an amp or milliamps abbreviated as mA Current is the amount of electricity that is flow ing through a device and it determines the brightness of an LED For example most small LEDs light up with only 10 to 30 mA of current Some larger LEDs and LED assemblies need hundreds of milliamps or even several amps of current resistance lEDs and ohm’s law To safely power an LED we need to provide at least Vf voltage across the LED but also limit the current to ensure it remains below the data sheet’s max current allowed The easiest way to do this is to add a resistor in series inline with the LED A resistor is the simplest pos sible circuit component with a very simple relationship between the 8 i n t rO d u c t i O n