DIY Minecraft Torch Lamp With Arduino Nano


Introduction: DIY Minecraft Torch Lamp With Arduino Nano

About: Arduino and Robotics Nerd, and alumni of FIRST Robotics Team 5683 (Go R.A.V.E.!). Blinking LEDs with Arduino is still one of my favorite pastimes even after years of doing it.

So I know torches are nothing new in the world of Minecraft enthusiasts, but I noticed a few important factors that most seem to overlook.

In the game, Torches will flicker and/or spark, but maintain a fairly constant output of light. None of the DIY torches I have seen really do this. Also, most of them seem to require printing out a template, which I think is kinda lame, and using a 'flickering candle' from the dollar store. I don't have a dollar store nearby, and I also noticed that the fake candles have an extremely low light output (only 1 LED!!) and consequently make the torch disappointingly dim. They also don't have a convenient off switch.

Since I was recently playing around with creating a realistic 'fake candle' animation on Arduino using LEDs, I thought this would be a great way to share my idea: make it into a well-know object that anyone can enjoy, while addressing some of the problems outlined above.

Ready your inventory and prepare your crafting table, this one's gonna be good.

Step 1: Gathering Materials

Unless you happen to be in Creative Mode, all projects require items to make. And since this map happens to be locked in Survival mode, you are going to have to go mining for supplies.

You will need the following items:

Arduino Nano (any other Arduino board -*ahem*- "command block" will work, but this one fits best)

9V battery and connector


4-7 Yellow or Orange LEDs (diffused work best)



Printer Paper


- (Golden) Yellow

- Red

- Black

- Brown

- White


Hot glue gun

Soldering Iron


Paint Brush

Pen or pencil


Step 2: Cardboard

I really seem to use a lot of cardboard for things these days... A 3D Printer would have been my first choice, but I guess I'll just have to use what I've got, and I've got a lot of cardboard.

Step 1: Cut out 4 pieces of cardboard of dimensions 1 1/2 inches by 5 1/2 inches.

Step 2: Cut out 2 squares of cardboard 1 1/2 inches tall.

Step 3: Glue 3 of the 4 rectangles and one of the squares together to form the basic shape of a torch

Step 3: Circuitry

I actually changed this several times at different stages throughout the project to account for things I hadn't thought of, so please excuse any inconsistencies in the pictures.

I used Yellow LEDs to give a more fire-like appearance, with a dimmer, orange glow. If you want to use the torch more as a lamp than a prop, use White LEDs, although I would suggest using less of them and a resistor, as they are significantly brighter.

Step 1: Solder the Nano, 9V connector, and Switch together in series, so that the switch can interrupt the power supply (Red wire to Vin, Black wire to center pin of switch, last wire from a side pin of the switch to GND)

Step 2: Poke evenly spaced holes in the last square of cardboard for the LEDs, with one in the center

Step 3: Insert the LEDs into the holes, and solder the cathodes (the short legs) together to form a common cathode.

Step 4: Strip and solder wires onto the Anodes (long legs) of each LED.

Step 5: Strip and solder a wire to the common cathode of the LEDs

Step 6: Solder the wire from the center LED to pin 12 on the Nano.

Step 7: Solder the wire from the common cathode to GND on the Nano

Step 8: Solder the remaining LEDs to pins 3, 5, 6, 9, 10, and 11 on the Nano.

And that's all for the circuit.

Step 4: Gluing Components and Semifinal Assembly

So now we need to mount everything.

Step 1: Glue the square with the LEDs in place at the top of the body of the torch.

Step 2: Glue the Nano in place in the center of the side of one of the longer pieces of cardboard. The USB port should stick out a little bit.

Step 3: On the last piece of cardboard, cut a slot for the switch and USB port.

Step 4: Glue the switch in place.

Step 5: Cut 4 pieces of cardboard about 2 inches by 3/4 of an inch.

Step 6: Glue these pieces to the back of the last piece of cardboard so that it will slot into the rest of the body of the torch.

Now you can move on to the code!

Step 5: Programming

The program on this is simple (no libraries, yay!). 4 of the LEDs stay solid, and 3 'flicker'. To make them flicker convincingly, we use the random() function in the Arduino IDE. First, we use the random() to find an upper and lower range limit for each LED. Then, we use random() again to pick a number for each LED from within the already random ranges, and write the LEDs to these values. In this way, we create a double random value, ensuring the flickering is convincing and will almost never repeat in a pattern, and the LEDs will very rarely ever be at the same value.

One of the things I was trying to do was get all but one of the LEDs to flicker, but the Nano only seems to like flickering three, so I have the other 4 solid. I suppose this is more true to in-game torches, with constant light output with the occasional spark.

Anyway, have a poke through my code, then upload it to test it.

Once you know it works, move on to create the top of the torch.

//Fire animation for 7 LEDS

int l6 = 11;  //switch these around to change which bulbs flicker (L1-L3 are the flickering pins)
int l5 = 10;
int l4 = 9;
int l3 = 6;
int l2 = 5;
int l1 = 3;

int dly = 5; // change this to make the fire slower & smoother (increase delay) or faster & jerkier (decrease delay)

// Brighness ranges 

int ur1;
int lr1;

int ur2;
int lr2;

int ur3;
int lr3;

//exact brightness levels

int lvl1;
int lvl2;
int lvl3;

int prev1;
int prev2;
int prev3;

//get random range for each bulb

void findRange(){
  ur1 = random(125, 255); //upper range
  lr1 = random(0, 125);   //lower range
  ur2 = random(125, 255);
  lr2 = random(0, 125);
  ur3 = random(125, 255);
  lr3 = random(0, 125);

//get random level withing random range for each bulb
void findLevels(){
  lvl1 = random(lr1, ur1);
  lvl2 = random(lr2, ur2);
  lvl3 = random(lr3, ur3);


//display option one: jump directly to new levels (very jerky, more like a wind-blown candle)
void findLevels1(){
  lvl1 = random(0, 255);
  lvl2 = random(0, 255);
  lvl3 = random(0, 255);
  analogWrite(l1, lvl1);
  analogWrite(l2, lvl2);
  analogWrite(l3, lvl3);
  analogWrite(l4, lvl1);
  analogWrite(l5, lvl2);
  analogWrite(l6, lvl3);

//display option two: fade nicely into new levels (slower "movement", more like indoor fire) 
void displayLevels(){
  //if new level is higher than the previous, fade the previous up
  while(lvl1 >= prev1){ //use while loops to force it to fade all the way instead of picking a new level
    prev1 = prev1+5;
    analogWrite(l1, prev1);
  while(lvl2 >= prev2){
    prev2 = prev2+5;
    analogWrite(l2, prev2);
  while(lvl3 >= prev3){
    prev3 = prev3+5;
    analogWrite(l3, prev3);
  //if new level is lower than the previous, fade the previous down
  while(lvl1 <= prev1){ 
    prev1 = prev1 - 5;
    analogWrite(l1, prev1);
  while(lvl2 <= prev2){
    prev2 = prev2 - 5;
    analogWrite(l2, prev2);
  while(lvl3 <= prev3){
    prev3 = prev3 - 5;
    analogWrite(l3, prev3);

void setup (){
  pinMode(12, OUTPUT);
  pinMode(l1, OUTPUT);
  pinMode(l2, OUTPUT);
  pinMode(l3, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);

void loop (){
  analogWrite(l4, 255);
  analogWrite(l5, 255);
  analogWrite(l6, 255);
  digitalWrite(12, HIGH);
  //findLevels1(); //uncomment this and comment out findLevels(); and displayLevels(); to get jerky effect

Step 6: The Top of the Torch / Final Assembly

I made two versions of mine, one with white paper and one with pastel yellow. With the lights on, the effect is about the same. I decided on yellow simply because my white one was a bit small.

Step 1: Trace the bottom of your torch on printer paper.

Step 2: Using the trace lines as a guide, create a '+' 3 units wide and 3 units tall, where one unit is equal in length to the side of the bottom of the torch. (Assuming the torch is 1.5" square, you should have a '+' 4.5" by 4.5".)

Step 3: Cut the '+' out, leaving tabs on the sides

Step 4: Fold and glue the '+' together at the tabs to form a cube with one side missing. (Elmer's glue works best)

Step 5: Let dry, then glue on top of the torch, over the LEDs.

Now you can move on to Paint!

Step 7: Paint!

Now, get out your paint, and pull up an image of a torch.

Step 1: Paint your torch however you like, with as much detail as you like. I free-handed mine, and it turned out pretty well.

Step 2 (Optional): Draw and cut out symbols for the USB port and switch, and glue them in place.

Step 3: Let Dry. Add the battery if you haven't already, and turn it on to admire your handiwork.

Step 8: Results and Final Thoughts

I really liked how this project turned out. I would have loved to try making it with a 3D printer, but I haven't got one, so Cardboard was the default choice for a squarish object. I want to convert it to run on a rechargeable battery, as my 9V batteries run down disappointingly quickly for just running LEDs. Overall, more planning would have been better, but I think 'winging it' is more my style anyway.

Please comment with suggestions and questions, I love the attention and feel lonely without it. I also like helping, so don't be afraid of looking like an idiot if you have a simple problem, we all have something to learn from it.

As always, these are the projects of Dangerously Explosive, his lifelong mission, "to boldly build what you want to build, and more."

You can find the rest of my projects here.

Please vote if you liked this!



    • Microcontroller Contest

      Microcontroller Contest
    • Woodworking Contest

      Woodworking Contest
    • Casting Contest

      Casting Contest

    We have a be nice policy.
    Please be positive and constructive.