Pinterest Stumbleupon Whatsapp
Ads by Google

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 What is Arduino: Everything You Need to Know (In Video) What is Arduino: Everything You Need to Know (In Video) What is an Arduino and why should you care? In this video, I attempt to answer that question, and more. Read More 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

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

Ads by Google

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

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…

  1. Javier Duenas
    November 23, 2016 at 3:14 pm

    whats the tolerance and color code on the resistors used?

  2. Javier Duenas
    November 23, 2016 at 3:10 pm

    what is the color code and tolerance of the resistors. would be greatly appreciated doing it for class project.

  3. Random Iby
    January 28, 2016 at 6:40 pm

    Question: How can I get it to generate random colors for each loop? (I'm a bit of a newbie at coding)

  4. Rebecca
    May 7, 2015 at 9:04 pm

    Hi Andre! We are looking at building this fun project! How do you recommend powering the project post-build? We think we can use a Polymer Lithium Ion Battery - 110mAh, like we do with LilyPad Arduino, but wanted to check in with you and see what you recommend. Thanks!

  5. Monica
    October 8, 2014 at 9:22 pm

    I am using a Arduino UNO and trying to make the code come out right... so far I have come up with the following, which gives me an error message ...
    brightness was not declared in this scope...
    My LED has four wires, so I made four colors...
    Any chance you could guide me in the right direction?

    int red = 8;
    int yellow = 9;
    int green = 10;
    int white = 11;

    void setup() {
    // initialize the digital pin as an output.
    pinMode(red, OUTPUT);
    pinMode(yellow, OUTPUT);
    pinMode(green, OUTPUT);
    pinMode(white, OUTPUT);
    }

    void loop() {
    for (float x=0;PI; x = x + 0.000004){
    red = brightness * abs(sin(x*(180/PI)));
    yellow = brightness * abs(sin((x+PI/3)*(180/PI)));
    green = brightness * abs(sin((x+(2*PI)/3*(180/PI)));
    white = brightness * abs(sin((x+(3*PI)/3*(180/PI)));

    digitalWrite(led0, red);
    digitalWrite(led1, yellow);
    digitalWrite(led2, green);
    digitalWrite(led3, white);

    }

    }

    • Andre Infante
      October 14, 2014 at 6:57 am

      You have to assign a brightness variable at the top! Try

      brightness = 200;

      Just below where you input the colors for your LED.

    • Monica
      October 14, 2014 at 11:58 am

      Got it! Thanks. I loved the project. My daughter really liked the idea too.

Leave a Reply

Your email address will not be published. Required fields are marked *