_\~ /\ |\| |) /? () |\/| /\ /= /= | () |) ()
/homepage /list +normal

Contact: yt tw fb in mail git


Posts: [all] terminal ebook epub arduino esp8266 espvgax vgax game javascript php scifi obfuscated ioccc piano music book youtube curl

Arduino Rubik Server

rubik-1

This was my first Arduino project: A webserver inside a Rubik's cube (2x2x2 Pocket Cube version) able to solve a Rubik's Cube 3x3x3 with the Layer-by-Layer method. It is fast! Can solve any scramble in around 100msec, using only 2048 bytes of RAM (ATMEGA328 MCU)!

Coding

I am a Rubik's Cube fan. I learned how to solve the 3x3x3 standard Rubik's Cube by following this guide. But i does not follow all raccomandations and learned to solve it creating a first RED CROSS instead of WHITE CROSS.

As a programmer i have developed a simple solver in Javascript that can solve the 3x3x3 cube by using the Layer by Layer method, starting from the RED CROSS. The project was developed using Javascript, HTML5, Canvas and WebGL.

Here you can find the Smaffer 3D Cube project homepage.

After that, for the IOCCC Contest, i have ported the Javascript solver to C with some obfuscations to follow the rules of the contest.

As an Arduino fan i have also ported the obfuscated code to C++, optimizing it to use the lower amount of RAM possible, without rewriting all the code. The source code is not simple to understand.. its obfuscated.. but it works. Can solve a 3x3x3 using a standard scramble sequence.

Hardware time

The hardware required to create this project is this:

rubik-2

I have used the ENC28j60 breakout board to connect the Arduino ATMEGA328 MCU to Ethernet. The cube parts are from a broken 2x2x2 Pocket Cube given to me by EFFEOTTO (thanks!).

Running page

The Arduino WebServer hosted by the MCU has a simple NERDY style:

rubik-3

You can send the scramble sequence inside the HTTP URL. The returned page will contains the scrambled 3x3x3 cube and the list of moves to solve it.

Solving modes

The sourcecode can solve the cube in two modes: with cube rotations moves (X, Y, Z) or without rotations (in place solving). The second mode can be used, theoretically, to solve the cube phisically, using hardware motors, without full rotations of the cube (the cube stay always in the same original orientation).

Wiring mess

This was my first Arduino project and this fact can be seen in the internal hardware soldering and wiring. But the final cube works and i think that the idea is fun and so nerdy! :-P

rubik-6

rubik-5

rubik-4

Problems

The big problem with this project, after some tests, is the battery. The idea to power up the cube using a 9V battery is not happy. The power consumption of the Ethernet connection is very high and the cube, powered with a fully charged 9V battery, cannot stay ON more than a couple of hours :-/

Future and Download

In the future, i will do a porting of this project to ESP8266, powered by a microUSB connector.

That's IT!

Here you can download the Arduino Sketch sourcecode. It is a porting of an obfuscated program so it is not simple to understand at all.. :-/

Happy hacking