Introduction: A Multicolor LED Lamp
This project, my first one documented here at Instructables, will allow to create a fancy programmable Multicolor LED Lamp, using a 3D printed case, some plexiglass bars, a microcontroller based circuit and a ring of leds.
I came up with the idea to create this lamp after having bought a few components from Adafruit last time I visited US. I always buy something there and when I'm back home, in Italy, I have to figure out how to put together what I bought into something meaningful.
I have always been very attracted by the RGB leds and wanted to use them in one of my projects. I also wanted to experiment a bit with 3D printing, therefore I decided to build a lamp from scratch using some of the electronics I bought and the RGB leds, putting everything in a case specifically printed for the purpose.
I wanted to give the lamp a nice and essential look, but I also wanted to leverage the effects that I would have been able to create with the RGB leds. Therefore I decided that I would have used some plexiglass bars to diffuse the light from the leds. I think the final effect is quite nice, but it's not to me to judge, so let me know what do you think.
Here is what will be needed to replicate my project:
- The 3D printed case of the lamp mad of three parts (see next step)
- 24 plexiglass sticks (6 mm diameter, 20 cm lenght - I bought them at Plexishop.it)
- One Adafruit Gemma
- One Neopixel 24 Ring
- One 10kΩ Resistor
- One 330Ω Resistor
- One Electrolytic Capacitor capacitance 1000 uF
- One 13mm Square Pushbutton default state Normally Open; switching circuit SPST
- A couple of small screws
- One nut and its bolt (diam 3 mm, long 25 mm)
- 4 small plastic feet
In the steps that will follow, I'll go over the 3D model and how I managed to have it printed, the electronic circuit that drives the lamp, the Arduino code to drive it and how to put everything together.
Step 1: The 3D Model and How to Print It
As I said before, I was interested to start playing with 3D printing, but I did not want to spend the money to buy a printer just to make a few models. It came to rescue 3D Hubs. In there you can find someone close to you that has a 3D printer and will be glad to print your model for a reasonable price.
Right, you need a 3D model to begin with, so I created one using Blender. That program is phenomenal to be completely free software. At the bottom of this step you can find the Blender 3D model that I came up with (NP_final.blend). As you can see, it is composed by three parts:
- the top part houses the Neopixel ring and couples it with the plexiglass bars
- the middle part houses the wiring of the electronic circuit and the square button
- the bottom part houses the Gemma microcontroller and closes the lamp
To be able to print this model with a 3D printer, you need a STL (STereo Lithography interface format) file for each part of the lamp. You can export in this format using Blender. The ones I used are at the bottom of this step (NP Models.zip)
As I said at the beginning, I leveraged 3D Hubs to print my model. The first hub I used did a very bad job. The printing was really awfully made. The dimensions were not respected and some of the holes were not even more there. They tried to print it again for me after I complained, but the result was not any better. So my suggestion is for you to be very careful when choosing a hub, because some may have really little experience with 3D printing. Make sure they understand the three pieces needs to be printed precisely so that they can then be assembled.
My second attempt to print the model was successful. Mr. Meloni at ShareMind did a great job. He improved the smoothness of the surfaces (generating a minor glitch I've not noticed till I assembled the lamp) and printed the model with his Zortrax with great precision. In case you are in Rome, I strongly suggest you to go to him for a work well done.
ADDEDUM: A lot of people have made the comment that this lamp should have a top. I created a very simple one and I included its STL file in the NP_Models.zip, so that who wants, can use it. I purposely left the top of the plexiglass bars open because they illuminate the roof of the room with cool colors when the lamp is on.
>> Look at the comment I made and you will see the added top printed and at work.
Step 2: The Electronic Circuit
Now that the case is done, it's time to come up with an electronic circuit that will drive the LEDs. As you can see, the one I came up with is pretty straightforward. The center of it is the Arduino compatible Adafruit Gemma. I used only two digital lines of the three it has. One drives the Neopixel ring, the other is connected to the button. I wanted a button in the project so that I could have switched from one lighting scheme to another one. In fact, as you will see later on, when pressing the button, the lamp will move to the next color carousel. I'm sure you can find other ways to use the button, in case you decide to change the program that runs on Gemma.
In the circuit I also added a resistor in series to the line that drives the ring and a electrolytic capacitor between the power lines, as indicated by Adafruit not to burn the LEDs. You will notice from the pictures that I used a 35V 1000uF capacitor. The voltage of it is way to high, but that's what I had in my storage and I was too lazy to get a smaller one.
In one of the pictures it can be seen how I assembled the circuit. I decided to use pins to connect the different parts so that the whole thing can be assembled and disassembled at will. In the last picture, you can see where to solder the pins on the Neopixel ring. Be careful to use those connections and not the others available on the ring, because otherwise the pins will not align with the case.
Step 3: The Software
Before assembling the lamp, you may want to test that everything is actually working. To do so you can use the software that I created to drive the lamp. It is a mix of what you can get from the Adafuit site for testing the Neopixel ring, with a few modifications to add more lighting schemes and the button functionality. The button allows to move from one lighting scheme to the next, restarting from the first one after the last one.
The lighting schemes that are part of the program attached to this step are the following:
- rainbow: uses a changing portion of the colors of the rainbow to light the plexiglass bars
- rainbowCycle: uses all the colors of the rainbow to rotate the lights of the plexiglass bars
- theaterChaseRainbow:uses a changing color of the rainbow to alternatively light the even and odd plexiglass bars
- movingColor:uses a changing color of the rainbow to light one after another plexiglass bar to create a rotational effect
- bouncingColor: lights up two symmetrically positioned plexiglass bars using a changing color of the rainbow
- fadingColor: uses a changing color of the rainbow to slowly light up and then dim all the plexiglass bars
- psycho: uses a quickly changing color of the rainbow to light all the plexiglass bars
- white: lights up all the plexiglass bars with white light
- black: turns off all the plexiglass bars
To understand how to put the program in the Gemma microcontroller, I suggest you read the Gemma introductory Adafruit article. Keep in mind that, even when the case will be closed, the USB connector will remain accessible both to power the lamp and to reprogram the Gemma microcontroller. Therefore, if you get bored about the lighting schemes you have, you can change them at will.
Once you have loaded the program, connected the Neopixel ring and made sure everything is working, it's time to assemble the lamp.
Step 4: Building the Lamp
The first step will be to insert the plexiglass bars in the upper case. You should use one of those hammers with a soft gummy head, not to ruin the bars.
When you have finished to insert all the bars, put the Neopixel ring on the middle part of the lamp, being careful to make the pin align and enter into the holes.
Then assemble the top and middle part of the lamp. Make sure the two parts couple well together. There are two small pins in the top part that needs to go in the corresponding small holes of the middle part, so that the two don't rotate. Block the two parts using the nut and bolt.
Put the Gemma in its housing at the bottom part of the lamp and then connect the wires to the Neopixel ring pins.
Close the bottom of the lamo with the two small screws and add 4 plastic feet.
The lamp is ready to be tested. Either connect it to a computer (but in that case it will take a few seconds to start its carousel) or to a USB charger.
Step 5: Enjoy and Impress Your Friends
The last most important step is for you to enjoy the lamp, like I do. I added here a short video for you to see the final effect in case you want to see what it is before building one.