So you just got your Arduino in the mail and you’re sitting here wondering… what should I do with this? The Arduino is an inexpensive and incredibly useful microcontroller. for various electronic DIY projects. Building something yourself from an Arduino is incredibly rewarding, but it’s hard to know where to start.

So today we’ll create a cute portal-themed mood lamp to help add texture to your living space (and create your 2007-era nerd title). This is a great starting point with few components and very little wiring.

Step 1: What You Need

How to make a companion cube mood lamp (for absolute Arduino beginners) diy cube companion components

  • 1 x Arduino and USB cable
  • 1 x RGB LED
  • 4 x 330 ohm resistors
  • 1 x small breadboard
  • 4 long jumpers, preferably in different colors
  • 1 x square glass jar or bottle
  • Solid glue
  • Gray and red modeling clay
  • 1 x white candle

Electronic components (with the exception of the Arduino itself) can be bought as a package with a number of other good odds for about $20.00 on Amazon and will serve you well for various Arduino projects.

The glass bottle was purchased at Walmart for $5.00 with two scented candles, so you can probably beat Amazon’s price if you want to shop around. Similarly, many of these items may just be lying around your house (or a suitable replacement) — so be creative. Part of the fun of DIY is finding ways to effectively use the things around you to create something more interesting.

Step 2: Freeze the Cube

How to build a Companion Cube Mood Lamp (For Arduino absolute beginners) diy Companion Cube melted wax coating

Remove the wick and metal tongue from a plain white candle and melt it all or part of it in a ceramic mug in the microwave for one to three minutes until a clear liquid forms. Wear work gloves or mittens and be careful Wax burns are disgusting. Pour the wax into a jar or bottle and stir gently until the wax begins to cool. Tilt the bottle until a layer of hard wax appears on each surface. This gives the glass a white texture on the outside, as well as a cool, uneven marbled texture that gives the lighting a pleasing aesthetic quality. Since we’re using an LED, the heat shouldn’t be at risk of melting the wax. If the wax is too dirty for you, white paint can be substituted for this purpose.

Step 3: Decorating the Cube

How to Build a Companion Cube Mood Lamp (For Absolute Arduino Beginners)

Now use gray and red plasticine clay to create 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 know how to sculpt will surely come up with something that looks much cleaner than my final product. Because clay doesn’t set, you can keep fiddling with it until you’re happy with your end result.

Step 4: Protecting the Jewelry

How to make a mood lamp for a companion cube (for Arduino beginners) diy companion cube protector

In order to harden clay decorations, I don’t recommend baking them: the glass can explode from the heat stresses in the oven, or worse, create internal stresses that cause it to break badly and hit someone more later. Instead, use a brush to apply several coats of clear glue to the surface of the clay, which will give it a relatively hard shell and prevent the clay from disturbing or chafing other objects.

Step 5: Connecting the LED

How to Build Companion Cube Mood Lamp (For Arduino Absolute Beginners) DIY Companion Cube RGB LED Wiring

First, inspect the legs of your RGB LED. The longest leg is the negative pin (assuming you have a common cathode LED) — the other three are the positive pins and each corresponds to a different color — red green and blue. Bend the negative prong and sink it into the black (negative) row along the breadboard. Bend the other three legs into three different columns in the middle of the board (doesn’t matter which ones, as long as two don’t share a column). Bend them so that the LED is flush with the board. Now you need to put in resistors (330 ohms) to dampen the flow of current so you don’t accidentally burn out.

Step 6: Connecting the Arduino

How to Build a Companion Cube Mood Lamp (For Absolute Arduino Beginners)

Now connect the long wires to the 10, 11 and 12 pins on the edge of your Arduino and use the breadboard to connect them to the resistors associated with the LEDs. Run the GND pin on the Arduino to the black row on the breadboard (anywhere).

If you want, you can put the breadboard and Arduino in a small box to hide them (or get a soldering iron and completely recycle the breadboard), but I love the aesthetic of the exposed wires and boards. In any case, everything is connected at the moment. All we need is software.

Step 7: Colored Swirl Code

How to Assemble a Companion Cube Mood Lamp (Arduino Beginner) Color Swirl

The program I wrote to control the lamp can be viewed on PasteBin here. The program is very simple: it just lets the computer know which pins we’ll be using, how bright we want the lamp to be, assign the appropriate pins to the pin, and then runs a loop that uses a bit of trigonometry to smoothly change the colors of the lamp (see comments for more details). All you have to do is paste the code into an empty «sketch» in the Arduino software and click the «Upload» button.

Step 8: Putting It All Together

How to Create a Companion Cube Mood Lamp (For Arduino Absolute Beginners)

Upload the code to the Arduino and make sure the LED changes color correctly. Now all you have to do is put on the lampshade. Because my bottle had a neck, I used a small modeling clay ring to provide a stable base for the shadow. The result should look something like this.

Step 9: Extending the Project

The code is quite simplified and there is a lot of room for improvement for those of you who want to crack it. Some possible expansion projects include

All of this can be done entirely in software without the need to purchase additional hardware or components.

Congratulations! You have completed your first Arduino project! Just think what you can do next…

Похожие записи