DD: Android Things Rubik’s Cube Solver (1)

Some days ago I decided to create a Rubik’s Cube Robot Solver using Android Things.

This is not a new project, many people has made Rubik’s cube solvers with PCs, Lego, Arduino, etc. But apparently there has not been one done on Android Things yet.

To my surprise, many people asked me to document the journey, so here we are, doing a Developer Diary of ATRUCUSO (Temporary name).

The first step was to decide on the shape of the robot. After looking at different ideas online, I decided to go for one that has 2 claws at 90 degrees, similar to this one:

Image result for rubiks cube robot

Next step was to order some pieces. I found robot claws with 2 servos on AliExpress for a reasonable price (about 20 euros for 2 claws and 4 servos) but the problem is that they are too small, they are 55 cm when fully open, which is the size of a standard Rubik’s cube, so I had to buy a mini cube as well.

In addition to those, given that the Android Things Developer Kits only have 2 PWM outputs, I will need a PWM expander, but I already have a few of those at home :).

The claws look like this (proper photo upon arrival)

Image result for robot claw aliexpressGiven that it will take about a month until they arrive, I have to start thinking about the other areas.

The first architecture decision is to separate the project in 3 areas that are independent:

  • Reader: Which will be a camera and some sort of color detection.
  • Solver: I am planning on having more than one of those, but the initial one will use some variant of the advanced Fridritch (CFOP) method.
  • Manipulator: This is the interface with the cube. It will include the moves to be performed as well as allow for cube rotations.

Some interesting notes:

  • The cube manipulator will implement the same interface as the internal representation of the cube for the solver, but the solver will have just an internal object that represents the cube (discussion about data structures on a follow up post)
  • This separation will allow for intermediate steps along the way, such a cube scrambler, or a robot controller via Android Things with all the options.
  • The selection of the 2 claws model makes some moves much simpler than others, so I will probably be looking at algorithms specialized for one-hand solving based on U, U’ 2U, R, R’ and 2R movements.

And that’s it for now. I might start tinkering with the data structure for the cube while I wait for the parts to arrive.

TBC.