Minecraft – Flickering Torch

Minecraft torch

In this post I describe how to make the flickering effect in the Minecraft wall torch. The first method will be really easy and anyone with a little bit of time, basic computer knowledge and willing to learn some hands on skills can achieve it and I’m providing the software.

The next version is a little more involved and will require a little bit more effort and time but the end result is a Minecraft torch that can be controlled from a WEB page on your computer, tablet or phone.

Trinket Solution (Easy)

We are trying to achieve a simple flickering flame effect so not a lot of processing is required. Due to this I based this solution on the tiny Trinket microcontroller board by Adafruit and addressable LEDs makes for a simple and affordable project.

The software I’m providing can be edited to change the torches colour or flicker rates and level.

What do you need

The following is a complete set of kit that you need to complete this project.

  • 3D printed Torch Parts
  • Arduino Trinket (5v version)
  • Micro USB power brick or old apple charger.
  • Short strips of wire
  • WS2812 Addressable LEDs strip
  • 460R Resistor
  • Soldering iron and solder
  • Hot melt glue gun & glue
  • Wire cutters and strippers
  • PC running Arduino IDE
  • USB-A to Micro USB data cable
  • Sponge / foam packing

3D Printed Parts

For the details on how to construct the lamp body please see my post

The LEDs I have highlighted above are an LED strip, my original torches used a square of nine LEDs that fitted the bill perfectly. Unfortunately this part isn’t now available https://www.amazon.co.uk/NulSom-Rainbow-Biscuit-Arduino-Converter/dp/B00UJAWVU8

To account for this I have designed a pole that can be printed to accept the ribbon of LEDs being wrapped around it and then hot melted into the torch head.

Depending on how many LEDs you can get wrapped around the pole you may have to alter the settings in the code for the number of LEDs, instructions can be found within the codes comments. But I advise not using more than 9 as the power handling of the trinket is limited.

Wiring Everything Up

I always make sure everything works before building into the end project, using a solderless breadboard. This allows you easy access to all the components and modify things without having to get your soldering iron out every time.
However, for this project there are only 3 connections required and wirings very simple, just follow the diagram below.

Trinket Wiring to WS2812 LEDs

A must have with these protoboards is a set of jumper wires, you can cut your own but these kits provide a clean set of sizes that make using these boards a pleasure. Amazon also stock some starter kits with all you need to get a number of little Wi-Fi projects up and running.

Prototype board

The code I’m supplying is compatible with WS2812 type LEDs but can be adjusted to suit a variety of types.

You can find a lovely post on Adafruit neopixels, what they are and how to use them here

The Trinket can only provide 500mA of 5V power, thus you should only attach a Maximum of 9 WS2812 LEDs onto the unit without altering how the units powered but for this application 9 is more than enough.

When creating the final soldered wiring, ensure the wires from the Trinket to the first connection is long enough to allow the trinket to be housed in the body of the torch while allowing the torch head to be removed / fitted easily.

I’m going to assume that you already know how to solder, if you don’t please follow this link to a guide on soldering – Soldering 101

Programming

Download the code for the Trinket from my GitHub repository and copy the files into a new directory called “MinecraftTorch” in the Arduino projects directory on your computer. This can be found in your computers “Documents” directory then “Arduino”.

You can then rename the project to your liking by renaming the folder containing the project and the .ino code file within it. Make sure both names are identical before opening the project in the IDE otherwise it will complain.

Arduino IDE

The Arduino IDE (Integrated Development Environment) is free to download and use. It provides a clean easy to follow user interface and you will need this to compile and download my template onto your hardware. The link here can help you with setting this up.

Once installed you also need to install some USB driers for the trinket call USBtiny. The drivers and instructions on how to install them can be found here:-

Now we have all the software installed we need to compile the program and upload it to the trinket.

  1. Open the project in the Arduino IDE.
  2. Select the correct board from the Tools->Board Menu. (Adafruit Trinket).
  3. Select USBtinyISP from the Tools->Programmer.
  4. Plug in the Trinket, make sure you see the green LED lit.
  5. Press the button on the Gemma/Trinket – verify you see the RED LED flashing.
  6. Click the upload button within 10 seconds.
Arduino Upload button

To initiate the compile / linking and uploading of the program (item 7) to the hardware just press the right arrow button at the top of the Arduino IDE screen.

Final Construction

Once you have the system up and working on the bench, you can now progress to installing it into the torch. I would advise gluing the LED’s into the torch head with hot-melt first and viewing the final effect, you may want to make modifications at this stage to the software to improve the end effect.

Inside minecraft torch
Finished Minecraft Torch

Once your happy with the effect I just loaded the Trinket into the body of the torch loose, fed the USB lead all the way through the body of the torch and out the bottom. Then wedged cut up pieces of foam (I used a new car wash sponge) to hold all the cabling and the Trinket in place.

ESP8266 WEB Version (More Advanced)

This is where we take the torches to the next level, allowing them to be controlled over Wi-Fi via a small Web page.

Everything you require is the same as the Trinket version other than the Trinket, This is replaced with an ESP8266 based controller and the software we require is different. For projects like this I use the NodeMCU modules as they have the PSU and USB interfaces for programming all built in.

Follow all the instructions in my ESP8266 Lighting Template post but download the code from the ESP8266_Minecraft_Torch GitHub repository.

The data wire of the LEDs being attached to GPIO3 or RXD0 of the NodeMCU.

This is a slightly more advanced version of the Lighting template as I have now included Favicon Icons which display icons for the web page in the device, this is useful on Tablets / phones where you can store a quick link to your device on the home screen and will now display a nice icon for it. This makes the end product look more like an application on your device.

To create the favicons I use a web resource called iconifier.net to convert images to the many sizes and formats required, once complete just copy the whole lot into the data directory of the Arduino project. Keeping all the standard naming the same as generated by iconifier.

Minecraft Web Page

You may also like...