Intro: How to Make a Lamp With Programmable Routines
I have been using the same lotion for a while now. One day I saw the bottle and I thought: -Mhmm... This would be an awesome lamp for my desk. And the Idea was born.
As a nice decor or just for fun, this Instructable is about how to make a lamp with an empy bottle, leds, and an arduino with different routines and the best of all, relative cheap.
The good new is that it's easy to build. The not so good one, it's that you will need some electronic materials and basic knowledge. But don't worry. I will try to explain everything as easy as I can.
Step 1: Materials
First of all, we need an empy bottle. I used the lotion and the box to be the base. If you don't have the box, don't worry, you can use any box that you want.
The brain of course. I will use an Arduino MEGA, mostly because is the one that I have. You can use any version but it's important to check out the pins of the timers, I wll specify that later.
The light part and the electronics, including the power for everything.
-6 leds of the color you choose (I will use the 1.5v)
-6 resistors of 330Ω
-1 resistor of 1kΩ
-A lot of cables for protoboard
-A line of male pins (9)
-(Optional) DuPont type male-female cables.
-Power source for the Arduino
-Soldering pen, soldering paste and solder
-Knive or a cutter
-Multimeter or something to check the leds
Step 2: Some (other) Useful Things
There are some other things that are not part of the proyect but will help you:
-pencil (not pen)
Step 3: Let's Begin.
This is the process in a nutshell:
First we need to place the bottle on the box, then we need to make some cuts to the box where we want the leds. After that we will arrange the leds in a base, you can use the second cardboard of the lotion box or make one yourself, your choise. The conexions of the leds is the next step. Once finished place and cut the pins for the connetions. Programming the Arduino and testing the code is the last step before the finished product.
Note: in this process I had a situation. I only had 7 pins and 2 more separately. Instead of buying more I tought it would be a good idea to use them and show you ONE solution for this kind of problems. Of course the best thing is to have 9 pins united, but you can use and re-use a lot of material adn in this case I did it.
Step 4: Removing the Mechanism
The first thing I did was to remove the mechanism of the spray. It looks awful with the empy bottle.
The top can be easily removed but the mechanism was tightly fixed to the glass. The good new is that the material is deformable. So, I peeled like in the photos with my tongs.
After that I just cut the mechanism with my cutting tongs and take out everything.
Step 5: Choose the Place of the Bottle
Now, before cutting anything, you should place the bottle on the box and decide where do you like it. After that mark it with a pencil.
Draw another circle inside the first one, this is the circle where we are going to cut the hole for the leds. My suggestion is to make an offset of the same dimension of the "big" section of the base of the bottle. I used a compass to make it easier.
Note: If you make the cut too small, the leds will be at the center and the light will luminate just the center. But if you cut too much, there is the possibility that the bottle will fall.
Step 6: Cutting the Box
Now that you are sure the final place of the bottle, teke out the sencond cardboard if the box have one. Then, use your favorite cutter to make the hole. It is not necessary to be perfect, mostly because it will be covered by the bottle BUT beware with your fingers.
Step 7: Preparing the Base for the Leds
I used the same cardboard inside the box to make the base for the leds.
As you can see it is unfolded to make it easier to handle. I did a fold at 1 cm to make a "table" to put the leds on. To make the fold I used my finger nail, so the cardboard remains uncutted. You can use the "un-sharped" side from a knive to do this.
In the 4th photo is the same process but in the front wall to make a base for the base. As you can see the base for the leds is the same heigh of the leds.
Step 8: Arrange the Leds
Now put the whole base inside the box and mark where do you want the leds. I used a pencil to be ereasable.
After that, present the leds in their place and with a needle make the hole for the pins. Then put the leds in BUT check the polarity of the leds. To check this, I don't recomend to view at the pins. Better look at the led itself. In the 4th photo is written that the "big flag" is the negative pin. BUT to be sure use a multimeter in diode mode and check it. It should turn on but I had the experience that the pins are inverted. Why? NO IDEA. But it happens.
Place the negative pin to the center, this to weld it easier. but before anything else. Plathe the base and the leds inside the box and check out how it looks. If everything is OK. Proceed with the next step.
Step 9: First Connections
The schematic was made in Fritzing for a better understanding for the people that are not familiarized with the electronic shcematic.
As you can see is not very hard. Just concentrate and everything will be ok.
Returning to the real world...
Now weld the negative pins so you have just one negative terminal and add a free wire to weld it to the pins later.
But a goos idea is to paste the pins to the base, not too much glue, just the necessary to keep the leds in place.
Step 10: Welding the Resistors
The free pin is the positive terminal, now weld a 330 ohm resistor to it. This is to limit the current in the led and avoid reducing the life spawn of the led.
Step 11: Weld the Termial
For the terminal use the male pins and weld cables to it. As I wrote at the beggining here are just 7 pins, 6 for the leds and 1 for the negative terminal.
I suggest you to put some solder on the pins asn just heated with the cable. Then use the termofit to isolate the cables. If you don't know how to use it, here is a quick guide. Cut it, put it, heat it (just place the lighter near, like 1 inch from the termofit), and try to heat all the material. Easy, isn't?
Now weld the cables to the resistors one by one. and try to use an order. It can be the one that I propose or another one. But it is highly recommended to avoid problems with the names and positions.
Once finished, gently blend it towads the rear side.
Now mark with a pencil the place to make a cut out for the pins.
Step 12: The Button
The button should be like the one in the photo. 4 pins divided in 2. If you pay attention there are two faces without pins, these are lateral faces, the other two have the pins. Mark them as front and rear, there is no difference between them both but it is useful for the connections.
Place the button where do you want. now press it gently just to know where to make the holes for the pins. After use again the needle. From the other side place the button. The front face from the button should be facing up, and the pinless faces to the right and left.
Now weld an extra cable to be the negative terminal of the button.
With the 9 consecutives pins, you should weld the positive and the signal pins to them, if not do the next step.
With one of the extra pins, weld a cable to be the positive terminal and another one to be the signal.
After that paste it with the glue gun. The trick is to use the DuPost cables or a female pin to keep the pins in place and paste them.
Step 13: Cut the Box for the Pins and the Button
Now measure the place where the pins should be placed, you can do this with 2 measurements. From the botton to the top and from one side. Just be sure to substract the thickness of the outer box.
Now cut it.
Step 14: Closing the Base of the Leds and Positioning
Now a critical step. Close the base of the leds and gently sneak it inside the outer box. If needed, press a little bit the outer box and try no to push back the terminal. The final result should look like this.
Step 15: The Connections for the Arduino
Now use your favorite kind of cables to connect the Arduino with the terminal, not puch too much teminal. If needed, press the terminal from the inside part to make sure the connection is correct.
Step 16: The Program
I will suppose that everyone have basic knowledge of Arduino, so I will just explain the programm in a general way. Any question you are free to write in the comments or send a message.
The programm that i give you have the next process:
The main programm have a selection of different cases, these cases involve the routines for the leds. Each routine is a subroutine in the programm and everytime that the button is pressed, it uses an interruption of the microcontroller (this is from the microcontroller so it's faster than coding). This calls another routine to count how many times the button has been pressed and returns the value which is the number of the desired routine.
If you use another Arduino, please check the official site of Arduino and see which pin you should use for the timers and interruptions.
The PWM routines are two. The first one uses a cos function to generate a signal, and the values are written for the leds. The second is with a for.
There is just one detail. For the rountine with the for it have a curious behaviour. When you press the button, it blick and continue with the routine. The chage of routine is at the end of the loop. The rest have no problems.
Step 17: Testing and Final Result
After programming the Arduino test it.
If everything is in order IT'S DONE!
ENJOY YOUR NEW AND SHINY LAMP