Home EV3 NXT 2.0 NXT 8527

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

How to build MindCub3r for LEGO MINDSTORMS EV3

Download instructions and software: (right click and "Save link as...")

1. Description

MindCub3r is a robot that can be built from a single LEGO MINDSTORMS EV3 kit (item 31313, home edition) that can solve the well known Rubik's Cube puzzle.

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

MindCub3r software consists of two main parts:

  1. a project file: MindCuber-v1p1.ev3, containing the motor and sensor control program created using the standard LEGO MINDSTORMS EV3 graphical programming environment
  2. an executable program: mc3solver-v1p1.rtf, compiled from C++ that implements an efficient solving algorithm that can find much shorter solutions than the NXT MindCuber variants
These communicate with each other via shared files on the EV3.

Note: release v1p1 uses the .rtf extension to enable the files to be downloaded using the standard LEGO MINDSTORMS EV3 software. The .rtf extension is intended to be used for files containing text so using if for the executable program is a work-around. Please do not try to open this file with a text editor.

MindCub3r uses the EV3 color sensor in RGB mode to enable it to measure colors that cannot be distingished by the standard color mode provided by the standard LEGO MINDSTORMS EV3 software. The Color Sensor RGB Block must be imported into the LEGO MINDSTORMS EV3 software to support this mode.

The Color Sensor appears to have an issue working with standard LEGO MINDSTORMS EV3 firmware version 1.03H in the RGB mode. To work around this issue, an enhanced version of the firmware has been created, 1.05M, using the source code made available by LEGO and uploaded to GitHub. Many thanks to Xander Soldaat for making this possible.

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 Install Enhanced Firmware

Disclaimer: this firmware was not created by LEGO. Installing it on your EV3 may invalidate your warranty. I accept no responsibility for any damage caused or issues arising as a result of its use. Do not use it unless you agree to these conditions.
  1. Download the firmware, EV3-Firmware-V1.05M.bin, to your computer.
  2. Start the LEGO MINDSTORMS EV3 software and select the Tools menu then Firmware Update.
  3. In the Firmware Update dialog, select Browse.
  4. Find the file EV3-Firmware-V1.05M.bin on your computer and Open it.
  5. Select EV3-Firmware-V1.05M from the Available Firmware Files and select Download. It takes several minutes for the firmware to be updated.
  6. After the firmware update is complete, turn off the EV3 brick and then turn it on again.

2.2 Install Color Sensor RGB Block

  1. Download the block, ColorSensorRGB-v1.00.ev3b, to your computer. Note that this file may be renamed to ColorSensorRGB-v1.00.zip during the download. If this happens, rename the file back to ColorSensorRGB-v1.00.ev3b
  2. Start the LEGO MINDSTORMS EV3 software and create a new, empty project.
  3. Select the Tools menu and then Block Import.
  4. In the Block Import and Export dialog, select Browse.
  5. Find the file ColorSensorRGB-v1.00.ev3b on your computer and Open it.
  6. Select ColorSensorRGB-v1.00.ev3b from Select Blocks to Import and then select Import.
  7. To complete the installation, close the dialogs and exit from LEGO MINDSTORMS EV3 software.

2.3 Download MindCub3r Program

  1. Download the file, MindCub3r-v1p1.zip, to your computer.
  2. Extract all 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 archive contains:
    • the MindCub3r-v1p1.ev3 project file with the main program
    • the mc3solver-v1p1.rtf executable program
    • an autorun.rtf script to start the executable program
  3. Start the LEGO MINDSTORMS EV3 software and select the File menu then Open Project.
  4. Find the MindCub3r-v1p1.ev3 project file and Open it.
  5. Download the MindCub3r program to the EV3 (but do not run it yet).
  6. Select the Tools menu and then Memory Browser.
  7. Select Brick (or SD Card if there is a micro-SD card in the EV3) and find and select MindCub3r-v1p1 in the Projects folder and then select Download.
  8. Find the folder on the computer where the files were extracted from MindCub3r-v1p1.zip. Select autorun.rtf and Open to download this file to the EV3.
  9. Select Download again from the Memory Browser dialog.
  10. Find the folder on the computer where the files were extracted from MindCub3r-v1p1.zip. Select mc3solver-v1p1.rtf and Open to download this program to the EV3.
    Note: if this does not work and your computer is an Apple Mac, see the troubleshooting section.
  11. Close all dialogs and then turn off the EV3 brick and then turn it on again to allow the autorun.rtf file to start the mc3solver-v1p1.rtf program. MindCub3r is now ready to use!

3. Operation

Run the MindCub3r program on the EV3 brick. The program first resets the position of the scan arm (holding the color sensor) and then the tilt arm. If the turntable starts to rotate or the two arms do not move in this order, please carefully check that cables have been connected to the correct ports on the EV3 as shown by the color coding in the build instructions. During this period, the EV3 buttons flashes red.

The program then connects to the mc3solver-v1p1.rtf program that was downloaded to the EV3. If the program is found, the EV3 makes a short beep and continues. If the solver program is not running, the buttons continues to flash red and the message "Find solver" is displayed on the EV3 screen. If this happens, please check that latest version of the firmware, v1.05M is installed on the EV3 and check the "autorun.rtf" script and "mc3solver-v1p1.rtf" program have been downloaded to the MindCub3r-v1p1 project folder on the EV3 and that the EV3 has been re-started as described here.

When MindCub3r is ready to start, the EV3 buttons turn orange and the message "Insert cube..." is displayed on the screen.

If you gently turn the turntable in each direction with your finger, it moves slightly because of "play" in the gears connecting it to the motor. If necessary, adjust the position of the motor so that there is an equal mount of play in each direction. Use the left and right buttons on the EV3 to do this. A short press nudges the motor by a small angle. Holding the button for longer moves it by larger angles more quickly.

Insert a scambled Rubik's Cube into the turntable tray and MindCub3r will start to scan and solve the cube.

MindCub3r 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, MindCub3r will stop after the third attempt and display the message "Scan error" on the EV3 display. If this happens, there may be a number of possible causes. See the troubleshooting section.

If there is a cube present before MindCub3r is ready, the buttons will stay red and the message "Remove cube..." is displayed for you to remove the cube. If this happens even when no cube is present or if MindCub3r does not start to scan the cube when it is inserted, please check that the cables to the infra red and color sensors are connected to the correct ports on the EV3 as shown in by the color coding in the build instructions.

4. Troubleshooting Tips

4.1 Scanning

If MindCub3r attempts to scan the cube 3 times and displays the message "Scan error" the following tips may help.

  1. MindCub3r is designed to work with an official Rubik's Cube branded by Rubik's. However, it should work with most cubes provided one set of stickers is white and the others are distinct colors. It is optimized to work with White, yellow, red, orange, green and blue stickers.
  2. Cubes with a white plastic body may scan less reliably that those with a black body but may work reasonably well if there are no other issues.
  3. A standard cube is about 57mm along each edge. MindCub3r will work most reliably with a cube this size although cubes that are only slightly larger or smaller may work. It has been known to solve some cubes as small as 55mm but not all.
  4. Make sure latest release of the MindCub3r software is installed including the latest enhanced firmware. Version v1p1 has some improvements in the position of the scan arm and the underlying algorithm for discriminating the colors.
  5. Check that the scan arm has been built exactly as shown in the build instructions. Small differences such as how the black 5-hole beams on either side of the scan arm are connected can alter the position of the color sensor during the scan or even jam the scan arm so it stops during the scan. In particular, if the color sensor looks as though it is over the edge of the cube or too close to the middle while scanning the corner or edge, please check the build instructions again.
  6. Make sure that the turntable is carefully aligned before inserting the cube as described here. This is required to ensure that the cube is positioned correcetly under the color sensor during the scan.
  7. Use new or well charged batteries as the reset position of the scan arm can be affected by low battery levels.
  8. Try the scan in dim lighting conditions as the color sensor can become saturated in bright lights.
  9. Try to bend the cable connecting the color sensor to the EV3 in its most natural direction (swap the two ends if necessary) and through the clip at the bottom of the scan arm to minimize any force that the cable applies to the position of the color sensor during the scan.
If this does not help, please upload a video showing a failing scan with close up views of the scan arm from different angles and the position of the color sensor over the cube as the scan arm moves and post a link on the MindCuber Facebook page and I will try to help.

4.2 Mac Download

There appears to be an issue with the Mac version of the LEGO MINDSTORMS EV3 software that prevents it from downloading large files to the EV3 via the Memory Browser. This issue has been reported to LEGO so hopefully it will be resolved in future releases.

If you have a micro-SD card, you can download the autorun.rtf and mc3solver-v1p1.rtf program to the EV3 by following these steps:

  1. Update the firmware to 1.05M as described on the web page
  2. Turn off the EV3 and insert the micro-SD card
  3. Turn on the EV3
  4. Download the MindCub3r graphical program as described on the web page. This will create a folder on the micro-SD card called MindCub3r-v1p1
  5. Then turn off the EV3 and take out the micro-SD card
  6. Copy the autorun.rtf and mc3solver-v1p1.rtf files into the folder MindCub3r-v1p1 on the micro-SD card using your Mac or other device. You may need an adapter of some kind for the micro-SD card to do this.
  7. Put the micro-SD card back into the EV3 and turn it on again.
The MindCub3r should then run normally.

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 David Gilday

LEGO and MINDSTORMS 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