This instructable will get you going on making your own arduino powered Red Green and Blue LED project. It doesn't even have to be a shelf! Vodka bottles just happen to light up nicely so that is what I chose to do.

In this project we use every pin on the Arduino to achieve as much control over a set of LEDs as we can. The functionality of the vodka shelf includes:

1. Power 8 sets of two 4 pin RGB LEDs
2. Create two separate colors which are staggered across the surface
3. Turn on and off any set of LEDs
4. Micro controller control of the color and lighting patterns 
5. Optional manual control of the LED colors using knob potentiometers

Your eyes are sensitive to only three colors: Red, Green and Blue. All other colors excite the RGB receptors in your eyes in different proportions allowing you to interpret that color. Thus by sending certain amounts of Red, Green and Blue wavelength light into your eyes it appears as though you are seeing different colors. This is how your TV works, if you look really closely you'll see its made up of many small R,G,B lights. We experience this every day. Its just really cool to be able to control it for yourself. I was amazed to when I turned on the Red and Green lights and Yellow appeared.

R+B = Magenta,
R+G+B = White
G+B = Cyan

The easiest way to control the relative amounts of light we get from each LED is by using Pulse Width Modulation (PWM). Instead of turning the lights slightly on by applying a lower voltage we turn them completely on then completely off for a given amount of time over a short cycle. For the arduino, this cycle is approximately 500 Hz. Our eyes respond too slowly to see the fast blinking and they give us the average over time, approximating having partially turned the light on.

Step 1: Materials

Here are the materials you need. The amounts may vary depending on what you choose to build so here is what I used:

-16x RGB LEDs:  These are actually 3LEDs built into one casing. They have 4pins, one for each LED anode (+ve) and one common cathode (-ve). These are easy to find on the internet and can be found cheap on ebay. I paid $10 for 50. A good current rating is around 15mA (per internal LED).

-3x 100K Potentiometers: I used knobs

-1x Push-button

-Protoboard or breadboard + wires, an arduino prototyping shield is ideal.

-16x 2N3904 N-channel Bipolar Junction transistors, very common and inexpensive. Ebay.

-6x 10 Ohm 1/8 Watt Resistor
-8x 1K Ohm 1/8 Watt Resistor
-8x 100 Ohm 1/4 Watt Resistor
-8x 64 Ohm 1/4 Watt Resistor
-8x 56 Ohm 1/4 Watt Resistor
-1x 10K Ohm 1/4 Watt Resistor
-3x 56K Ohm 1/4 Watt Resistor

-Length of ribbon cable

-Ikea shelf

Step 2: Try It on a Protoboard

If you don't have too much experience with soldering or electronics a good idea is to try and building a simple version on a proto-board before attempting the real thing. This will also give you a feel for transistors and how they work as a current device (not voltage). Mistakes in the soldering phase can be time costly and difficult to debug. Practice and do it right the first time. 

Why use transistors? The digital pins on the Arduino simply can't source enough current to power the amount of LEDs we want. Each 2N3904 can handle 200mA, more than enough to power the 4 LEDs each one is connected to.

Another note. I don't know what current the 5V voltage regulator is rated to on the Arduino. I can run all the LEDs on full and it gets hot but doesn't die (yet). This works out to 2x8x3 (LEDS) x 0.015A = 0.72A
0.72A x 5V = 3.6W
It would be pretty easy to add your own 5V power supply to the board.

Its easy to write a simple arduino program to control the colors of one or two LEDs. If you're not up for it, here is one that takes in Serial commands to change the colors. An example practice circuit is included in the drawing and PDFs to work with the code. It accepts commands in the form of:
*$RGB,0..255,0..255,0..255,0/1,0/1,0/1*   (stars included)
This sets the PWM values for RGB to between 0 and 255 and turns on and off the 3 cutoff transistors. Why use one cutoff transistor for each color? If you wire some of your lights through the cutoff transistor and some straight to the ground this will allow you to make more colors. You could have: R+B on one light with only R on another.

Step 3: Build Your Board

Time to make the connections shown in the diagram. Take some time laying it all out so that you have adequate space. I didn't. You can see on the finished product that there are many wires overlapping other ones. Fortunately I didn't have too many problems, shorts or loose connections when finished as debugging this thing could have been a nightmare.

Pins 3,5,6,9,10,11 are capable of PWM output. We can drive two sets of 3 colors. You can see these pins are connected to transistors being used as switches. They are done so in what I think is an interesting way, through a 10 Ohm resistor. Normally we would put a larger resistor to limit the current through the base of the transistor. Since the 2N3904 has a current gain of 200, we would want one that provides approximately 1mA so we can use the full 200mA capacity of the unit. When the transistor is fully open the voltage across the LED and LED resistor should be close to 5V. When it is there will be a low Voltage difference between the Base input and the emmitter. Thus the unit should act as a current regulator for very near to 15mA. I'm not an expert and I don't know for sure but this appears to work well in the finished project.

Note that for this project we assume the following Voltage drops across each LED at 15mA:
Red: 2V ( that is why it has the largest resistor in series with it)
Green: 3V
Blue: 3.3V
Its generally not great practice to put LEDs in parallel because any differences in their V-I curves will result in different brightness between them. I only wanted to work with 5V, not enough for 2 in series so I tested my light sets for differences before installing.

You can see that the Potentiometers and Push button are located on the same side as the USB and power connector. This is the side which will sit exposed at the edge of the shelf to allow for easy user control. The circuits for the potentiometers and pushbutton are in the top right. 

This is where having an Arduino prototyping shield can really help. This is what I ended up making out of a normal protoboard. It just piggybacks on top of the Arduino and can be removed and attached easily. 

Step 4: Install the LEDs Into the Shelf

This part is fairly straightforward. Drill 8 sets of holes with even spacing through the shelf. Then solder all the common leads of 2 LEDs together and solder on the ribbon cable. Each set of LEDs gets 4 wires, one for each RGB anode and one for the Cathode.I would recommend making the appropriate marks on the ribbon cable to let you know where it attaches to on the board. 

Now poke the LEDs through the shelf. Cut the ribbon cable to the appropriate lengths and solder the ends onto the circuit board. This is a good time to test all the connections by powering the arduino circuit and having it run each light. If everything works, hot glue the LEDs into their holes and mount the arduino into the side of the shelf.

I simply took a jigsaw and cut out the back corner of the IKEA shelf to make room for the arduino. The ribbon cable is hot glued to the bottom of the shelf. If you want to get fancy you could run the wires inside the shelf. I knew my shelf would be mounted where these would be out of sight anyways so I didn't do it.

I really like this IKEA shelf because it is very easy to remove from its mounting bracket on the wall to allow for reprogramming. Its also easy to remove the Arduino from the unit however I don't like having to handle the sensitive circuit on top unnecessarily.  

Step 5: Program It

So far I've been pretty satisfied with the manual control mode for the light colors and intensity. I've actually only written one computer control program. 

The main program is included in the files below. It can run the manual control and rand_drink computer control. It reads the analog voltages from the potentiometer and adjusts the PWM color outputs proportionately. Pressing the button will switch the bank of lights that the POT knobs are controlling allowing you to make 2 colors. 

Upload this to the arduino in the usual way. Note that we didn't put anything on Pins 0 and 1 which are the serial communication pins. Programs can be uploaded without removing the Arduino from the shelf.

You can see that it will be quite easy to extend the Arduino program with new modes, light patterns and games. If you happen to build this project and end up taking the program further, please send me your code! There is a ton of room for creativity here.

The attached files make up the LED_Control_Full sketchbook. You can also just download the .rar. You can see the push button switches modes and if it is held for a count of 50 cycles it will initiate the rand_drink routine. There is another computer control function in there which ramps the lights on and off but I haven't quite finished it yet and it is not called by the main program.

Step 6: Load With Vodka, Enjoy

If you press and hold the push-button for a short amount of time something special happens! The lights begin blinking and will randomly land on a bottle of vodka or shot (which you then have to drink). This little program has turned out to be a huge hit at parties. 

Many common vodka bottles refract the light into beautiful patterns on the wall and light up nicely at night. As soon as I can get my hands on a good video camera I will add a movie of what this thing can do. Many cameras tend not to be able to capture the vivid colors produced by LED light.

Good luck on making your own version!
By the way, the original reason I wanted to post a comment... Great job! I was looking for something like this... but just one colour... I love those IKEA floating shelves.<br> My idea was a lot simpler... to construct a shelf that had momentary push button switches that when you put a bottle down, the LED beneath the bottle lit up. <br>This seems like a much more interesting project though. Arduino has always been a huge interest to me, maybe I will take the plunge. And drinking games are always a fun thing!
Interesting project, but the BJT symbols in the schematics are for PNP type, not NPN as they are supposed to be.<br>Also, each LED should have its own current limiting resister before connected in parallel. Without resister, they can have &quot;thermal runaway&quot; problem. Whichever the LED that draws more current (due to the variation in manufacturing) gets hotter, which makes it to conduct more current (by taking it from another LED next to it), making it even hotter, and so on. Having the resister for each LED will remedy this problem. (Even though with the resister values you have here should not cause catastrophic failure, correct design basics should be mentioned.)<br><br>A bit disappointing to know that there is not checking by Instructables about the validity of circuit. Because I see this site as an educational rather than entertainment.
I think to start checking the validity of each instructable would be a very difficult job for instructable employees... especially since there are many different categories.... Yes, theoretically somebody could check over these to make sure there is nothing missing in the circuit... Could you imagine a job where 8 hours a day you were paid to read over user submitted instructions, that do not have the same format? And employing pastry chefs, engineers, scientists, mechanics, etc... all in one place? And there are is more than just one way to solve a problem when it comes to life. How do you judge an instructable that tells you how to grow tomatoes? If you talk to 10 different gardeners, you will get 10 different answers. And then what? Have these moderators amend these errors and omissions, or send the instructable back and say they can't approve it?<br><br>I think if instructables were moderated, it would defeat the purpose of this community, and then nobody would submit them because it would be such an annoying and tedious process to be approved. I think that's why we can comment on instructables, which is why the warning below says positive (good job) and constructive (your symbol is wrong and you should have resistors in there)
Good catch, I updated the figures to correct this. <br><br>I agree that wiring LEDs in parallel is bad practice (par 4), but i don't see how adding a resistor in series with each LED will solve this problem unless their resistivity has a negative temperature dependence much greater than the positive rate of the LED. <br><br>Nice call out to instructables.
About the LEDs in parallel, this page has two good answers:<br><br>https://www.instructables.com/community/Parallel-Circuit-question/<br><br>I echo westfw and NachoMahma.<br><br>I know your circuit works just fine in most conditions. Even if one of the LEDs steals most of the current, it won't be more than around 35 mA-ish.<br>Problems will only arise when you start using higher current to drive LEDs.<br>You don't need negative temperature coefficient - just some resistance is enough to remedy thermal runaway. We are talking about the temperature inside LEDs anyway.
I'll have to do this one in my house, it will give me an excuse to buy Crystal Skull vodka like I see in this picture. I'm hoping that you actually drank all of this vodka and didn't waste it...? In all seriousness, this looks awesome!

About This Instructable




More by Waterfox51:Arduino Powered RGB LED Vodka Shelf Power LED underwater lights Foam Core Kiteboard 
Add instructable to: