Tilted Twister - Old version

    LEGO Mindstorms NXT 1.0 (8527).


    Getting started

      Read all of this page.

      Run the calibration program.

      Run the tiltedtwister program. You should use an unscrambled cube the first time you run the program. The program should calculate a solution of zero moves. If not, abort the program and adjust what needs to be adjusted.

      Scramble the cube and let Tilted Twister solve it.


      Building instructions


      Cut out a piece of thin cardboard 70 x 70 mm and cut out the corners 8 x 15 mm.
      Place it on the turntable so that the cube rests on a flat surface. It's important that the cube slides easily on the surface when tilted.

      Connect the wiring as follows:
      1 - Touch sensor
      2 - Light sensor or HiTechnic color sensor
      3 - Ultrasonic sensor
      A - Turntable motor
      B - Tilter arm motor
      C - Light/color sensor motor


      Rubik's cube

      Unfortunately the yellow and the white colors of a standard Rubik's cube gives the same readings from the light sensor.
      If you don't have a color sensor you have to replace some of the colors of the cube. Cubesmith.com has replacement stickers in all sorts of colors.
      On my cube, I have replaced yellow with flourescent yellow, blue with light blue and orange with gold mylar, I have also replaced the white rubik's cube logo sticker with a plain white sticker.
      You could try using other colors as long as the light sensor readings differentiates.
      Use the colortest program to try out different colors. Use the cube tester program to verify a cube.



      The position of the light/color sensor is crucial. If it's too close to the cube's surface the readings may be inaccurate. It is possible to adjust the height position of the sensor by gently bending up the sensor arm. It should be approx 3mm above the top of the cube.

      The gap of the grabber must not be too tight around the cube. Otherwise it will drag the cube back with it.

      If your cube is stiff, you could lubricate it with silicone spray. After lubrication you must work the cube for a few minutes.

      Make sure the turntable is aligned before starting the program.

      Make sure the tilter arm is fully retracted before starting the program.

      Avoid having a strong light source right above the robot.



      Before you let the robot solve a scrambled cube you should calibrate it. The calibrate program calibrates the position of the scanner arm. Run the calibrate program and read the instructions on the NXT-display. When the program asks you to position the sensor above center of cube, you should turn it so that the emitting light hits the center piece of the top of the cube. Tip: Dim the lights of the room to better see where the light from the sensor hits the cube.


      Cube tester

      Run this program to check if the colors of a cube can be sorted out using the light sensor.
      Place an unscrambled cube on the turntable. The robot scans the faces of the cube. It then displays the minimum and maximum light sensor values of the colors for each cube face and tells whether the cube is qualified or not.
      If the color ranges overlaps the program says the cube is not OK. But if the overlap is small it might work anyway because of the color resolve algorithm of the tiltedtwister program.


      Color tester

      This program shows the current light sensor value. Use it to try out your own set of colors.


      Downloading programs to the brick


      Unzip the download-zip to a new directory.

      The files with extension .rxe are executables which should be downloadable to the brick using the lego mindstorms software:
      - Create a new project (File/New)
      - Press the button "NXT window"
      - Select the Memory tab
      - Press the download button

      The files with extension .rso are sound files and should be downloadable the same way as rxe-files.

      The size of the tiltedtwister program is quite big. If you are having problems when downloading tiltedtwister.rxe try the following:
      - Delete other program files and sound files etc to make room.
      - Update the NXT Firmware. I'm using NXT Firmware 1.05 on my brick. You can download and install firmware from the LEGO Mindstorms NXT software.
      - Defragment the NXT filesystem. (Bricx Command Center/NXT Explorer/Defragment)


      Source code

      The files with extension .nxc can be edited and compiled using BricxCC (http://bricxcc.sourceforge.net).



      Watch the NXT-display as it scans the faces. When using the light sensor it displays the light value of.

      When it has scanned all the faces it resolves the colors. The screen says "Resolving colors".

      Then it calculates three solutions.
      For each solution it makes a ticking sound with increasing pitch. This should take some ten seconds.

      After that it starts executing the solution showing the number of remaining twists on the display.

      If it fails reading the colors, one of the following things will happen:
      - When calculating a solution it never stops. It keeps ticking with higher and higher pitch.
      - It stops ticking and nothing happens.
      - It manages to calculate a solution. But it's not the correct solution because it has resolved the colors incorrectly.