Overview

Turn on your heartlight
Let it shine wherever you go
Let it make a happy glow
For all the world to see

A little fire for your heart! But there’s no actual flame here, no heat…instead, LEDs and a microcontroller make a virtual flame that dances like the real thing. (In fact it’s playing a tiny video loop of a real candle.)

We planned this animated flame simply as a piece of high-tech jewelry, but other uses are possible…a fire or lantern effect on cosplay props, a safer alternative to having candles on the table or as part of a holiday display, or a unique night light for finding your way to the bathroom at night.

It’s a simple circuit that can be built either as a pendant or as a tabletop piece. Fair warning though: the pendant variant is tricky…it’s a very tight space requiring ace soldering skills and some unconventional methods. As a tabletop piece, perhaps in a glass votive, or maybe you have a cosplay prop in mind, it’s much more forgiving.

Parts from Adafruit:

Other Required Items:

  • Soldering iron and related paraphernalia
  • Narrow-gauge wire. Especially if building the pendant…we’re huge fans of our 30 AWG silicone-coated stranded wire for tightly-packed projects like this one!
  • Hobby knife and/or file.
  • If making the pendant design:
    • 3D printer and transparent filament
    • Two (2) #2-56 x 3/8" screws (or M2 x 10mm)
    • Small screwdriver
    • Flush cutters
    • Necklace chain or lanyard cord
    • 5-minute epoxy or E6000 glue (do not use JB-Weld, it's conductive)
  • If NOT making the pendant:
    • Glass votive candle holder or other container

Before going shopping or committing to any parts or materials, read through the whole guide first to see what’s needed and what you might already have, or for ideas on what you might improvise.

3D Printing

If you’ll be making the pendant using our design, let’s do the 3D printing first…then you can get a head start on the electronics while the printer’s working.

If making a votive candle or something else of your own design, you can skip ahead to the next page.

The 3D files for this project are hosted on Thingiverse. They’re tiny and should fit on any 3D printer.

Transparent or translucent PLA is recommended so the light can filter through. Do not use ABS filament for this project — it tends to shrink slightly and the space inside this case is already very tight.

Print each piece as a separate job (the results are cleaner, no stringing between parts) in high-quality mode with 25% infill. Clean up with files and/or sandpaper afterward. If you rinse off the sanding dust under a faucet, wait until the parts are completely dry before installing any electronics.

The file "spacer.stl" is only used temporarily during assembly and can be printed at normal or draft quality.

Test fit each part in the case before assembling or soldering anything. You may need to file away some cruft or even clip off one of the little board-supporting nubbins to ensure it all fits inside.

Software

Let’s get the flame code installed on the board before soldering anything. That way the electronics can all be tested before sealing everything inside the case.

If this is your first time using the Pro Trinket microcontroller, you’ll want to begin with our guide for setting that up. The Pro Trinket works a little differently from “normal” Arduinos are requires some extra installation and a different upload procedure:

Introducing Pro Trinket

To confirm that you have the driver installed and IDE properly configured, load the basic Arduino “blink” example sketch and try uploading to the board. If it won’t cooperate, work carefully through each of the steps in the guide linked above.

Do not continue until you have the “blink” sketch successfully working on the Pro Trinket board.

Then you can download the fire pendant sketch from Github:

A few things to be aware of regarding this sketch:

  • This is NOT good learning code for basic use of the LED matrix! Normally you’ll want to use the Adafruit_IS31FL3731 and Adafruit_GFX libraries (which provide drawing functions for pixels, lines, etc.).
  • The sketch is very specifically optimized for the Pro Trinket and won’t likely work on other boards.
  • It runs equally well on a 3V or 5V Pro Trinket…if you already have a 5V Pro Trinket around, that’s fine and you can use it…the 3V board is just a tiny bit more power-efficient and the battery will last a little longer. You may need to remove the part where we change I2C speed to 400 KHz but only do that if 400 KHz doesn't work on the Trinket 3.3V!

Open the FirePendant sketch in the Arduino IDE and upload it to the Pro Trinket board same way you did the “blink” sketch earlier…watch for the “Done Uploading” message. Nothing will happen, of course…we haven’t wired anything together yet…but having the code already in place makes troubleshooting easier later.

The circuit is super simple…just six wires…but the tiny enclosure necessitates some unusual build steps. We’ll get into the details on the next page, but for now, in simplified schematic form, this is what we’re aiming for:

Some points of interest to remember:

  • Do not assemble the LED matrix and driver board yet…some unusual steps are required if making the pendant design.
  • For the pendant, the LiPoly Backpack is flipped and installed “sidecar style” rather than the usual position where it’s stacked on top.
  • A couple of wires need to be soldered directly to pads on the back of the Pro Trinket rather than the usual through-hole vias.
  • There’s a trace that needs to be cut on the LiPoly Backpack to enable the power switch. This is shown on the next page.

Soldering

Prep Work

Optional but recommended: using a tiny bit of 5-minute epoxy or E6000 glue, reinforce the point where the wires connect to the battery. Allow to dry completely before continuing.

I’ve gotten in the habit of doing this the moment new batteries arrive, before even starting projects with them.

Using a hobby knife or a pointed file, scratch away the trace between these two points on the LiPoly Backpack board.

This enables use of a power switch, rather than being always-on.

If making a pendant, confirm that each of the electronic components fit in their corresponding spots inside the case without undue force. Use a file to scratch away any protruberances that interfere.

Optional but recommended: splay the “wings” of the switch just slightly so it fits more snugly into its spot inside the case.

Also, I like to trim the legs (using flush cutters) to about half their normal length. Not required, but gives just a little more working room inside the case.

Wiring & Soldering

Any wire lengths mentioned here are for the pendant assembly. If making a votive or other holder, it’s fine (and probably helpful) to use longer wires, whatever length you need.

For reference, here’s that circuit schematic again of what we’re aiming for:

Cut two pieces of wire about 1.5" (40mm) long and strip and tin both ends.

Tin two legs of the switch and connect wires here. Use the center leg and then either one of the two outer legs; the opposite one won’t be used.

Solder the opposite ends of these two wires to the LiPoly Backpack board, to the pins which had the scratched-away trace between them.

Trim away any wire protruding from the underside of the LiPoly board. This is especially important for the pendant…it needs to be nearly flat. A slight protrusion is a normal product of soldering and will fit inside the case, but gloppy soldering here will cause trouble.

Adding heat-shrink tubing to the switch legs before soldering to the LiPoly board is totally optional, but I like to do this for durability. Use it if you got it!

Snap off a 3-pin section of row pin header and solder it to the pro Trinket’s BUS, G and BAT+ pins.

The LiPoly Backpack is installed over this…BUT…instead of sitting atop the Pro Trinket like normal, turn the board over (keeping the same pin alignment…see photos) and solder it hanging off the side.

Make sure the header is perpendicular and the boards are aligned. Start with just the middle “G” pin, re-heat as necessary to get everything aligned, then solder the two outer pins. Let the solder flow into the vias, do not glop it up on the surface!

After soldering, trim away the pins protruding on both sides using flush cutters. We want this as flat as possible.

Snap off two 9-pin sections of row pin header. Solder these to the A1-A9 and B1-B9 pins on the Charlieplex driver board as shown. A solderless breadboard can be handy for holding these straight while soldering. The other 8 pins don’t require connections.

Set the 3D-printed spacer piece on the back side of this board, then lay the LED array on top of it. Hold it snug with a rubber band, tape or a couple clothespins, then solder the pins on this side.

The spacer is required for the pendant (the battery will fit into this space later). For a votive candle or other design, you can sandwich the boards directly without the spacer…unless you want the battery in that spot.

After soldering, use flush cutters to trim the pins on both sides: the LED face and the component face.

BE EXTREMELY CAREFUL AS YOU DO THIS. Do not clip off any LEDs! Also, tiny bits of metal will go flying…wear safety glasses and/or point it away from you when cutting…and make sure those bits don’t end up landing in the circuit somewhere.

For a really low profile, an alternate method is to solder only the middle pin on each side, trim all the pins flush, then finish the rest of the soldering.

This requires really ace soldering though…properly-tinned iron, heating each spot, adding just a little more solder and letting it flow in. If you’re heavy-handed or a “melt-and-wipe” solderer, that isn’t gonna cut it. Watch Collin’s Lab: Soldering for pointers!

Cut four more wires about 1.5" (40 mm) long, then strip just a small amount of insulation and tin each end. They don’t need to be all color-coded like this, but it does make things easier…use it if you got it.

On the back of the Pro Trinket board is a spot for an optional JST connector. Tin the + and pads there, then solder two of the wires to those pads as shown.

The other two wires connect to pins A4 and A5.

These four wires then connect to the matrix driver as shown in the circuit diagram or using the table below. These wires snake up from “between” the LED/matrix sandwich and are soldered on the component side, then trimmed flush.

Pro Trinket Pin

Matrix Driver Pin

+ (JST pad on back)

VCC

– (JST pad on back)

GND

A4

SDA

A5

SCL

If building pendant: push the spacer out from between the boards using a small screwdriver, then slide the battery into this space in the direction shown. Plug the battery into the LiPoly Backpack board.

For non-pendant builds: the battery doesn’t need to fit there unless you want it…just plug it into the backpack.

Test Run

Flick the switch to the “on” position and see what you get! It’s normal for the Pro Trinket to flash its red LED for about 5 seconds, then the sketch will start, and you should see the animation playing out on the LED matrix.

If it does NOT run:

  • Is the battery charged? Try plugging in USB to power the circuit that way.
  • Did you upload the FirePendant sketch to the Pro Trinket board as explained on the “Software” page?
  • Double-check the connections between the two boards. Did you get SDA and SCL crossed?
  • Look around for any cold joints, solder bridges, or bits of conductive detritus that may have fallen in when clipping pins flush.

If everything works, switch it off and we’ll finish sealing this up.

If it still doesn’t work…first, confirm you can get the basic Arduino “blink” sketch uploaded. That’ll help confirm whether it’s a hardware or software problem. Then you can ask for help in the Adafruit Forums. It’s extremely helpful if you can provide a couple well-lit and in-focus photos that clearly show all the connections.

Do not continue until you have the flame animation playing on the LED matrix.

Finishing Up

These steps mostly apply to the pendant design. If you’re making a votive or other installation, you’re pretty much done with the guide and just need to devise your own mounting scheme (hot glue, tape, or your own 3D-printed support)…but skip down to the bottom of this page for notes about charging.

Apply a small piece of tape to the back of the Pro Trinket board, covering the JST pads and wires. The matrix will sit very close atop this and we don’t want any shorts if something is flexed around.

It doesn’t need to be fancy Kapton tape like this…ordinary masking tape or a couple layers of office sticky tape will work just fine.

Press the power switch into its space in the back of the case, with the slide bit poking out the hole.

A little bit of glue helps secure this in place…5-minute epoxy is ideal, or E6000 if you’re patient…but in either case, do not get any glue inside the switch (those two little notches on the side lead straight in). Use a toothpick and apply glue near the side flanges or down near the legs.

Make sure the switch is straight while the glue sets up…pinch it with something if need be. E6000 needs at least a couple hours to really firm up, so you’ll be taking a few breaks if that’s what you’ve got. Even “5-minute” epoxy should be given more than 5 minutes…15 or 20 is a good start.

The Pro Trinket and LiPoly Backpack are next…various notches and nubbins line up with the mounting holes on these boards, but you’ll need a few small dabs of glue to keep them permanently in place.

Make sure no wires are tangled underneath the boards! Get that all straightened out, then glue the boards down.

Hold this in place with tape or rubber bands or a clothespin or such while the glue dries.

The LED matrix sandwich then sits on top, also with mounting nubbins and a couple dabs of glue. Use tape or rubber bands to hold it while that dries.

It’s normal that the matrix “leans” along the length of the case…it’s designed that way, slightly tapered. But make sure it’s straight in the other direction.

Once the glue is dry, pinch a kink at the midpoint of the battery wire, then tuck this underneath the other electronics…it’s a tight squeeze, but should all fit.

Fit the case front over the matrix, then add two screws (#2-56 x 3/8" or M2 x 10mm).

The screw sockets aren’t threaded…3D printing lacks the resolution for that…you can either add threads using a tapping tool if you have one, or just grind the screws into the plastic ’til they bite, and tighten until the back fits securely and the screw heads are flush below the surface of the case.

If you accidentally strip the threads…well, more glue. No biggie.

Test it once again, making sure everything still works.

Add a fancy necklace chain or a simple nylon or leather cord, whatever suits your style!

Fully charged, the 350 mAh LiPoly battery should provide about 4 hours run time. When it’s nearly depleted, the flame may flash a few times before turning off completely.

To charge, switch it off and plug in a USB microB cable. LEDs on the edge indicate the battery charging status: a red LED indicates charging, while a green LED on the corner (not the one near the USB plug) lets you know the battery is full. A 100% charge from a fully-depleted battery will also take about 4 hours.

If you’re installing this in something other than the pendant, you have the option of using a higher-capacity battery (500, 1000 mAh or more!) with a proportionally longer run time. If you go this route, there are two pads on the back of the LiPoly backpack that can be bridged with a dot of solder to enable a faster 500 mA charging rate. Do this only if using a 500 mAh battery or larger!

This guide was first published on Apr 15, 2016. It was last updated on Apr 15, 2016.