Solving Rubik’s Cube With An FPGA

For their final project for ECE 5760 at Cornell, [Alex], [Sungjoon], and [Rameez] are solving Rubik’s Cubes. They’re doing it with an FPGA, with homebrew robot arms to twist and turn a rainbow cube into the correct position.

First, the mechanical portion of the build. The team are using a system of three robot arms positioned on the left, right, and back faces of the cube relative to a camera. When a cube is placed in the jaws of this robot, the NTSC camera data is fed into an FPGA, where a Nios II soft core handles the actual detection of the cube faces, the solver algorithm, and the controller to send servo commands to the robot arms.

The algorithm used for solving the cube is CFOP – solve the white cross, the white corners, the middle layer, the top face, and finally the entire cube. In practice, the robot ended up taking between 60-70 moves. This is not the most efficient algorithm; the Thistethwaite algorithm only requires 52 moves. There’s a reason for this apparent inefficiency – the Thistlethwaite algorithm requires large look-up tables.

Once the cube is scanned and the correct moves are computed, the soft core in sends commands out through the FPGA’s GPIO pins. Each cube can be solved in under three minutes after it has been scanned, but the team ran into problems with scanning accuracy. It’s a problem that can be fixed with the right lighting setup and better aberrant cubie detection, and a great final project using FPGAs.

Video demo below.

17 thoughts on “Solving Rubik’s Cube With An FPGA

  1. I got all excited when I saw this thinking that the solving logic was done in HDL/FPGA. But no just a boring soft core using an everyday algorithm.

    The rubic cube is a state machine so it would be great to see HDL that emulates that state machine directly in logic ie no CPU or tables. It would give the shortest and most direct or ‘exact’ solution. ie If you made 7 moves to mix it up then it would solve by reversing those seven moves without knowing what they were.

    Well I will just have to learn HDL and do it myself.

    1. I think some calculations done on supercomputers concluded that without knowing the mixing movements for the cube the best number of movements one can expect to use in order to solve it would be 20 or something.

      1. Thanks! Not wanting to troll, wanting to learn. I thought in my head “A fire extinguisher… or An fire extinguisher.” without thinking that saying the letter is actually different than using it in a sentence. Thanks for helping me learn a new thing today.

    1. Holy hell. I was trolling the grammar nazis with, “The team are…” in this post. You chose, “an FPGA”??? What is wrong with you?

      //man hackaday’s really gone downhill the people complaining about the grammar can’t even get it right anymore.

      1. I’d say “the team are”, since I see it as being a team of people. Like a gaggle of geese or whatever. Maybe those bigshots in Dictionary Town would disagree, but I’ve been getting sicka their crap recently.

      2. Well “an FPGA” is technically correct. Abbreviations are handled phonetically rather than literally. God this language is awful why couldn’t we get the Russians to invade. Their language isn’t broken like ours.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.