April 30, 2013

Minecraft Ore-Block night-light


You can buy a minecraft ore-block night-light... but it's more fun to make your own, and this one is not just redstone. It cycles through the colors of redstone, emerald, lapis lazuli, iron, gold, and diamond. It also pulses slowly; just a subtle fading in and out. My son and my nephew both had birthdays this month; although they're past the age of needing nightlights they're both minecraft nuts so I decided to make these for them.

Let's start with the light. For the light source, I used a 10mm RGB LED from Adafruit. This common-anode RGB LED provides a nice bright color-space, and the diffused package mixes the light well. I first wrote a quick Arduino program to read three potentiometers and adjust the red, green, and blue levels according to those pots. The program would then send the actual RGB values back to the computer via the serial line. This allowed me to experiment with different light mixes in an effort to find the best RGB combination for each color. I could tweak each knob, see the results immediately, and when I found a combination I liked I could check the serial line to see what it was.

Here's the program, and here's what the test-rig looked like:


I eventually decided on these tuples for each type of ore:
Redstone (255,0,0)
Emerald (0,255,0)
Lapis Lazuli (0,0,255) --- those three are easy!
Iron (16,4,0) --- closest I could get to "brown" with the RGB!
Gold (255,115,0) --- maybe a bit less green?
Diamond (0,255,100) --- could've gone more blue, but this works.

These colors are hard-coded into the program, which was downloaded onto the microprocessor before soldering the microprocessor into the board. Here's the program.

Next, the electronics: I chose to use an ATtiny84 microprocessor to drive the light. The ATtiny84 has much more memory than necessary for this purpose, but I needed three separate PWM outputs to do the color mixing (so the ATtiny45 was out) and I didn't have any ATtiny44's handy. The board layout was fairly simple: I used EAGLE CAD, and here's the design:


The EAGLE files are available here. I created the board using toner-transfer and FeCl etching.


Next, it was time to make the physical ore-block. I used 1/4" clear acrylic, cut on my table saw. The sides are each 3" high by 2 7/8" wide, and the top is 2 3/4 x2 3/4. I then used a router table to cut a 1/8x1/8" shoulder-groove around each piece.
The side pieces then fit together, each overlapping the next. The top fit perfectly inside the recessed square formed by the sides. The bottom was left open for the moment, but if you're following along on visualizing how this goes together, you'll realize that there is a 2 3/4x2 3/4" recessed square hole there, too --- just the right size for the circuitboard.

Before gluing the pieces together, I sandblasted them ---both sides--- to make them better diffusers.
I then solvent-welded them together using methylene chloride. Plastic model glue would have worked nearly as well, but I work in a building with chemistry labs and fume hoods and solvent-welding acrylic works REALLY well. When finished, I had a nice translucent 3" cube of frosted acrylic, open on the bottom. I also drilled three holes near the bottom of one side of the block; holes that would later accommodate the buttons and power cord.

The outside pattern is key to making this a Minecraft block, of course! I created a single 3x3" side using a vector graphics program, then put five sides together so I could wrap them around the cube. The largest-format laser printer I have available will only print letter-sized paper, so I had to break the wrap into two pieces, like this:
The top piece wraps around three sides of the block, and the bottom folds over the top and fourth side. The extra on the sides wrap around to prevent light leakage around the edges. Here's a link to a .pdf of that design, should you want to make your own block.

To make the "stone" parts of the lamp light-proof I used 3M spray adhesive ("Super 77") to glue a print of this pattern onto a smooth piece of aluminum foil. Next, I carefully cut the pattern out using a sharp new X-Acto blade and a metal straightedge.
I then carefully creased this aluminum-foil/paper label on all fold lines, using the metal straightedge again. I sprayed the aluminum side with adhesive once more, and wrapped the label around the block.
The final assembly step was to provide a power source (salvaged 5V phone charger) and solder the power cord and buttons. I found two buttons that were nearly identical; one was momentary and the other latched. The latched button is used for power, the momentary button cycles through ore-type. The circuitboard fit (with a small amount of sanding) into the recess on the bottom of the cube: I glued it into place with RTV and added four stick-on rubber feet.


It works great, the boys think they are cool, and it's on to the next project: writing a final exam for my electronics course!

No comments:

Post a Comment