Introduction: MagicCube - Tap to Change Color

About: Make or make not, thats the question!

Welcome to my first instructable. I hope you could follow all steps. If there are any questions, ask and I will add the content to the instructable.

The idea of this project was, to build and develop a small cube with a special effect as a gift for Christmas. All my family members got one of these and they were really happy to got one.

Step 1: Concept and Materials

The concept was inspired by another project. The Cube itself should have a small size, in total it is 39mm^3.

My setting was a available interface to recharge the cube. Most common is micro USB today.

Added a LIS3DH sensor to measure the taps (I used it in a different project, so I am familiar with it).

I want to have a physical ON/OFF switch.

Also decided to use some WS2812b LEDs, they are easy to use and make nice light.

There is now the possibility to get a full kit or a assembled pcb over Tindie, if you have not the skills or the

tools for soldering and printing this project.

The hole prints are printed with PLA from das Filament

The printers are a Ender 2 and a Ender 3 pro.

The list of Materials is long, because I list every resistor. Nearly all parts are SMD parts.

Tools you need:

  • soldering iron
  • 3D printer
  • computer with Arduino IDE
  • USBTinyISP (This or this are tested)
  • Glue
  • Hot Air gun or small reflow oven
  • solder paste

Bill of Materials:

  • 1x PCB PCBway or assembled PCB
  • 1x ATmega328P-AU Digikey
  • 16 MHz crystal Digikey
  • 1x LIS3DH Digikey
  • 3x WS2812b Digikey
  • 2x LED green (0603) Digikey
  • 1x LED orange (0603) Digikey
  • 1x Battery with molex picoblade connector (503035 or 303035 or 603030)
  • 1x TP5400 Aliexpress
  • 1x TLV70233 Digikey
  • 1x Micro USB Port Digikey
  • 1x slide switch Digikey
  • 1x molex 2p connector Digikey
  • 1x Polyfuse 350mA Digikey
  • 1x 4,7uH inductor (3015) Digikey
  • 1x SS32 diode Digikey
  • 2x BSS138 transistor Digikey
  • 7x 10k Ohm resistor (0603)
  • 4x 1uF cap (0603)
  • 7x 100nF cap (0603)
  • 4x 22uF cap (0805)
  • 2x 10uF cap (0805)
  • 1x 4,7uF Tantalcap (3216A)
  • 1x 330 Ohm resistor (0603)
  • 1x 500k Ohm resistor (0603)
  • 3x 5k Ohm resistor (0603)

When you decide to use the programming adaptor, then you need pogo-pins as well.

Something like this: Pogo Pins

Diameter should be 2 mm and length 3mm. Then they fit inside the holes and connect to the PCB perfectly.

Step 2: 3D Printed Case

The case was designed in Autodesk Fusion360. I did all steps in there, the housing, the adapter design for the pogo pins and also the basic shape of the PCB!

There is a nice export and collaboration function in Fusion360 and Eagle, so you can pull and push your changes of the PCB from one program to the other one.

Found out, how this works by watching a youtube video:

Fusion360 PCB Shape

I choose my print settings to have less to do when the case is printed. Everything is designed to have not much support and a good quality print. Only the power switch needs some support, but it is really tiny. It is better to print it with Brim.

  • Layer 0.15
  • Thickness of walls 2
  • Infill 20%

Step 3: PCB-Layout

The PCB Layout has not a high complexity. All steps where made with Autodesk Eagle.

There are a few basic modules based on:

  • ATmega328P based on an Arduino Nano
  • Two BSS138 transistors for level shifting
  • Three WS2812b LEDs
  • Battery Management and power circuit
  • the accelerometer
  • possibility to solder a 3x1 pinhead on the board for serial connection

Step 4: Soldering

When you are soldering this with a reflow oven, it is much easier to make a stencil or buy it. Otherwise you will spend a lot of time putting the solder paste on the pads. It is recommended to use a reflow oven.

Please use low temperature solder paste, because the LEDs could take damage with high temperatures. This was a hard lesson for me and resoldering of this LEDs is not a lot of fun.

How to apply solder paste on the pcbs?

Also here is a useful video from youtube: How to apply solder paste

After applying the solder paste you have to place the parts on the right place. I noticed that it is much easier to place the parts by having a layout with the part values. So I made the PCB with the values of the parts and you can download it. When a part is not clear please let me now.

LED7 = green

LED3 = green

LED4 = orange

When placing the ICs take care of the package markings! Wrong way soldered may damage your board and components!


U4 = TLV70233

IC2 = TP5400

After soldering in reflow oven, you have to solder the 4 mounting points of the micro USB port, otherwise it will break and could damage your PCB traces.

Step 5: Programming Your Board

For this step you need:

  • USBTinyISP
  • Wires and soldering iron
  • Pogo Pins (optional)
  • 3D Printed adapter for programming (optional)
  • Arduino IDE

To Programm the Atmega on the pcb, you need the USBTinyISP Programmer. It is only possible to program the micro controller with ISP Interface. There is no USB to serial converter on the pcb, so programing with the micro USB port is not possible.

On the bottom side of the pcb you can see testpads with the different markings for the ISP Interface. There are two options now, soldering wires to this pads or using pogo-pins to connect to them.

In my case I used some pogo pins because I build more than one. The adapter you can found in as a .stl file to print and get the right positions for the pogo pins.

After connecting the programmer via the ISP interface to the pcb you can start the Arduino IDE.

NOTE: The Microcontroller will not appear as a serial port in the Arduino IDE!!

Modify the settings of your board under tools:

  • Select "Arduino Nano" as your Arduino board
  • Do not select any port!
  • Change programmer to "USBtinyISP"

Have a look at the pictures.

Now you are ready to program the ATmega!

  1. Burning Bootloader
  2. Programming

First you have to burn the bootloader. This step will burn the fuses and lets the micro controller remember who it is. For this select in the Arduino IDE under "tools" -> "Burn Bootloader".

While this, the LED7 on the PCB should show a blinking behavior. After successful burning, the LED blinks with a fixed frequency. Congratulations, your board is ready.

Step 6: Assembling and Functions


When all parts are printed and the pcb is programmed successful, you can assemble the Cube. For this step you need the glue. Due to the small size it was experimenting with snap fit joints, but I had not enough time until Christmas. The decision to glue it together was fine as well.

For assembling, please have a look at the pictures. They are showing each step as well.

1.) Connect the battery with the PCB, sometimes it is easier to insert the battery first to the base.

2.) Insert the PCB into the base. The PCB fits in only in one position, so there is no possibility to put it in the wrong way. You can fix the PCB with some hot glue, than the accelerometer is working better, cause there is no rattle of the PCB.

3.) Put in the slide switch. To check if the switch is mounted correctly you can switch it on and off.

4.) Take some glue to the edge of the base, which will be inside of the Cube. Take care not to glue the slide switch. You don't need much glue.

5.) Connect the base and the Lightcube together and while the glue is drying, put something heavy on it.

6.) When the glue is dried, charge battery and enjoy :)


When the glue is dried and you can use your Cube, here are the basic functions:

  • Charging - Orange LED while charging
  • Charging - Green LED when charging is finished
  • Slide switch to turn the MagicCube on/off
  • Tap once for changing color
  • Tap twice for switch LEDs off
  • You can tap on a table or desk where the MagicCube stands on
  • Have fun
Make it Glow Contest 2018

Runner Up in the
Make it Glow Contest 2018