ayoola-babatunde / lego-nxt-cube-solver

Robot to solve a rubik's cube built with Mindstorms NXT and python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lego-nxt-cube-solver

Final Solve

Design

I designed the machine in Bricklink Studio and built/programmed it over the course of three months in Summer 2022. I wanted to make a 6-axis robot but did not have time to add Lego colour sensors, so I used the webcam to take photos of the sides and a logistic regression model to analyze the cube state.

Design in Studio


Features

  • Webcam scanner to automatically detect the colours of cube given pictures of the sides, regardless of lighting conditions. After experimenting with neural networks and colour ranges, I trained a robust logistic regression on cubes in varying environments to identify the cube state (96% accuracy).

    Scanning green side
  • Kociemba algorithm to find the quickest solution, given a cube state. Average of 19 moves per solution.

  • Accurate-ish turning of the sides to excecute the solution. This was a challenge because turning over bluetooth instead of usb is way less accurate. There is also no official framework to control Mindstorms NXT from Python. I hot-glued a round brick to the center piece of the cube to enable turning.

    Gluing the center to lego piece All glued centers

Notes

My main inspiration was SquidCuber. I got help from:

The Studio model can be found on Bricklink here.

I made a YouTube video.

About

Robot to solve a rubik's cube built with Mindstorms NXT and python

License:GNU General Public License v3.0


Languages

Language:Python 100.0%