So, you’ve just got your Arduino in the mail, and you’re sitting here wondering… what on earth do I do with this? The Arduino is a microcontroller that’s inexpensive and incredibly useful for a variety of electronically-oriented DIY projects. Building something yourself from an Arduino is incredibly satisfying – but it’s tough knowing where to start.
So today we’ll be making a cute Portal-themed mood lamp to help add some texture to your living space (and establish your 2007-era nerd cred). It’s a great starting point with few components and very little wiring.
Step 1: What You’ll Need
- 1 x Arduino and USB cable
- 1 x RGB LED
- 4 x 330 Ohm resistors
- 1 x small breadboard
- 4 x long jumper wires, preferably different colors
- 1 x square glass jar or bottle
- Hard-drying clear glue
- Gray and red modelling clay
- 1 x white candle
The electronic components (minus the Arduino itself) can be bought as a bundle with a number of other useful odds and ends for about $20.00 on Amazon, and will serve you well for a variety of Arduino projects.
The glass bottle was purchased at Walmart for $5.00 with two scented candles, so it’s probably possible to beat the Amazon price if you’re willing to shop around. Likewise, many of these items may just be lying around your home (or suitable replacements) – so be creative. Part of the fun of DIY is figuring out ways to efficiently use the things around you to create something more interesting.
Step 2: Frosting the Cube
Remove the wick and metal tab from your plain white candle, and melt all or part of it in a ceramic mug in the microwave for one to three minutes until it forms a clear fluid. Wear work gloves or oven mitts, and be careful – wax burns are nasty. Pour the wax into the jar or bottle, and swirl it gently around until the wax begins to cool. Tilt the bottle until there’s a layer of solid wax on every surface. This gives the glass a white texture from the outside, as well as a cool, uneven marbled texture that gives the illumination a nice aesthetic quality. Since we’re using an LED, the heat shouldn’t be at any risk of melting the wax. If the wax is too messy for you, white paint could be substituted for this purpose.
Step 3: Decorating the Cube
Now, use gray and red modelling clay to make the structures on the surface of the cube: all corners should be covered, as well as the middle third of the edges between them, and a circle in the center of each face, which should have red or pink hearts on them. Those of you who can sculpt will probably come up with something that looks a lot cleaner than my final product. Because the clay doesn’t set, you can keep futzing with it until you’re happy with your end result.
Step 4: Protecting the Decorations
In order to make the clay ornamentation hard, I don’t recommend baking it: the glass could explode from heat stresses in the oven – or, worse, build internal stresses that cause it to violently shatter and hurt someone at a later date. Instead, use a paintbrush to apply several layers of clear glue to the surface of the clay, which will give it a relatively hard shell, and prevent the clay from being disturbed or getting rubbed off on other objects.
Step 5: Wiring Up the LED
To start with, inspect the legs of your RGB LED. The longest leg is the negative prong (assuming you have a common cathode LED) – the other three are positive prongs, and each corresponds to a different color – red, green, and blue. Bend the negative prong out and sink it into the black (negative) row along the top of a breadboard. Bend the other three legs into three different columns in the middle of the board (it doesn’t matter precisely which ones, so long as no two share a column). Bend them such that the LED is flush against the board. Now you’ll want to insert resistors (330 Ohms), to attenuate the flow of current so you don’t accidentally burn out your LED.
Step 6: Wiring Up the Arduino
Now, connect long wires to the 10, 11, and 12 pins on the edge of your Arduino, and use the breadboard the link them to the resistors linked to the LEDS. Run the GND pin on the Arduino to the black row on the breadboard (anywhere will do).
If you want to, you can stack the breadboard and Arduino in a small box to hide them (or get a soldering iron and dispose of the breadboard altogether), but I kind of like the aesthetic of exposed wires and circuit boards. Either way, at this point, everything’s connected. All we need is software.
Step 7: Colour Swirl Code
The program I wrote to drive the lamp can be viewed on PasteBin here. The program is very simple – it simply lets the computer know which pins we’ll be using, how bright we want the lamp to be, assigns the relevant pins to output, and then runs a loop that uses a little bit of trigonometry to smoothly vary the colors of the lamp (see the comments for more details). All you have to do is paste the code into a blank ‘sketch’ in the Arduino software and hit the ‘upload’ button).
Step 8: Putting it All Together
Upload the code to your Arduino and verify that the LED is shifting colors correctly. Now, all you have to do is put on the lamp shade. Because my bottle had a neck, I used a small ring of modelling clay to provide a stable base for the shade. The result should look something like this.
Step 9:Expanding the Project
The code is rather simplistic as it stands, and there’s plenty of room for improvement for those of you who want to hack around with it. Some possible expansion projects include
- Smoothly shifting from each random color without repeating
- Flash red when a signal from your PC (for example, when you get an email alert)
- Vary the brightness in time to music (you’ll want to read up on Fast Fourier Transforms)
- Allowing it to be remotely controlled over the internet.
All of these can be accomplished entirely software side without the need to buy additional hardware or components.
Congratulations! You’ve completed your first Arduino project! Just think of what you can do next…