MindCuber.com 

Home Robot Inventor SPIKE EV3 NXT 2.0 NXT 8527

Build your own LEGO® MINDSTORMS® Robot Inventor robot to solve the Rubik's Cube®...

How to build MindCuber-RI for LEGO MINDSTORMS Robot Inventor



Download instructions and software: (right click and "Save link as...")
  • Building instructions v1p0 (set 51515): download

  • MINDSTORMS Robot Inventor Program: see here


1. Description

MindCuber-RI is a robot that can be built from a single LEGO MINDSTORMS Robot Inventor set (51515) to solve the well known Rubik's Cube puzzle.

MindCuber-RI software version v1p0 should work with any version of the LEGO MINDSTORMS Robot Inventor software. However, it is recommended that the MINDSTORMS Robot Inventor software is always updated to the latest version released by LEGO.

Construct the robot by carefully following the build instructions and then follow the instructions in the next section to download and install the software described below.

MindCuber-RI software consists of four projects. The second is optional and may be omitted or downloaded later:

  1. A python project, MCRISolver-v1p0, that contains three python modules and a data file:

    • python classes for discriminating colors: mcricolors_v1p0.py
    • python classes for mapping pieces on a Rubik's Cube: mcrimaps_v1p0.py
    • python classes for solving a Rubik's Cube: mcrisolver_v1p0.py
    • small lookup tables used by mcrisolver_v1p0: mcrimtab1_v1p0.bin

    With these components, MindCuber-RI will solve the Rubik's Cube in an average of about 42 moves.

  2. An optional python project, MCRIMTab4-v1p0, that contains a large data file:

    • large lookup tables for mcrisolver_v1p0: mcrimtab4_v1p0.bin

    With this large lookup table installed, MindCuber-RI will solve the Rubik's Cube more quickly in an average of about 31 moves.

    NOTE: This program takes a long time (around 30 minutes) to download and install on the Robot Inventor hub so it may be desirable to just use the small tables initially to get MindCuber-RI working.

  3. A python project, MCRIInstall-v1p0, that installs any MindCuber-RI files, from the MCRISolver-v1p0 and MCRIMTab4-v1p0 projects, that have been downladed to other slots on the Robot Inventor hub.

  4. The main python program, MindCuber-RI-v1p0, that uses the modules and data files installed by the previos projects to control the MindCuber-RI mechanism and solve the Rubik's Cube.

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 MindCuber-RI 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...

    On a Mac computer, locate the file in the Finder and double-click on it to extract the contents.

    This creates a folder, MindCuber-RI-v1p0, containing:

    • MCRISolver-v1p0.lms
    • MCRIMTab4-v1p0.lms
    • MCRIInstall-v1p0.lms
    • MindCuber-RI-v1p0.lms

  3. Start the LEGO MINDSTORMS Robot Inventor software and select the File menu then Open....

  4. Find the MCRISolver-v1p0.lms project file and Open it.

  5. Connect to the Robot Inventor 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 MCRISolver-v1p0 program in an unused slot, e.g. 19, on the Robot Inventor hub.

    NOTE: This program may take up to a minute to download so please be patient. The LEGO MINDSTORMS Robot Inventor software stops showing progress after a few seconds even though the download continues.

    NOTE: Owing to limitations of the current version of the LEGO MINDSTORMS Robot Inventor software, running this program will result in a python SyntaxError. This is deliberate and should be ignored.

    Once downloaded, the MCRISolver-v1p0 program should be left on the hub until the installation has been completed in the following steps.

  8. Optionally you may download the MCRIMTab4-v1p0 program to allow MindCuber-RI to solve the cube more quickly. See Faster Solution for details.
  9. Select the File menu then Open... as step 3. Then find the MCRIInstall-v1p0.lms project file and Open it.

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

  11. Download and Run the MCRIInstall-v1p0 program in an unused slot on the Robot Inventor hub. Do not overwrite MCRISolver-v1p0 in slot 19 (or MCRIMTab4-v1p0 in slot 18).

    The hub LED display shows progress:

    And the console shows download information:

    This installs mcricolors_v1p0.py, mcrimaps_v1p0.py, mcrisolver_v1p0.py and mcrimtab1_v1p0.bin on the hub for use by the main program.

    The hub will restart when the installation has finished. If the hub was not connected via a USB cable, it may turn off and be necessary to turn it back on manually. If the hub was connected via Bluetooth it may be necessary to re-connect.

    NOTE: The LEGO MINDSTORMS Robot Inventor software may indicate that "The hub OS needs to be updated" when it is not necessary. If this happens, do not press the UPDATE button as this will delete the programs that have just been installed. Instead, power off the hub and if the hub is connected via a USB cable, disconnect the cable.

    Wait for the "Update hub" dialog to disappear. Then turn the hub back on and re-connect the USB cable if one was being used.

  12. MCRISolver-v1p0 (optionally MCRIMTab4-v1p0) and MCRIInstall-v1p0 may now be removed from the hub to free the space and slots for other programs.

    Open the connection to the Robot Inventor hub.

    Then open Programs the view all the programs on the hub.

    If necessary, scroll down to see all slots. Then delete the programs used in previous steps.

  13. Select the File menu then Open... as step 3. Then find the MindCuber-RI-v1p0.lms project file and Open it.

  14. Download and Run the MindCuber-RI-v1p0 program in an unused slot on the Robot Inventor hub.

MindCuber-RI is now ready to solve a Rubik's Cube!

3. Operation

  1. Run the MindCuber-RI program, if it is not already running, using the buttons on the MINDSTORMS Robot Inventor 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 MindCuber-RI will start to scan and solve the cube.

    MindCuber-RI 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, MindCuber-RI will stop after the third attempt with the middle buttont colored orange. If this happens, there may be a number of possible causes. See the troubleshooting section.

4. Faster Solution

The method used to calculate a solution for the cube is based on some pre-calculated lookup tables containintg sequences of moves that solve groups of pieces in stages. The default, small tables included in the MCRISolver-v1p0 download result in solutions averaging about 42 moves. By using a larger set of lookup tables with more entries, shorter solutions can be caltulated with an average only about 31 moves. With fewer moves, the overall time to solve the cube is reduced. These large tables are contained in the MCRIMTab4-v1p0.lms project and can be downloaded in the same way as those in MCRISolver-v1p0.

  1. Select the File menu then Open... as before. Then find the MCRIMTab4-v1p0.lms project file and Open it.

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

  3. Download and Run the MCRIMTab4-v1p0 program in an unused slot, e.g. 18, on the Robot Inventor hub.

    NOTE: This large program will take a long time (around 30 minutes) to download so please be patient. The LEGO MINDSTORMS Robot Inventor software stops showing progress after a few seconds even though the download continues.

    If the connection to the hub is via Bluetooth then please attach the hub to a USB charger to ensure it does not time out and shutdown during the download.

    A message will appear in the Console when the download is complete.

    NOTE: Owing to limitations of the current version of the LEGO MINDSTORMS Robot Inventor software, running this program will result in a python SyntaxError. This is deliberate and should be ignored.

    Once downloaded, the MCRIMTab4-v1p0 program should be left on the hub until the installation has been completed.

  4. Continue, or repeat from 2.1 Download MindCuber-RI Program, step 9 to complete the installation.

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/RoboticSolutions and youtube.com/IAssemble

Copyright © 2013-2021 Mike Dobson and David Gilday

LEGO and MINDSTORMS are trademarks of the LEGO Group
Rubik's Cube is a trademark of Rubiks Brand Limited

Disclaimer: thoughts and opinions expressed here are my own