Six Sided PCB LED Dice With WIFI & Gyroscope - PIKOCUBE

21,110

208

35

Introduction: Six Sided PCB LED Dice With WIFI & Gyroscope - PIKOCUBE

About: Hey! I'm a maker and an electrical engineering student from germany

Hello makers, it's maker moekoe!

Today I wanna show you how to build a real LED dice based on six PCBs and 54 LEDs in total. Next to its inner gyroscopic sensor which can detect movement and dice position, the cube comes with an ESP8285-01F which is the smallest WiFi MCU I know so far. The MCU dimensions are just 10 by 12 millimeters. Every single PCB has dimensions of 25 by 25 millimeters and contains nine WS2812-2020 mini LED pixel. Next to the controller there is a 150mAh Lipo battery and a charging circuit inside the dice. But more on this later...

If you are searching for an even smaller cube, then check out the first version which I have created on my website. It is casted in epoxy resin!

Pikocube version 1

Step 1: Get Inspired!

Enjoy the video!

You will find nearly everything for the cube in this video. For some further informations, design, PCB and code files you can check out the following steps.

Step 2: PCB Design!

As you might know, my favorite PCB design software is Autodesk EAGLE. That's why I have used it for this project as well.

I've started using two different PCB designs, because I don't want to make the cube bigger than it has to. The outer shapes of both PCBs are just squares of 25x25 millimeters. The special thing of these PCBs are the three castellated holes on each side which distribute the three signals +5V, GND and the LED signal all over the cube. The order of the PCBs is shown in one of the schematics above. Hope you can imagine, the colored sides belong together once the cube is folded as a cube. The arrows are marking the WS2812 signal line.

The schematics, boards and the BOMs of both PCBs are attached to this step.

Step 3: PCBs and Components!

The whole cube consists out of two different types of PCBs. The first one comes with the charging circuit and the Lipo battery jack and the second one contains the MCU, the sensor and some power latching circuit. Of course the PCBs have only be equipped once each. All the rest just containing the nine LEDs on the outside of the cube.

The PCBs special thing are the castellated holes on every side. On the one hand these holes/solder pads are used to get the cube looking like a cube and holding everything in place and on the other hand it transmits both the power for the LEDs and the WS2812 signal. Latter is more complicated because it has to be in a specific order. Every PCB has exactly one input and one output signal only and in order to interrupt one signal at a point, I added a few SMD soldering jumper pads.

Parts you will need for the MCU board:

Parts you will need for the power board:

Step 4: Assembling the Cube!

For all the details of assembling the cube you should refer to the video above.

Assembling the cube isn't the easiest part, but for making it a bit more easy I have designed a small soldering aid where at least three of the six PCBs can be soldered together. Doing it two times you will get two PCB edges which have to be connected once everything is working. Yes, make sure everything is doing. I haven't test it so far, but unsoldering one PCB out of the cube could be difficult.

Make sure to solder three PCBs together before you attach the battery jack. Otherwise you have to modify the .stl file with a small hole where the jack fits in.

Step 5: Arduino Code!

The cube will start with a disabled WiFi to save some power, which is called modem sleep. Regarding to the ESPs datasheet, the MCU takes only 15mA while in modem sleep, whereas it needs around 70mA in normal mode. Good for battery powered devices like this one. To achieve this you will need the following code part before calling the setup function.

void preinit() {
	ESP8266WiFiClass::preinitWiFiOff();
}

With another button press you can wake up the WiFi by calling the standard WiFi.begin() function or in this case the Blynk.begin() which is the setup call for the APP which I have chosen to control the cube.

Converting some animations to the cube is only a little bit of math. The matrix conversion to a pixel on a specific outer wall is done with this simple helper function:

int get_pixel(int mat, int px, int py) {
	//starting at top left corner
	return (px + py * 3) + mat * 9;
}

Referring to the PCB pixel overview in step 2, the first matrix is the top one, the second is the front facing one, next ones are around the cube going into the right direction and the last matrix is the bottom one.

When using the attached code, you have to edit the WiFi credentials to match your network. For correct use with the Blynk APP, make sure to put both the files (BLYNK.ino and the other one with Blynk in it) into the same folder before opening the sketch. The sketch contains of two different tabs. The other file, which does actually nothing, don't need to be equipped with another tab. It is just for making the cube sleep when the button wasn't pressed. Otherwise the cube won't get into sleep and will draw current all the time.

Step 6: The APP!

As already told, the cube starts with a single button press. But it won't start with the WiFi functionality at all. Another single press while the cube is already on will start WiFi and connects to a predefined network. Aftwards you can use the BlynkAPP to control the cube. Of course you can extend the functionality, there are plenty of possibilities for this thing...

A simple example layout inside the Blynk APP is shown here. It consists of two SLIDER (brightness and animation speed), two STYLED BUTTON (change animation pattern and switching the cube off), one STEP for changing cube mode, an LED for showing which dice side is up and last but not least a GAUGE for showing the battery status. All of these widgets make use of the virtual pins for APP-MCU communication. Something to read the virtual pins via the MCU is to call this function, whereas V1 is referring to the used virtual pin and param.asInt() holds the current value of the pin. The constrain function is just for limiting the incoming values (safety first :D).

BLYNK_WRITE(V1) { 
	//StepH  t = millis();
	current_mode = constrain(param.asInt(), 0, n_modes - 1);
}

To write a virtual pin to the Blynk APP you can use the following function:

int data = getBatteryVoltage();
Blynk.virtualWrite(V2, data);

You will get more info to this inside the Arduino sketch!

Step 7: Have Fun!

Designing and building the cube was a lot of fun for me! Nevertheless I have had some problems with it. First one is that I wanted to use a boost converter circuit inside the first version of the cube to ensure the WS2812 LEDs will run at 5V. Luckily they will run at Lipo voltage of around 3,7V as well, because the boost converter was far too noisy and disturbs the LED signal which results in an unintended blinky cube.

Second huge problem is that I wanted to use wireless charging possibility, even for the second version. Luckily I have added some charging pads which are accessible from the outside of the cube because the inductive power gets disturbed through the GND planes of the PCB and the components. Therefore I have to create a 3D printed charging stand, so that the cube can be put in and some contacts get pressed to the cube.

Hope that you enjoyed reading this instructable and may found a way to build your own cube!

Feel free to check out my Instagram, Website and Youtube channel for more informations about the cube and other awesome projects!

If you have questions or something is missing then please let me know in the comments below!

Have fun creating! :)

PCB Design Challenge

First Prize in the
PCB Design Challenge

Be the First to Share

    Recommendations

    • Summer Fun: Student Design Challenge

      Summer Fun: Student Design Challenge
    • Stone, Concrete, Cement Challenge

      Stone, Concrete, Cement Challenge
    • DIY Summer Camp Contest

      DIY Summer Camp Contest

    35 Comments

    0
    coldfire0101
    coldfire0101

    7 days ago

    anyone know how to turn this into vibration sensative??

    0
    Reflective-Dimensions
    Reflective-Dimensions

    Question 6 months ago

    Hi, I'm COMPLETELY NEW AND KNOW ZERO about how to go about what needs to be sent and where to send it in regards to the PCBs to be printed for this project. I have only ordered from links directly to fabricator from designer before. Could you please help me? Thank You.

    0
    Reflective-Dimensions
    Reflective-Dimensions

    Answer 5 months ago

    Figured it out... Sent brd. files to OSH PARK to be manufactured. You get three of each board @around $5.00 for each set of three. So you would be good with one set of MCU board file and two sets of POW board as long as you plan on just one die.

    0
    ValeriP4
    ValeriP4

    6 months ago

    Дорогой друг . с Новым Годом . Вы можете прислать мне файлы печатной платы для отправки в компанию. https://www.pcbway.com .
    my email valtim68@mail.ru

    2
    TrueFrizoid
    TrueFrizoid

    Question 6 months ago

    In the picture there is a jumper between IO13 and IO16 of the ESP8285-01F WiFi MCU, the schematic does not show this connection. Is it needed?

    0
    James Hauser
    James Hauser

    Question 1 year ago

    I order regular boards with extended edges. After I cut and sand the four sides I will have the "castellated" holes.

    0
    dorcu
    dorcu

    Question 1 year ago

    Hi. Thank you very much for sharing the project. I tell you that PCBs, having external middle holes, manufacturing companies raise the price a lot. For this reason I would like to know if there is any way to change the design. to make them whole holes. Thank you.

    1
    Gonza88
    Gonza88

    Answer 1 year ago

    Same problem here. 25 + 5 PCB pieces cost 7$ in JLCPCB (without shipping). But metallized half-holes cost 38$ extra for each PCB design. I decide to make PCB's without metallized half-holes, I'll make a connections between layers with thin rest of resistors legs.

    0
    dorcu
    dorcu

    Reply 1 year ago

    Have you modified the PCB to not use half holes? Can you share the design? I'm interested.

    0
    Gonza88
    Gonza88

    Reply 1 year ago

    No, I haven't changed anything. This is my first order in a professional PCB factory. JLCPCB support sent me an email about how these half holes should be, plated or non-plated. I chose non-plated. Now PCB's are in production. When order arrive, I'll make photos of them.

    0
    dorcu
    dorcu

    Reply 1 year ago

    Can you explain that to me? I'm interested! Thank you

    0
    Gonza88
    Gonza88

    Reply 1 year ago

    I explain this, when the PCB's arrive (and will be OK), so please be patient :)

    0
    dorcu
    dorcu

    Reply 1 year ago

    Ok. Thanks!

    0
    Gonza88
    Gonza88

    Reply 1 year ago

    Now I see I made mistake with PCBs order, for each cube I need 2 MCU and 4 POW boards, not 1 MCU and 5 POW :/

    1
    TrueFrizoid
    TrueFrizoid

    Question 1 year ago

    I couldn't find SDM 0603 resistors 600, 5K and 190K. Are you sure it's that nominal?
    The diagram shows the MCP1703CB and the text is MCP1700. How is it correct?

    0
    Gonza88
    Gonza88

    Answer 1 year ago

    You can use more popular resistors: 680 and 5,1k, this is not critical values (600 is for LED, 5k are pullup resistors). It will be OK with near values. 190k resistor is in ADC circuit (battery voltage measurement) so should be exactly the same.
    You can use MCP1700-3302 or MCP1703-3302 (in SOT23-3 package), this is voltage regulator and he must provide 3,3V, both are OK.

    0
    TrueFrizoid
    TrueFrizoid

    Reply 1 year ago

    How do you charge the battery? What voltage do you apply? How long do you recharge?

    0
    Gonza88
    Gonza88

    Reply 1 year ago

    I don't have my own cube. Currently I'm waiting for PCB's and parts.
    Charging is possibble by the two points on the PCB (which contains MCP73831 on the bottom layer), named V_CH+ and V_CH- (look at first picture in step 3). Charging voltage should not exceed 6V (max working voltage for MCP73831), 5V will be good.

    0
    codebeat
    codebeat

    1 year ago

    Nuts! And that is a compliment.