Introduction: RGB LED Fiber Optic Tree (aka Project Sparkle)

Find your room a bit too dull? Want to add a bit of sparkle to it? Read here how to take an RGB LED, add some fiber optic wire, and make it SHINE!

The basic goal of Project Sparkle is to take a super bright LED plus some end-glow fiber optic cable and hook it up to an arduino to create a nice lighting effect. This is an imitation of fiber optic star tilings/ceilings but mounted vertically due to not being able to drill into my ceiling and does not use a pre-manufactured illuminator to light the fiber optic wires.

So really it's a way to get cool fiber optic effects without investing in expensive illuminators. Connecting it via LED to an arduino also adds for any type of customization and color refinement! Best of both worlds!

Materials:
10W LED - $5 - eBay.  **Warning, this is very bright. Do NOT look at this directly when on. Stick it under a box for testing or another suitable covering**
Fiber optic end glow wire - ~$25-30 - I purchased it online from TriNorthLighting. Fiber optic cable is generally sold by the foot at different strand numbers within the cable. The fewer strands in a cable generally the thicker each individual wire, meaning a brighter end spot overall. Check this page for a handy chart on cable number versus width.
12V, 2Amp power supply - ~$10 - I had one lying around.

Secret materials:
Most of these parts are things people will have around and can be reused for other projects
Arduino - $25-30 - I used an Arduino Uno R3
Breadboard - ~$5
Soldering iron - Anywhere from $10 to an order of magnitude higher
Circuit components - each only cost a few cents, the trickier issue is probably where to get them nowadays
Wire, wire strippers, cutters, etc.
Tulle - $5 - purchased from a craft store. It's the material I used to weave the fiber optic strands on the wall

Step 1: Overview of Circuit Components

Other than basic wire (and the LED) our circuit has two main components: transistors and resistors.

Transistors

So we have a 10W LED, power cable, and arduino. The goal is to wire the LED to the breadboard and attach the arduino to the same breadboard so that the arduino can output a value and the LED will turn on at a certain brightness (corresponding to the value the arduino outputed). The issue is, the arduino can only supply 5V, but our LED needs 12V (note: this may change depending on what power LED you're using) . This is where the power supply comes in.

"How will we ever connect the arduino, LED, and power supply together?!" you might ask.

The answer is magic. The magic of TRANSISTORS!

Simplistically, a transistor is an amplifier or a switch. In this case we're using it as a switch. It'll be connected at one pin to the arduino, another pin to the power supply, and a third to the LED. When the arduino sends a current over a specific threshold the transistor will 'turn on' and let the power supply voltage run through it, lighting the LED. When there's not enough current from the arduino, the transistor won't let the power supply run through it and the LED will be off.

The switching type of transistor is known as a switching or junction transistor. There are many different types available which have different properties like voltage needed across its pins, the gain, etc. I encourage anyone interested to read more about transistors to get a much better understanding of them.

The 10W LED has four pins total, on one side the ground and on the other side a pin for each color. If we want to be able to control each color separately (in order to be able to display any color combination of RGB), each color must have its own transistor, so we need three transistors total. More details on the transistors used will be in the next step.

Resistors

Now that we've figured out how to power up the LED, there's another problem. All this power isn't necessarily a good thing! We don't want to short out the LED, so resistors need to be added to it.

Of the four pins on the LED, the ground pin doesn't need a resistor since it's just going to ground. But the three color pins will need at least one resistor, and since different colors draw different voltages they aren't necessarily the same resistances.

"How will we ever figure out these values?!" you might ask.

Well the answer is MAGIC. The magic of MATHEMATICS! (read on it's worth it I promise...)

Step 2: Calculating Circuit Components

Transistors type

As said in the previous step, the transistors used here are of the switching variety. What specific type of transistor is needed in a circuit depends on what the circuit requires, but in this circuit a 2N2219 transistor is suitable. Note, you can use a transistor other than 2N2219, as long as it has the right specifications for the circuit you're working on. (The more common 2N2222 transistor should also be suitable)

Depending on the transistor type, the three pins on the transistor will be either "emitter, base, collector" or "gate, source, drain." The 2N2219 type is the former. There are many transistor body types, so in order to determine which pin corresponds to the emitter, base, and collector, it'll be time to consult your spec sheet!

The transistor also needs two resistors. One connects the base of the transistor to the arduino - this can be any value, generally around 1kΩ. This is used so that any spurious current from the arduino won't cause the transistor to trigger and accidentally turn the light on. The second resistor needed connects the base to ground and is generally a large value like 10kΩ

Resistors types

To connect the power supply to the LED we have to use some resistors. Each color on the LED has a different required voltage input. The specific values depend on your LED used, but for a standard 10W LED these will likely be in the right range:

Red - 6-8 V
Green - 9-12 V
Blue - 9-11 V
Current required by the LED: 3 milliAmps (mA)
Power supply voltage: 12 V

So the situation is: we're using a 12 V power supply to power up the LED and each color should receive a voltage less than that. We need to use resistors to decrease the voltage each color on the LED actually sees.

To determine the value of resistance needed it's time to consult Ohm's Law. For example for the red color:

Voltage = Current * Resistance ....
Rewrite to Resistance = Voltage (drop) / Current
Resistance = 4 V / 0.3 A = 13.3Ω

(The value of 4 V is from 12V (power supply) - maximum of red range (8 V))

We're not done yet though. Depending on your resistor type (i.e. its size) only a certain amount of power can be dissipated by it. If we use resistors that can't dissipate enough power we'll burn them out.

The formula to calculate the power across the resistor comes from Ohm's law: it's Power = Voltage * Current.
Power = 4V * 0.3 A = 1.2 W

This means we need a 13.3Ω, 1.2 W (at least) resistor to make sure our LED is safe. Problem is, most common resistors come in 1/4 W or less. What to do?!

Using the magic of setting up resistors in parallel we can fix the issue. By combining four (1/4 W) resistors in parallel the total power dissipation adds up to 1 W. (Ideally we'd add five resistors in parallel, but since 1.2W will only be seen when it's lit to the max, and gen we're using a little less). Adding resistors in parallel causes their resistance to decrease proportionally (meaning if we combine four 13.3 Ω resistors in parallel the total resistance will only be ~3 Ω)

To get the right resistance and power dissipation we can combine four 68Ω 1/4W resistors in parallel. We get this number by multiplying 13.3Ω by four, which is ~53Ω and then taking the next highest standard value for a resistor.

Overall: to power the red color we need to use either one 13.3Ω 1W resistor, or four 68Ω 1/4W resistors in parallel.

To calculate the resistance needed for the other colors use the same process.

Summary of required circuit components:
3 x 2N2219 transistors
3 x 1kΩ resistors
3 x 10 kΩ resistors
Red: 4 x 68Ω 1/4 W resistors
Blue: 4 x 27Ω 1/4W resistors
Green: 4 x 27 Ω 1/4W resistors

Step 3: Circuit Schematic / Constructing the Circuit

Having gone through the math and collected all the required pieces it's time to put them together!

First take your power supply and cut off whatever connection it has at the end and isolate the power and ground wires. Add the ground wire to one of the breadboard rails. Solder the power wire to the solder the necessary resistors onto the LED. Then build the circuit like indicated on the circuit diagram.

Note that all the grounds in the circuit (arduino ground, transistor grounds, power supply grounds), must be connected together in some way.

Step 4: Arduino Code

We're almost there! Time to connect our circuit to the arduino.

The code here just runs the RGB LED through a color cycle (i.e. checks out the entire rainbow). If you're familiar with arduino then this isn't too complicated. This code wasn't originally written by me but I honestly cannot remember where I downloaded it from; it was open source. If I remember or if anyone knows the source I'll gladly cite it.

The sketch is pasted below. Just make sure the pin values in the sketch correspond to the pins on the arduino used to connect to the LED. All the code does is send an individual value (from 0 to 255) to each of LED color pins. If you want a specific color to come up, check out an RGB color chart

//Runs an RGB LED through a color wheel cycle

int brightness = 0;    // how bright the LED is. Maximum value is 255
int rad = 0;

#define RED 10
#define BLUE 11
#define GREEN 9

void setup()  {
  // declare pins to be an output:
  pinMode(RED, OUTPUT);
  pinMode(GREEN, OUTPUT);
  pinMode(BLUE, OUTPUT);
}

//from 0 to 127
void displayColor(uint16_t WheelPos)
{
  byte r, g, b;
  switch(WheelPos / 128)
  {
    case 0:
      r = 127 - WheelPos % 128; //Red down
      g = WheelPos % 128; // Green up
      b = 0; //blue off
      break;
    case 1:
      g = 127 - WheelPos % 128; //green down
      b = WheelPos % 128; //blue up
      r = 0; //red off
      break;
    case 2:
      b = 127 - WheelPos % 128; //blue down
      r = WheelPos % 128; //red up
      g = 0; //green off
      break;
  }
  analogWrite(RED, r*2);
  analogWrite(GREEN, g*2);
  analogWrite(BLUE, b*2);

}
void loop()  {  
  displayColor(rad);
  delay(40);                           
  rad = (rad+1) % 384;
}

Step 5: Adding the Fiber Optic Wires

Even if you don't complete this step, the nice thing is that now we have an awesome, bright, fully customizable RGB LED. I chose to combine it with fiber optics, but really you can do anything you want! Make a sweet spotlight? Light a disco ball? So many possibilities!

I originally purchased five feet of 50 strand fiber, 10 feet of 12 strand fiber, and 5 feet of 25 strand fiber. I ended up cutting the length in half so that I'd have more spots even though the wires themselves were shorter.

I chose to make a tree since I couldn't mount them through a wall. The tulle was glued on the wall via rubber cement (tulle is fairly lightweight, so tape might be sufficient). The fibers are thread through the tulle into a tree like pattern.

Using an empty/dried out soda can the LED is placed at the bottom, and the fibers are added to the top of it.

The biggest issue at this point is trying to make sure light goes through the fibers instead of just out through the top of the soda can. Wrapping the fibers tightly in foil can help, but I suggest trying out whatever setup you think might work.

Put all these pieces together and we have our tree!

Step 6: Party Time!

Nothing left to do but dim the lights, power the arduino, and bask in the glow of out our new fiber optic setup!

I've attached a video of the setup as well. It looks better in person, but you can see it slowly moving through a color wheel.

Lamps & Lighting Contest

Participated in the
Lamps & Lighting Contest