Introduction: LED Cube Pendant - Worlds Smallest LED Cube

About: Send me an encrypted message on keybase.io/nqtronix or visit me on hackaday.io/nqtronix for the latest updates!

It all started when I stumbled across Harifun'stiny LED cube almost 10 month ago. He has done a great work on miniaturizing Ashler Glick's innovative charliecube, which uses charlieplexing to control a 4x4x4 RGB LED cube with nothing but 16 IOs - no driver circuitry needed.

Despite being the smallest cube to that day, I was aware that there are even smaller LEDs, so - technically - it should be possible to shrink it even further, right?! But the more important question is: What is the smallest thing that we makers can build, at a reasonable budget and with humble tools? This project was a quest to figure it out! The final result is so small that it could be worn with a necklace, but I use mine as a key fob.

While most of this project is fairly simple, everything soldering related is a tough. It's not impossible, but definitely not a beginners project either. Are you up for the challange? Let's get started!



If you like this instructable, you should go check out mosivers' builds based on this!

4x4x4 DotStar LED Cube on Glass PCBs

3D Digital Sand


Step 1: Design Insights

This instructable will mostly be a step-by-step instruction on how to recreate the LED Cube Pendant I build. For those of you, who want to build something similar, I'll shortly go into the most important design questions. Although I'D like to it is not possible cover every aspect, so just ask if there's something important missing!

For most project I'd do everything to avoid charlieplexing of LED. It just makes everything more complicated. But in this very special case it allows us to break down the complex mechanical structure of conventional LED cubes into individual and identical stacks, ideal for this ultra-miniaturization.

The size of this build was determined by three key elements: the size of the LED, the minimum PCB trace width/spacing and the minimum battery size. Originally I planned on using the smallest RGB LEDs ever made (size 0404, 1.0x1.0mm), but the type I got delivered was impossible to solder to wires. Luckily the PCB design limited the stack spacing and I was able to use some spare 0606 RGB LEDs (1.6x1.6mm). The batteries I had (originally bought for a future project) are 17x10x3.3mm and defined the size of the case.

A tricky part is always to design the case, especially when the build is as tiny as this. I did some research and found this inspiring article by Voja Antonic on using PCBs as as case. PCBs are made of fiberglass reinforced epoxy a highly durable material even in thin sheets. Moreover I can hand over all the precision work to my PCB manufacture at little addtional cost. They offer to mill any shape for free, which allows for tightly fitting, puzzle like parts.

Step 2: Electrical Design

At first the circuit may seem comlex, but it can be broken down into the following parts:

Controller & Charlieplexing:
Hoped to find a IC which does the charliplexing for me, but there doesn't seam to be any suitable part for the 192 individual LEDs. The worst thing is that it takes a large amount of IOs, too many to use the popular ATMEGA328P and all additional features I wished for. Thus I settled for the fairly new ATMEGA328PB, it's direct successor with more IOs in the same case.

Power management:
Another issue of charlieplexing is its low brightness, mainly limited by the IO output resistance. To counteract that the supply voltage needs to be as large as possible. The TPS61220 is a very high efficient (typical 95%) and small (about 2x2mm ) step-up converter providing 5.5V, the maximum voltage of the ATMEGA328PB. An IO of the microcontroller is used to select between high and low power mode to reduce power consumption in deep sleep modes.

Internal LiPo batteries:
The charging of the batteries is completely handled by the MCP72832-2 charging controller, we only have to select the charging current with R6. To be able to run the device from USB power while charging I'd usually select a BAT54 dual shottkey diode, but to increase the battery life I desperately searched for a possibility to reduce the forward voltage. This can be done with a P-channel Mosfet in a rather unusual configuration. When the USB power is disconnected, the Mosfet is turned on, reducing the forward voltage to a few mV. With USB power connected it is turned off and the circuit is powered trough D1. This special type has a very low GS leakage (<1uA), to reduce the battery drain in low power modes.

Detecting USB power and battery voltage:
For a portable system it's good to know how much power is available. The resistors R7 through R9 create a simple network, which is connected to an ADC input. The transistor Q3.1 can disable the resistors to save power in power down mode. As of now there is unfortunatly no code supporting this feature.

Programming through micro USB:
With a small build like this it can be troublesome to program the controller. Since I don't need the USB data lines for this project I came up with a solution to upload the program through this connector. See "Breadboard the programming circuit" for more details on this.

Using micro USB for other signals:
The micro USB connector supports various accessories, even some without USB signals. A single resistor between ground and the ID pin determines the function. The circuitry connected to it is designed to detect this resistor with minimal power consumption. There is very little public information on this subject and forces the development of a compatible solution. I'll keep you updated on this.

Accelerometer:
It was added mainly to try some code and hardware for an upcoming project, but I didn't get around to try it yet. The Mosfets Q1.1 and Q1.2 are supposed to shift the signal voltage level from 3.0V to 5.5V, the transistor Q4.2 can activate an interrupt when certain events (tap, double tap, inactivity) occur.

Step 3: PCB Design

While in theory routing a PCB is straight forward, it gets more complicated with decreasing size. Here are some of the challanges and their solutions:

Main PCB to LED cube connection:
It's hard to get connectors suitable for tiny applications like this. Even if there was a fitting part it would still consume space. The solution ist to solder them together directly. By pure luck the board fits right in between the solder joints of the LED stack. To actually connect each IO to a unique net the stacks had to be moved. No big deal - we can fix this in software.

LED cube board layout:
For the LED stacks the holes can be tiny, and they have to to make room for some fuzzy wiring. It's no wonder that there's no space left for vias which are the very same size. Instead each of the mounting holes has to electrically double as a via; one one side each trace connects only two of them.

Hack it for more room:
Despite many attempts it was not possible to fit all parts on the main PCB. As makers we can do a few things not possible in industrical production: Instead of a few traces to the LED cube PCB I designed in pads for manual wiring and the EEPROM memory chip was placed above other parts.

Step 4: Charlieplexing Code Design

Charlieplexing is never easy, but for this cube I had set my goals exceptionally high. In short, I wanted to keep up with the specs of modern displays, just with fewer pixels:

  • 8bit resolution per color, resulting in over 16Mio. different possible colors per RGB LED
  • 120Hz frame rate to eliminate all flicker, even in video taken with a normal camera
  • interrupt capable code to allow for faster reaction to peripheral units
  • use any user defined IO

Many explanations of how the program works are included in the code as comments. For this instructable I want to focus on why certain decisions in the code design have been made.

Performance estimations:
To archive a resolution of 8bit at 120Hz for 192 LEDs it requires at least

2^8*120*192 = 5898240

equally sized timing slots. At the internal frequency of 8Mhz each of those slots have to equal one processor tick.

Precise timing & interrupt capability:
In almost all applications a dedicated timer is preferred for precise timings. Unlike the _delayms() command the processor can still execute tasks and archives a higher performance. Unfortunatly for this design with extremely short timing periods the overhead of the interrupts can not be tolerated. Even after assembler optimization the lowest possible brightness was about 40 ticks, unsuitable for smooth color fading. Even worse, other interrupts such as the one from the RTC can delay the "off" interrupt and may cause serious LED over current issues.

Both issues can be fixed with a "manual" delay routine, which basically counts the elapsed ticks. With the current Assembler based sollution the lowest brightness is 2 ticks, limited by the memory access time. Outside of the actual delay loop delays are possible at any time. To reduce the very high processor load it might be possible to pre-calculate some values within the delay loop, but this idea needs to be investigated further.

LED to IO assignment:
Each LED is activated by setting one IO to high and another to low. For this specific arrangement of LEDs 16 IOs are needed to control all of them. Fortunately it requires only 4 bits to store a number between 0 and 15, and thus we can store all required information about an LED in one byte. The array cplex_LEDmap contains all possible combinations. The position of each entry corresponds to the index of the LED brightness array, changing the order of the entries in cplex_LEDmap can be used to sort the LEDs in a special way.

To turn the two 4bit values into two register/ data combinations the code will look up the values from the arrays cplex_IOreg and cplex_IObyte. To reduce the amount of typing these tables are auto-filled with values specified in cplex_cfg.h.


The complete source code is included down below. The main.c file includes some options for debugging (in order to create various test patterns), just uncomment the defines. Pre-compiled test files are also available.

Critical bug fix: Replace the main.c in the archive with the new one attached. I forgot to turn off an IO used for debugging, this bug *might* damage the microcontroller, programmer, or both!

Step 5: Tools & Materials

Tools

  • tweezers, various with fine tips
  • tweezers, one cheap pair
  • plieres, small with smooth grips
  • vice
  • side cutters, low quality
  • side cutters, flush cutting, suitable for wires as small as 0.1mm
  • file, very small with a dull side
  • file, small, about 1cm wide
  • jigsaw with a metal cutting sawblade
  • 2.0mm drill bit (no actual drill required)
  • soldering station, temperature regulated with fine tip (0.4mm)
  • hot air SMD soldering station
  • antistatic brush
  • multimeter
  • utility knife
  • lighter
  • small flat screwdriver
  • precision scale, 0.01g resolution preferred
  • caliper, a cheap one will do
  • ISP programmer, I used the AVR dragon, but any with 5V signals should work fine

Consumables (stuff which is used up during the process, but not included in the finished build)

  • sandpaper, grids 180, 400 (water suitable)
  • sandpaper "micro-mesh" for polishing the epoxy (grids used: 1500, 1800, 2400, 3200 3600, 4000, 6000, 8000, 12000)
  • solder, 0.5mm thick (or smaller), preferably with lead (lower soldering temperature and more reliable joints)
  • flux, non-clean, I prefer the liquid type in a flux pen
  • solder iron cleaner, dry brass/copper recommended, but wet solder sponge is ok, too
  • desoldering wick, about 1mm wide
  • adhesive tape, I mostly used kapton tape (because it's heat resistant)
  • some cardboard
  • tiny tic tac boxes or another small mold /container (at least 1.3x1.3x3.0cm), made of polypropylene (PP) plastic
  • play dough
  • isopropyl alcohol
  • paper towel
  • mixing cups (the inner surface must be even)
  • mixing stick
  • syringe (20ml)
  • nitrile gloves, or just wash your hands whenever you get resin on your hands
  • superglue

Materials (always add a few spare parts)

  • electronic components, see attached BOM (Bill of Materials)
  • custom PCB, 0.6mm thickness, black solder mask (design files attached in "PCB design" step)
  • battery, type "351015" (2x)
  • screws M1.2, mine are 3mm long (2x)
  • nuts M1.2, solid brass (recommended) or nickle plated (2x)
  • regular through hole button (1x)
  • wire, with solder-able surface, 0.1mm thickness, aprox. 5m (I used gold plated, but any will work)
  • wire, enameled copper, 0.1mm thickness, aprox. <1m
  • resin, I used this, for alternatives see "How to choose the right epoxy resin" below
  • spray paint, white
  • 1x micro USB plug, 5 pin version (for the programming circuit)
  • 1x PNP transistor (such as the BC857 or BC807) (for the programming circuit)
  • 1x 470kΩ resistor (for the programming circuit)
  • 4x 220Ω resistors (testing only)
  • pin header (testing only)
  • copper tape with adhesive (testing only)

Software

  • AVR Studio 7.0 to program the chip and modify the source code (free, but you can also use other tools)
  • Diptrace 3 to modify the schematic or PCB layout (optional and free for non commercial use up to 500 pins)

Step 6: How to Choose the Right Epoxy Resin

Despite most resin looks similar when cured, there are plenty of different types and not all are suited for this project. Sure, you can just use the same type as I did, but shipping outside of Germany is ridiculous expensive. Most likely you can find another suitable type locally. Let's go through the most important aspects:

Transparency:
Make sure to get a very clear resin, which does not develop a yellowish tint over time.

Shrinkage:
All resins lose some volume when curing. This causes force being applied to solder joints and the LEDs themselves. The type I used has a shrinkage of less than 3%, which is typical of epoxy resin (EP). According to my research polyurethane resin (PUR) might be used alternatively, however I don't have any experience with them. Stay away from polyester resin (PE), it often shrinks by about 10%.

Hardness:
Cured resins have a hardness anyway between 'fresh gummy bear' and 'harder than acrylic glass'. This is expressed with the "Shore" scale. There are two common versions, "Shore A" for rubbery and "Shore D" for hard surfaces. The resin has to be reasonable hard to get a good polish. The resin I used is specified at 80 (Shore D).

Viscosity:
The viscosity of a liquid describes 'how liquid' it is. The mixed resin is used has a viscosity of less that 900mPas (@ 20°C). This is low enough to get between all components easily. (For comparison: water: 1mPas, olive oil: 107mPas, glycerin: 1500mPas, mayonnaise: 2000mPas, shampoo: 3000mPas)

Working and curing time:
Being patient while the resin cures is hard, I know that to well, yet slower reactions between the two components almost always results a superior casting. A long working time greatly reduces the amount of bubbles and a long curing time is an indicator for a resin with a long lifetime.

Step 7: Separate PCBs

The individual PCBs are tiny, it is most cost-effective to get them made as a small panel. You can get the PCB with v-groves in between the boards to snap them apart easily, but my manufacture charges a lot for that, so I opted for this simple design instead.

Use the low quality side cutters to cut through the connections between the boards, the fr4 material will cause some damage to the tool. It doesn't need to be pretty, just make sure you don't damage the boards. You should end up with 9 pieces and the center piece, which we'll need later as well.

Step 8: Refine PCB Outline

Smooth the rough edge of the PCBs wherever they were connected to the panel. It is crucial that you work very accurately, almost every edge will be visible later.

Making the case out of PCBs allows us to get incredible well-fitting parts since the outline is milled precisely at no extra cost. However the milling bit is round and thus can not reach inwards facing corners.

Use the tiny file and remove the excess material. Pay close attention that you only remove as much material as required. Face dull side of the file faced towards the main outline to prevent accidental damage. For good results you should keep the final shape in mind and regularly test fit the parts.

Step 9: Solder Parts to PCB

Once you've separated all parts you can start soldering the components onto the main PCB. This step needs to be done early as this board is required to test the individual LED stacks.

Although I'm sure you can figure out how to assemble such a board on your own, there are a few parts, which can be annoying if handled improperly. Here's what I'd suggest:

Secure the board with some double-sided sticky tape to the working surface.

Begin by soldering the leadless packages, the QFN, LGA and the watch crystal to the bottom side of the board. These parts can't be reliably soldered with a normal iron. Usually hot air and soldering paste is used to mount these parts. I don't have soldering paste, instead I used the soldering iron and a lot of flux to apply a very thin and even layer of solder to both, the pads on the PCB and the pads of the component. To much solder lifts the part too high and it may not fit int he case later.

Add fresh flux after cleaning the board and the part with isopropyl alcohol and an antistatic brush. Now you can use the hot air to reflow the parts like usual. The solder 'wetting' is sufficient when you can carefully poke the part and it snaps back into its ideal position.

Afterwards soldered the small SMD button by hand, as it does not withstand the hot air. Due to the very restricted space I had to place two 0402 SMD parts in a way that they overlap with the footprint of the LDO. Therefore it's best to solder the LDO first.

Finish the bottom before switching to the top side. The micro USB port usually requires two small holes two center properly during reflow. For a manual assembled board like this the two plastic pins on the bottom side of the connector are not required and need to be cut of with a flush cutting side cutter.

The last part to be soldered is the TSSOP-8 EEPROM memory. It is placed right above the step up converter. This requires you to bend the VCC, GND and both I2C pins down and break off the other. The remaining gap between the chip and the PCB can be bridged with solder.

The battery will be added in a later step.

Step 10: Breadboard the Programming Circuit

Programming small circuits like this is always a challenge. Commercially it would be done with a custom jig containing spring-loaded pogo pins. For a one-off build this is not a viable solution, both cost and effort wise.

Charging of the internal LiPo battery requires about 5V, which is not coincidentally the voltage of the very common USB power supplies. Logically a micro USB connector has been chosen to supply the power. The remaining 3 contacts, 4 if you include the shield, are not in used. By pure luck this is the exact count required for ISP programming to work.

Under normal conditions the shield is either floating (not connected) or connected to ground. This allows us to safely use this connection as an active high reset line to initiate the programming mode without interfering with other USB devices.To convert from the active low reset of the programmer to an active high signal, a pnp transistor and resistor is needed. The transistor will also limit the current when connected to a normal USB device and protect both sides.

Build the circuit according to the schematic above on a breadboard. You'll need to make a small adapter cable for the special 6-pin micro USB connector.

Step 11: Test the PCB

If there are no visual shorts it's time to check whether programming of the microcontroller is possible. Connect the assembled main PCB and your ISP programmer of choice to the programming circuit from the previous step. If you use the AVR dragon make sure to connect the power first, otherwise the step-up converter will go crazy.

It's always a good idea to first check whether the supply voltage is correct. If you have a multimeter, probe the voltage of the nets "Vcore" = 5.0V (the input voltage of the LDO), "Vstb" = 3.0V (the output voltage of the LDO) and"VcoreSW" = 0.0V (software enabled high-power mode, should be off by default, supply voltage of e.g. the memory).

Your programming software of choice should offer some way to access the memory of the microcontroller. Ensure a stable connection is possible by reading the device ID. In AVR Studio open the tab "Tools"/ "Programming" and select your programming tool. Hit "read device ID". If no error pops up you're fine and can proceed with the next step.

Step 12: Prepare Wires

Unwrap around 2-3 turns and fixate the wire in the notch in the spool. Grab the loose end with the pliers and the other end either with another pair or tweezers. Gently pull the wire to stretch it by about 1mm. You will end up with a perfectly straightened piece. Use the better side cutters to cut off pieces with about 5cm in length, you don't need to work exact here. In total you'll need 64 pieces.

Step 13: Make Stencil for the LED Stacks

After soldering the first LED stack free hand, which took almost 2 hours, it was clear that this procedure isn't viable to solder the remaining stacks. To make the soldering easier a stencil is needed, similar to Harifun's. However I don't have access to a laser cutter or CNC (and you may neither), so it had to be made by hand.

It turns out the PCB has almost the perfect thickness and luckily the center piece (of the panel) is not required and can be used to make a stencil. Cut four thin slots with a jigsaw perpendicular to one edge, spaced 2mm apart in ascending depth (3mm, 5mm, 7mm, 9mm). The different depth aligns the LEDs diagonally, which extends the visual area. Test fit an LED into each slot. If you can't slide it from the back to the front with moderate force use sandpaper (180 grid) to carefully widen the slots as required.

Lastly you need to reduce the thickness of the stencil. Use the same sandpaper to remove the black solder mask and all copper from both sides. Use sticky tape to hold the board while dragging it across the sandpaper.

Step 14: Prepare the LED Soldering Jig

Apply some krepton tape to your working surface with the sticky side up. Add a spare PCB as a space and secure the stencil on top. I used magnets to hold everything in place but sticky tape works as well.

Step 15: Position the LEDs

Proceed by carefully placing one LED into the end of each slot. The top of all LEDs should face the same direction. It is crucial that the little green arrow on the bottom side of each LED is facing different directions. The configuration file within my code is written to fit the configuration in the picture above (read the annotations). Check that each LED is placed vertical in its slot.

Step 16: Tin the Contacts

Set the soldering iron to a fairly low temperature to reduce the oxidation speed of the tip. About 300-320°C seems to work reasonable well with lead containing solder. Clean the tip thoroughly with either a dry copper/brass based cleaning tool or a wet, high temperature suited sponge. If the tip is not shiny, add some fresh solder and repeat the process.

With a clean tip it should be fairly easy to apply some solder to the top and side facing contacts of each LED. Add just enough solder that the contact is covered. Do not use additional flux at this step, it will loosen the glue of the krepton tape.

Step 17: Solder the Wires

Hold one piece of wire with a pair of tweezers right next to the first contact and heat both, the wire and the present solder, with a clean soldering iron. After a few seconds the solder should melt and the wire should slide right into the tiny groove in the LED's contact. If it doesn't you maybe need to add a tiny amount of solder. Continue to solder the remaining contacts. Use the tweezers to gently pull at the wire of each solder joint. The wire must not come loose under any circumstances. Again, don't use any additional flux.

When you think your done with one side, remove the magnets/ tape (which holds the stencil down) and inspect the alignment. If required you can make small adjustments at this step.

Now flip the stencil and mount it bottom up. Repeat the process for the now exposed contacts. However now you can (and should!) use flux to improve the solder joints. If required you can flip the stencil again and improve some solder joints on that side.

Step 18: Separate the Stack (& Repeat 15 Times)

Grab the stack of LEDs with your hands and try to carefully separate it from the stencil. If it doesn't come loose, apply some isopropyl alcohol to dissolve the flux residue. Before soldering the next stack clean the stencil (with isopropyl alcohol) and replace the krepton tape.

Step 19: Test Each Stack Individually

To test each LED with a minimum of effort, we'll use the already assembled main PCB to generate charlieplexed signals. This requires you to solder four wires to a group of pads and a normal pin header. Thanks to charlieplexing it does not matter which pad is connected to which pin.

The pin header is than inserted in the same breadboard previously used. Ensure none of the black wires is touching another. Connect one side of a 220Ω resistor to each pin and the other to an alligator clip cable. Make a simple testing jig out of paper and adhesive copper tape like shown in the picture. Connect each able to one corner.

Now it's time to flash the test program onto the microcontroller. Open the programming software of your choice and load the .hex file. You don't need to change any fuse. Users of Atmel Studio can also double-click on the .atsln project file to open the project.

Place each stack onto the testing jig and press the wires against the copper tape. Carefully wiggle the LEDs with your other hand. If all LEDs stay lit all the time put it aside. Otherwise you'll need to fix some solder joints. Typical errors are:

  1. One die within one LED is dark:
    Most likely a single solder joint is broken.
  2. All three dies within one LED are dark:
    Usually only a single solder joint is broken, the one of the common anode providing power to all LED dies.
  3. Several dies in different LEDs are dark:
    It's unlikely that this many solder joints are broken. Instead to wires may be shorted together by a tiny solder bridge. You can find it with the continuity test of your multimeter. Oh, and make sure it's not just the alligator leads touching, I spend an hour figuring that out.

Also make sure to check if each LED is rotated. I f****d this on up and only noticed it after the pour. Uuups. To help you with this, there is a second version of the code, which will cycle through all LEDs.

Step 20: Prepare LED Stacks for Painting

Surprisingly the RGB LEDs I've used don't mix the colors very well. For larger LEDs it's possible to sand the case, but this gets ridiculous for our tiny LEDs. Instead a light coat with withe spray paint seems to do the trick. The paint will also prevent the bare wires from shorting to an adjacent stack.

To ensure the paint sticks well, we need to remove all remaining flux residue with isopropyl alcohol. Just dip them into a small container and let them soak for a minute or so. When you take the out dab them with a paper towel to absorb the flux solved in alcohol. Repeat if stains are visible.

Line up the LEDs on a piece of cardboard and secure them with some sticky tape. The wires should extend at least 1cm from the support and not touch each other. Tape this assembly to some sort of support, I choose a piece of scrap wood.

Step 21: Apply Paint

For the first experiments I tried coating the LED stacks with normal white spray paint, white primer and a combination of both. It turned out that the epoxy resin I used reacts with both spray paints: The white paint spreads through the resin and creates a smoke-like effect, the primer will just get loose and sink down to the PCB. Needless to say I was quite disappointed.

It turned out that the smoke effect can be reduced significantly by an improve epoxy usage. Depending on your resin the results might very a lot. Make some test pours with a single LED coated in paint before risking the whole build.

For the final build all stack have been covered in a thin layer of the normal white spay paint. Looking back I should have used less, in my opinion it blocks too much light. Let it dry for at least 24 hours at room temperature.

Step 22: Solder the Stacks to the Base PCB

The base PCB has three white line of silkscreen on its back, these are the spots where the main PCB and the support parts will be soldered to. The side without a line will be facing forward. Although it looks like the board can be rotated this is not the case. The main PCB has to be at its indicated place. For this fragile assembly it is very helpful to secure the PCB firmly. For me the 'precision vice', crafted form a vice and a pair of tweezers like, worked best. It can be tricky to insert all four wires of a stack simultaneously in the tiny holes. I ended up inserting each wire individually with tweezers. Ensure the tilted LEDs are pointing forward. The ideal distance between the lowest LED and the PCB is 6mm. After shaping the epoxy resin, the LED cube will have the same spacing to the top and to the sides, while the body has an equal length to the clear part. You can solder all wires without removing the paint, the heat and the flux will do that job for you. Each stack should be perfectly vertical, if not, re-heat the solder to fix it.

Step 23: Make the Mould

Recently I had the chance to get a bunch of (sadly empty) tiny Tic Tac boxes. By pure luck they have almost perfect measures and are made of polypropylene (PP), a plastic which does not stick to epoxy at all. This greatly reduces the amount of shaping required afterwards.

Start with rinsing out the boxes, you don't want to have any curbs in your casting. First remove the lid, it's not required and just gets in the way. To get the square shape you'll need to cut off the round pieces of one box, just enough that it fits rotated by 90° in a second box. Put some play doh in the whole box and push the other as far down as possible. Add some more to fill up sides. Push the inner box toward the sides to get the desired shape. Scrape away all play doh which got squished into the main compartment with a small flat screwdriver.

The size of the mould should be identical to the case you've partly assembled, you can use it to test the fit. Slightly larger is ok, you'll just need to sand the resin cube a little longer. When it fits, use double-sided tape to stick the base PCB with all LED stacks to the bottom. Lastly the mould is stuck to the bottom part of a mixing cup, which is used as a spill protection.

Step 24: Mix the Resin

Every resin is slightly different. Follow the instructions as close as possible for the best result. That said, there are a few tricks you should know:

The two components of the resin react chemically with each other, the speed highly depends on the temperature of the mix. Most resins are tweaked to work best at room temperature (20-25°C). If not stored at room temperature, give it some time to warm up.

It's not trivial to mix perfect resin. For best results the ration has to match the given as close as possible. For small quantities a precise scale is a must have. Surprisingly they cost less than 5€, including chipping from china. The hardener compound is more liquid and can be dosed fairly easily with a syringe. Place a cup on the scale and zero out the weight. Pour in a small gulp of the resin in it and calculate the required amount of hardener based on it's weight. After adding exactly that amount, mix both parts thoroughly for a minute or so.

The manufacture of my resin recommends waiting about 30 minutes to let all bubbles disappear. To minimize the reaction between the paint and the epoxy resin I tried to let it sit for 90 minutes. The mixture is significantly thicker than at the beginning and bubbles are trapped easily. The cured casting is significantly less pure than before. For the final casting I stuck to the manufacture's recommendation.

Step 25: Pour It

Slowly pour the resin into the mould from a low height to prevent bubbles. If bubbles get stick in the corners, immediately remove them with a small stick or piece of wire. Fill up the mould right to the top, it will cave in a few millimeters during curing.

Without doubt the most fun part is popping the bubbles at the top, just burn them away with a lighter! Don't go crazy here, a little is often enough and more heat risks damage to resin.

As this is the riskiest step in the whole project you might as well pray that everything works well. Of course, this is purely optional :D

Step 26: Let It Cure

The major mistake in my first test pours was trying to accelerate the curing process by moving the mold into a warm room. This caused the outer layers to heat up first, causing movement which was the main reason for the smoke effect.

That said, I strongly suggest to store the still liquid pour at the very same temperature it was poured, preferably in some rarely used furniture to reduce airflow.

After 48 hours this particular type is fully cured. Some people suggest tempering the casting for a day at a higher temperature, 35-45 degrees for an increased hardness and a better finish after polishing.

Despite all precautions and previous successful test pours my casting didn't turn out that well. The surface remained sticky and got worse when I tried it to wash away. The only option is to scrape it off.

Step 27: Break the Mold

You'll notice it's very easy to separate the epoxy from the polypropylene (PP) mould. To unstuck the cube from the double-sided tape at the bottom, some force is required. An easier way is to cut trough the outer box at the small side. The tape will most likely stick to the PCB and can be removed with a little isopropyl alcohol and a small brush.

Step 28: Clean Up the PCB

You will might notice that the epoxy resin has crept between the PCB and the double-sided tape. I have no clue why, or how to avoid it, but I figured out how to remove this thin layer easily.

Most epoxy based resins don't handle high temperatures very well. This kind isn't an exception. Before you get exited, put away that lighter, it's much to hot and will damage the wanted epoxy visually. Instead grab the hot air soldering station, set it to the lowest possible temperature (in my case 100°C) and a medium airflow. This will weaken the epoxy enough to scrap it of with tweezers or a small screwdriver. The remaining crumbs can be simply brushed away.

Step 29: Refine the Shape

The casting is very close to the shape we want. Use a small file to remove the excess material on the top and flatten out the surface. To make room for the case, which will later fit around the base PCB, clean up it's edges of the with a utility knife.

The final measures should be very close those of the case. Sandpaper with 180 grid seems to be a good compromise between the amount of material removed and the possible accuracy. Lay it down on a flat surface, add some water and smooth out the surface as flat as possible. From experience I suggest leaving the size slightly larger than needed, about 0.1mm on each side, to account for removed material during polishing.

Remove the epoxy in the corners of the base PCB with a sharp utility knife. Later the case will fit right into these places.

Step 30: Polish the Epoxy

Sand every side of the cube with each available grid of micro mesh. Start from 1500 and move all the way up to 12000. Always sand wet with plenty water for the best results. The goal is always to remove the scratch marks of the previous grid. It's very hard to get an ideally flat surface, expect a few minor curves. This process took me about 3 hours, but the super shiny result makes up for that.

Step 31: Add Nuts to Internal Supports

Besides the mecanical reinforcement, the supports are used to hold the case and the electrical assembly together. Two screws go through the small hole in the case on either side and screw into the brass nut of the support.

Unfortunatly the brass nuts were delivered late and I had to resort to the standard measures for M1.2 nuts which turned out to be not identical. With some additional effort it is still possible to solder them in place. Although both PCB parts look identical, you need to make a left and a right piece with the nut flush to the left or right side. To prevent solder from getting stuck in the inside of the nut, you can screw in one of the steel screws, solder will not stick to them.

Step 32: Sink Screw Head

When you test fit the support and the corresponding part of the case, you'll notice the screw head is slightly sticking out. Twist a 2.0 to 2.5 mm drill bit with your fingers to enlargen the hole just enough that the head fits into this cavity.

Step 33: Shorten the Screw

With a relatively long screw like mine it is likely to damage the fragile LiPo batteries. Assembled like in previous step it is easy to shorten it with a file. A little more room will make assembly easier, so go ahead and shorten the nut as well.

Step 34: Gather the Button Knob

To save space tiny 3x3mm membrane button has been used on the PCB. It's to small to be pressed comfortable, so it needs to be extended with a plastic knob of a regular THT button. Cut off the four little plastic pins holding the metal plate in place and remove it with tweezers. Turn it over and the knob should simply fall out!

Step 35: Make It Fit

For this project its rim is too thick and needs to be flattened out. Simply sand off the plastic with a 180 grid sandpaper until the thickness is about 0.2mm. Unfortunately this removes the pin in the center, which is required to make contact with the button.

To fix that set the soldering station to the highest temperature. Heat up a piece of solid wire (0.5mm diameter) and poke it right in the center of the button. Let it cool and secure it with a drop of superglue. Trim the end with the flush side cutters to about 0.2mm length. I wish I was kidding, but I miscalculated the fit and it got smaller than expected.

Step 36: Case Assembly Part 1

To test the fit of the individual parts I assembled the first case quickly and in one go. Of course, the main PCB didn't fit properly into it. Thus I concluded it's better to build the case in several steps and tweak the fit of the individual parts, if required.

The first part is made with three pieces: the top, the back and the left side. Secure the parts together with some tape, preferably krepton tape, as shown in the picture. Set your soldering iron to the highest possible temperature (mine was 450°C). Together with a little flux the solder will flow nicely and creates a strong solder joint. Use as little solder as possible, with too much the main PCB won't fit.

Ensure the button fits beneath the main PCB and can be pressed. The actuation distance is only 0.1mm, but you should feel a 'click'. Remove it temporally for the next steps.

Step 37: Solder the Main PCB to the Cube

Place the contacts of the main PCB on the center silkscreen line, right inbetween the solder joints of the base PCB, at an angle of 90°. The side with the thick components must face inward to fit later in the case. There shouldn't be any gap between both PCBs, the case is tightly designed and won't fit later. Re-heat each solder joint and add a little additional solder, if required.

Step 38: First Support

Right now the assembly is very fragile. To not risk any damage to the main PCB and the LED cube we'll add the left support piece. The small side goes right beside the micro USB connector. Avoid any solder leaking into the connector, it's almost impossible to get it back out. The wide side is aligned with the silkscreen mark on the base PCB of the LED cube and soldered on the inside only.

Step 39: Add Wires

To make room on the PCB for parts I decided to have replace a few traces with enameled copper wire. The 5 top left pads making contact with the LED cube need to be wired to the 5 pads at the bottom, right next to the microcontroller. Tin the ends of 5 4-5 cm log pieces of wire and cut the exposed length down to 1mm. Solder each wire one pad. Push all wires through the tiny hole. Repeat the tinning process for the other end, but leave the wire about 1cm longer than needed. Theoretically the leftmost pad on the LED cube should be soldered to the leftmost pad at the bottom, but if you accidentally swap them it can be corrected in software.

Upload the software and check if all LEDs light up sequentially. If any two LEDs light up at the same time you may have a solder bridge or cold joint somewhere. It can also happen, that the issue is within the casting and can not be fixed. In that case you can disable some LEDs in software, if you want to.

Step 40: Case Assembly Part 2 (& Second Support)

It is crucial that you don't make the case too slim for the main PCB. Test fit both parts, the side PCB and the support before soldering. This includes the screws, which will later hold everything in place. Use a file to remove some material, if required. The soldering itself is identical to the previous steps.

Step 41: Add the Batteries

If not absolutely required, don't put LiPo batteries in parallel without special circuitry for this purpose. To archive the tiny overall size I went with the smallest batteries I could find, which were unfortunately only available at 3mm thickness.

To connect both together safely, you need to ensure that both batteries are equally charged. If their voltage differs more than by 0.05V, charge them seperatly. This will prevent the flow of high currents at the first connection.

During assembly you need to pay close attention to not short the batteries at any time. For example cutting or stripping both wires at once will short them. Although these batteries have an integrated protection circuit, it is made for larger batteries and trips at a few amps shorting current - way more than these miniature versions can provide.

Before soldering the batteries to the PCB solder them to each other. Strip the ends of all wires by about 2mm, twist the bot positive and both negative together and solder the wires. Short them to 1mm afterwards. The designated battery solder pads are way to small for my personal taste, so I soldered the positive directly to the "bat" pin of the SOT-23-5 charging IC. When everything is soldered correctly, the cube should light up.

In my build the batteries fit best like shown above. Depending on the length of the wires you may choose another arrangement.

Step 42: Case Assembly Part 3

With the batteries installed and the button knob in place, close the case with the top lid. Gently pull out he LED cube with it's assembly. If you can't, you need to make adjustments before moving on. Else solder the last piece in place.

After putting the button knob in it's place, push everything back into the case. Apply some force, if needed. Lastly, add the screws, and you're finally done!

Step 43: Further Work

At this point, the hardware is completely done and I have reached my goal with this build. However the code does not yet make use of all components on the board. Most of the code will be used and written for future projects. Features include:

  • Potent graphics handling core, for easy use of the high performance LED driver code
  • I2C memory access to load animated images (1Mbit stores about 20sec of 24bit RGB at 30 fps)
  • I2C access of the accelerometer for interactive images
  • calender wit date based image loading, sunrise/ sunset animations or similiar
  • battery gauging code to turn off the LEDs before the protection circuit kicks in
  • automatic power off at zero movement after a certain time
  • UART via micro USB real time data streaming from a PC or similar

I'd also like to further investigate the "ghosting", which means some LEDs are lit dimly, even if they shouldn't. The problem arises, when a green or blue LED is turned on and its forward voltage at a high current is as high as the forward voltage of two red LEDs in series. Therefore it gets way worse with a higher supply voltage. This is not the full story, though. The oscilloscope shows voltage spikes up to 1V larger than the supply voltage, likely caused by parasitic capacitance and inductance.

Step 44: Things Learned

There is still a lot I'd like to have implemented, but I think it might be better to move on to the next project. Anyway, here are a few things I learned during this project which might come in handy for future projects:

Electrical:

  • RGB LEDs are not made for charlieplexing - there is always some ghosting
  • automatic power switching works flawless with a mosfet
  • programming via micro USB works reasonable well
  • internal ESD diodes can cause problems if no supply voltage is available
  • touching the shield of USB can apply if significant voltage, especially 50Hz mains induced noise

PCB:

  • PCB cases work great!
  • double check all dimensions of the PCB
  • include solder joints into the "space taken inside case" calculations
  • a button knob can be used with SMD buttons, especially if there is enough space

Epoxy:

  • epoxy seals everything - including all mistakes. Triple check everything
  • epoxy is picky with mixing ratio, time before pouring and the curing environment
  • avoid paint below epoxy, if possible. If not, at least test toughly
  • micromesh is perfect to polish (my kind of) epoxy

Code:

  • assembler is sometimes useful - and not as complicated as I thought
  • charlieplexing is processing heavy and tricky to get right
  • coding is a lot of work; I knew that before, but it's a powerful reminder

Misc:

  • don't trust 3D rendered pictures of components on aliexpress, if mechanical properties are important
  • while stacking SMD parts is possible, I don't want to do it anytime soon
  • a vice and tweezers are perfect to hold small boards
Make it Glow Contest 2016

First Prize in the
Make it Glow Contest 2016

Arduino Contest 2016

First Prize in the
Arduino Contest 2016

Epilog Contest 8

First Prize in the
Epilog Contest 8