Introduction: DIY Simple Arduino Lamp
In this project, I will be walking you through the process of creating a lamp with the Arduino nano and an LED strip. Before starting it's important to know that there is a lot of flexibility as to what features you want in your lamp and what features you don't (I will explain the different options you can make than differ from my own further into the tutorial).
Safety considerations - This tutorial involves using a soldering iron. Please ensure you are following proper safety precautions (e.g safety glasses, proper ventilation, organized work environment).
- Arduino Nano
- 1 xRocker Switch
- Jumper wires
- Breadboard (optional)
- Perfboard (it should be able to fit inside the inner case of the lamp (the toilet rolls)
- A WS2812B Led Strip around two meters long (106 LEDs) (others can be used but the code will have to be adjusted for them).
- A USB to Mini-B USB cord (it has to be long enough to circumvent the tennis ball tube and extra in order to reach a power source.
- 1 x 10k resistor
I know it can be hard to find the right body for your project which is why I made the body of my lamp out of everyday use materials
- 1 x Tennis ball can (the plastic on the outside should be removable)
- 2 x Cardboard toilet paper rolls
- 1 x Baking sheet
- Plastic wrap (optional)
- Soldering iron
- Glue (or tape)
Step 1: Info on the Lamp
Before we start building the lamp I'll be describing its capabilities and limits. First off, the led strip is a 5 volt RGB led strip. The rocker switch allows the user to switch between two different color schemes. As seen in the video I had a rainbow color scheme as one, and an ocean color scheme as the other. The lamp is powered by USB, at first I was using a separate battery but I quickly realized how hard it would be to change the battery and update the code if I constantly had to open the lamp. Obviously, since I'm using a tennis ball tube and baking paper, the quality of the body will not be perfect but I think as a DIY project it is definitely a great gift. The last note is that there is an option to write you're own message on the lamp as seen on mine. With that being said we will proceed to the 1st step.
Step 2: Testing the Circuit
We're first going to test the circuit to ensure it works before soldering it. (This is step is not necessary though I do recommend being sure of the circuit before soldering.) The parts needed for this are
• Jumper wires
• Arduino nano
• Led strip
• Rocker switch
• Soldering iron
The first step will be soldering three wires to the 5v, Data, and ground points on the LED Strip. Your LED strip may have already come with a cord at the front in which case I recommend cutting off the first LED. This should look somewhat like the image above.
The next step will be soldering 2 jumper wires to two of the three pins of the switch. Any of two pins are alright as long as one of them is the middle pin.
Once you've completed this part we can begin attaching components to the breadboard. First, attach the Arduino nano and then connect the 5v and ground pin two the corresponding rails on the breadboard. Next, connect the 5v and ground wires of the led strip to the corresponding two rails. Connect the data wire of the led strip to pin 8 on the Arduino. After this plug the two wires of the switch next to each other on the breadboard. Now connect the 10k resistor to one of the switch wires (next to it on the breadboard). The other side of the 10k resistor should be on the ground rail. Now connect a jumper wire to this same wire of the switch that goes to pin 6 of the nano. Finally, connect a jumper wire to the other wire of the switch that connects to the 5-volt rail. If you are having trouble following along please refer to the diagram above.
Now the next step is to upload the code to the Arduino. The first part of this process is installing the FastLED Library. Open your Arduino software, open the sketch tap, go to include a library, select manage libraries. Once you've reached this point search Fast LED in the search bar and scroll down till you find the library Fast LED by Daniel Garcia. (refer to the picture above). Install it and then you can proceed to upload the code.
This involves copy-pasting the entire code provided here into an Arduino sketch. If you look at the image above, the only change you have to make is the number of LEDs you will be using. I circled the type of LED in case an LED Strip different to my own is being used in which case the type will have to be updated.
Step 3: Preparing the Body
Materials and Tools needed
- Tennis ball bottle
- Two toilet paper rolls
- Superglue (or anything that can keep the toilet rolls together.)
- soldering iron
- metal pin (piece)
This part is fairly simple but important. Two holes need to be made in the bottle where the switches will go. In my case, I made a hole at what would be the top of my lamp (the bottom of the bottle) for the rocker switch. I made a second hole on the side of the bottle close to the bottom for the USB cable. See the images above to get a better sense.
I didn't have a drill to make the holes so I chose to melt the plastic. It is important that you have proper ventilation while doing this (I recommend opening any windows and doors while turning the fan on. Burning plastic can have negative effects on health if exposed to the fumes for too long and I recommend taking some time to research proper preparation for doing this.
In order to melt the plastic, I used my solder to heat up a pin that I held with pliers. Through conduction that pin was able to create the hole needed in the plastic. You may be wondering why I'm not just using the soldering iron to melt the plastic. I just don't want to get melted plastic on my iron or risk damaging it. If you want you can use yours. Just remember to do proper research and avoid inhaling the fumes.
Make sure the hole on top of the can fits the switch when inserted in. If the hole is too big it will just fall through the hole in which case you can maybe use tape or hot glue to fix it.
Next, make a rectangular hole towards what will be the bottom of the lamp. It should easily fit the USB cable through it.
I'm not going to use the baking sheet yet because I want to be able to see through the can right now while installing the circuit.
Now the last part is the easiest. All you have to do is glue the two toilet paper rolls together as seen in the picture. Just make sure you don't get any superglue on your hands!
Step 4: Soldering the Final Circuit
Once you've confirmed the circuit is working you can move it onto the perf board (technically you could still use the breadboard if it fits into the toilet roll. The only problem is the wires aren't soldered meaning there is a higher chance the connections will come loose. As I said before make sure the board fits into the toilet rolls. If it doesn't you can try and find another bigger suitable replacement for the toilet paper rolls.
If you haven't used a perf board before you should first do some quick research on how it works. Connecting the Led strip is basically the same as the breadboard, the only difference is you are soldering it now. The only pin on the Arduino that should have more than one connection is the 5 volt. There are two ground pins which mean you can solder the ground from the switch and led strip to either one or both. You may have noticed that the resistor is soldered from the ground to pin 6. This effectively does the exact same as soldering pin 6 and the resistor to one pin on the switch.
I recommend soldering the Led Strip first to the perf board first. Now one thing I realized after I did all my soldering was how much the length of the jumper wires mattered. In the end, the lengths depend on where you intend to put your Arduino nano board. If you put it towards the bottom of the toilet rolls then it maximizes the length of the USB cable while also allowing you to use shorter jumper wires for the LED strip. The only downside is the distance to the button. My recommendation is that for the button you use wires twice the distance from the perf board to the button because if you ever want to take the circuit out of the body without desoldering the button shorter wires would prove troublesome.
If you look at the image of inside the toilet paper roll you will see a lot of yellow wire. This is because at first, I intended to put the nano at the top but then changed it to the bottom. All that wire is what connects the led strip to the perf board.
My last tip on soldering is to make sure the wire from the button comes through the bottle when soldering to the perf board or button. As seen in the last image the button has to be in place while soldering to the perf board.
Now once you've finished you'll want to confirm the circuit still works before installing the circuit in the body.
Step 5: Installing the Circuit Into the Body and Final Touches
Once you've confirmed the circuit works you can put the perf board with the nano into the toilet rolls. I previously explained the advantages and disadvantages of putting it at the top and bottom.
The first step is going to be running the LED Strip out of the bottom of your toilet rolls and then wrapping it around the outside from bottom to top. Most LED Strips come with a sticky side one you peel off the plastic. For this step, I recommend evenly spacing the LED Strip. As seen in my picture mine wasn't perfect but there wasn't much of a difference at the end.
At this point, you should have the USB cable and the Led Strip running out of the bottom of the tube with the button wires coming out the top. I don't recommend putting the USB through its hole yet because the next step is wrapping the outside of the tennis ball can in the baking sheet (any sheet that allows the light to pass through will work). If the button isn't staying down in it's intended to position you can super-glue it. One final note is to make sure none of the wires are outside the toilet paper rolls because then they will create shadows with the LEDs.
Before we do this you may have noticed I put a little message on my lamp. This was done by cutting out the characters from a malleable thin piece of cardboard that didn't allow the light to pass through. I then super glued these characters to the outside of the can before wrapping it.
Now, the next step is extremely important because any folds/creases in the baking sheet at the end will show with the light. I recommend using any plastic friendly adhesive (make sure it's not quick drying).
Now once the glue has dried you're going to want to cut a small hole with a sharp knife or something similar for the USB hole. The last step is to run the USB cable out of the can and push the toilet paper roll up inside. Then seal off the bottle with the cap.
One final optional step is wrapping the entire thing in a plastic wrap to make sure the baking sheet doesn't get damaged. Above I have attached a short video of my lamp at the end. Please leave a comment if you have any questions or problems regarding this project.
Participated in the
Colors of the Rainbow Contest