Home SPIKE EV3 NXT 2.0 NXT 8527

Build your own LEGO® Education SPIKE™ Prime robot to solve the Rubik's Cube®...

How to build PrimeCuber for LEGO Education SPIKE Prime

Download instructions and software: (right click and "Save link as...")
  • Building instructions v1.0 (Education set 45678): download

  • SPIKE Prime Program: see here

1. Description

PrimeCuber is a robot that can be built from a single LEGO Education SPIKE Prime set (45678) to solve the well known Rubik's Cube puzzle.

All PrimeCuber software releases should work with LEGO Education SPIKE Prime firmware versions from Hub OS: 1.1.134 onwards. It is recommended that the Prime firmware is always updated to the latest version released from LEGO.

Construct the robot by carefully following the build instructions and then download and install the software described below.

PrimeCuber software consists of three components of which the third is optional and can be omitted or downloaded later:

  1. A python project, PCSolver-v1p3, that contains two python modules and a data file:

    • the main robot control python program: primecuber_v1p3.py
    • python classes for solving a Rubik's Cube: pcsolver_v1p3.py
    • small lookup tables used by pcsolver_v1p3: pcmtab1_v1p3.bin

    Executing this program on the Spike hub will install the modules and data. After this, the PCSolver-v1p3 program may be overwritten or removed from the hub.

  2. The main python program, PrimeCuber_v1p3, that uses the modules and data file installed by PCSolver_v1p3 to control the PrimeCuber mechanism and solve the Rubik's Cube. This program can be downloaded to any of the slots on the SPIKE hub and used to solve the puzzle at any time.

    With these two components, PrimeCuber will solve the Rubik's Cube in an average of about 42 moves.

  3. There is a third python project, PCMTab4-v1p3, that contains a large data file:

    • large lookup tables for pcsolver_v1p3: pcmtab4_v1p3.bin

    NOTE: This program takes a long time (around 30 minutes) to download and run on the SPIKE hub so please be patient and do not interrupt the process. It only needs to be run once to install the large lookup tables on the hub.

    Once installed, PrimeCuber will then solve the Rubik's Cube more quickly in an average of about 31 moves.

2. Software

Note: to use the Download links below: Select one of the following from the pop-up menu: Then choose a folder on your computer in which to save the file.

2.1 Download PrimeCuber Program

  1. Download the file to your computer:

  2. Extract the files from this archive.

    On a computer running Windows, find the file in Windows Explorer, click with the right mouse button and select Extract all...

    This creates a folder, PrimeCuber-v1p3, containing:

    • PCSolver-v1p3.llsp
    • PrimeCuber-v1p3.llsp
    • PCMTab4-v1p3.llsp

  3. Start the LEGO Education SPIKE Prime software and select the File menu then Open File.

  4. Find the PCSolver-v1p3.llsp project file and Open it.

  5. Connect to the SPIKE hub using either a USB cable or via bluetooth.

  6. Expand the Console to see progress information about the software installation during the next step.

  7. Download and Run the PCSolver-v1p3 program in an unused slot on the SPIKE hub.

    The hub LED display shows progress:

    And the console shows download information:

    This installs primecuber_v1p3.py, pcsolver_v1p3.py and pcsolver_v1p3 on the hub for use by the main program.

    The slot used to download and run the PCSolver-v1p3 may now be re-used for other programs.

  8. Select the File menu then Open File as step 3. Then find the PrimeCuber-v1p3.llsp project file and Open it.

  9. Download and Run the PrimeCuber-v1p3 program in an unused slot on the SPIKE hub. This can be the same slot as used in the previous steps to download and run the PCSolver-v1p3 program.

PrimeCuber is now ready to solve a Rubik's Cube!

3. Operation

  1. Run the PrimeCuber program if it is not already running, using the buttons on the SPIKE Prime hub. Press the right button to select the slot number to which the program was downloaded. Then press the center button to run the program.

  2. Gently use your finger to rotate the turntable in each direction to determine if it is aligned. It moves slightly because of "play" in the gears connecting it to the motor. There should be an equal amount of movement in each direction. If necessary, use the left and right buttons on the hub to adjust the position of the motor position. Each press nudges the motor by a small angle.

  3. Insert a scrambled Rubik's Cube into the turntable tray and PrimeCuber will start to scan and solve the cube.

    PrimeCuber may scan the cube up to three times if it is unable to determine the colors at first. If the scanned colors do not result in a valid pattern, PrimeCuber will stop after the third attempt and display ????????? If this happens, there may be a number of possible causes. See the troubleshooting section.

4. Faster Solution

Under development...

5. Troubleshooting Tips

5.1 General

Under development...

Please post a comment or message on the MindCuber Facebook page for help.

5.2 Tilting

Under development...

5.3 Scanning

Under development...

Like MindCuber on Facebook to share your experiences and help each other with troubleshooting.


See more LEGO robot Rubik's Cube solvers at youtube.com/IAssemble and youtube.com/ARMflix

Copyright © 2013-2020 David Gilday

LEGO and SPIKE are trademarks of the LEGO Group
Rubik's Cube is a trademark of Seven Towns Limited

Disclaimer: thoughts and opinions expressed here are my own