









Before any build log, here's a video:





The machine can definitely go faster, but the tuning process is really time consuming since debugging needs to be done with the high speed camera, and mistakes often break the cube or blow up FETs. Looking at the high-speed video, each 90 degree move takes ~10 ms, but the machine is actually only doing a move every ~15 ms. For the time being, Jared and I have both lost interest in playing the tuning game, but we might come back to it eventually and shave off another 100 ms or so. That was a Rubik's cube being solved in 0.38 seconds. The time is from the moment the keypress is registered on the computer, to when the last face is flipped. It includes image capture and computation time, as well as actually moving the cube. The motion time is ~335 ms, and the remaining time image acquisition and computation. For reference, the current world record is/was 0.637 seconds.The machine can definitely go faster, but the tuning process is really time consuming since debugging needs to be done with the high speed camera, and mistakes often break the cube or blow up FETs. Looking at the high-speed video, each 90 degree move takes ~10 ms, but the machine is actually only doing a move every ~15 ms. For the time being, Jared and I have both lost interest in playing the tuning game, but we might come back to it eventually and shave off another 100 ms or so.





Here's the contraption:











The contraption is built from:

6 Kollmorgen ServoDisc U9/N9-series motors. 2 were taken from my old robot arm project, the rest were found pretty cheaply on ebay. Each motor has a US Digital optical encoder on the back, also purchased for a bargain on ebay.

6 custom motor drivers.

2 PlayStation Eye cameras

1 Rubik's Cube. One of the cheapest available

Several cubes were broken and rebuilt in the process:











Build Log

The hardware started out with a 1-axis test setup cobbled together out of spare parts. Below is a big ServoDisc U12 and cruft encoder found lying around MITERS, the motor controller I built for 6.131 a few years ago, with everything wired into a Nucleo for control. I used this setup to implement the minimum time controller in hardware, and figure out a ballpark for how fast this thing could go.



The answer was pretty darn fast.



The plot shows a sequence of 90 and 180 degree moves. Each 90 degree move here took a little under 15 ms. And that was only at 40 volts.

We tested with an actual cube, using Bayley's Photron for high-speed recording. The "speed cubes" we used have pop-off caps at the center of each face. Beneath the cap is a screw you can use to adjust the amount of slop in the cube. We machined some square-drives that press into the recess beneath the cap, so no cube modification was required.





The contraption is built from:Several cubes were broken and rebuilt in the process:





Here's part of the software stack ;)

Up top is a monitor showing the camera's views of the cubes. Jared's software allows you to draw polygons on the screen, and assign them to different faces of the cube. The pixels inside each polygon are averaged and compared to some thresholds to determine the color of each face. We found that distinguishing the red faces from the orange ones was finicky, thanks to the low-quality of the cameras, so we sharpied the orange faces black. Apparently that's allowed though.





Once the faces are identified, the solve sequence is computed using the min2phase algorithm. This returns a solution which we've observed to be 19-23 moves for a well-scrambled cube. The fastest solve we've done was actually a 21-move solve, so just getting a little lucky could easily shave off another ~30ms from the time.





And like all good projects, this thing requires a tall stack of power supplies to run - 5V logic power, 12V gate-drive power, 24V LED power, and motor power.





A collaboration with Jared One counterintuitive trick for getting things to work well was to make the cube really tight. When the cube is loose (like it would be if a person were trying to solve it fast), the outer faces just cam outwards when you try to turn the center faces quickly - see the Cubsplosion video for what this looks like. It took tightening the cubepast what intuitively felt appropriate, in order to stop the camming action from happening.From this point, the hardware was relatively straight forward. The big ServoDisc was swapped for six smaller ones; 2 from my old robot arm, and 4 more from ebay. The smaller ones have the advantage of having higher torque-to-inertia, so should are capable of even greater angular accelerations, and draw much less power in the process. I machined a bunch of motor-to-cube couplings, and threw together a box to hold everything out of some laser cut acrylic and scavenged 80/20.To be specific, the motors are 4 ServoDisc N9M4T motors, and 2 UD9-E's. These two motors have identical performance, but the N-ones use neodymium magnets, so they're much thinner.Each motor has a US Digital 2000 line optical encoder strapped on the back. While that much resolution definitely isn't necessary, we found the encoders for $14 apiece on ebay, brand new, which was an excellent deal. The encoders only had 1/4" bores through the optical discs, and none of our motors had 1/4" shafts. In fact, the N9's didn't have any shaft whatsoever protruding beyond the back of the motor. We stuck each motor in the lathe, held by the front shaft, and reamed 1/4" holes in the backs. 1/4" dowel pins were pressed into the holes, to add enough shaft to mount the encoders to. The N9's also had no features to mount the encoder sensor and housing to, so they were held on with some VHB.I built some custom DC motor controllers to do the servo-ing:The motor controllers aren't anything too fancy - in fact, they don't even have current sensors on them. Gate drive uses and external 12V power supply and bootstrapped gate drive optoisolators. They've each got an STM32F303K8 doing all the control. Commands are sent to each controller over a differential serial interface, and there are 2 extra GPIO pins broken out, which are used for synchronization between the 6 motors. The controller is built out of 100V FETs, so I was expecting it to run up to 60V with no issues, but we've managed to blow up one of them twice at that voltage, when the cube locked up. I'm not sure if it's a conventional FET-blew-up-from-too-much-current situation, or ringing on the bus causing the FETs to avalanche and die, or something like that. It is suspicious that the same one has died twice though. I also have a set of lower-Rds(on), higher gate charge version of these FETs I could swap to, which should help on both accounts.Jared came up with an excellent system for synchronization/anti-collision between the 6 faces. On the hardware side, this consists of the AND BOARD, which, as you might expect, basically is just an AND gate (it also does the logic power distribution). Each motor controller has a digital output going to the AND BOARD, which ANDs the six signals, and a digital input driven by the output of the AND gate.When a motor starts a move, it turns off the output of the and board, and turns it back on once it has completed the move. When none of the motors are moving, the output of the AND gate goes high, signalling to the next motor in the move sequence that it's safe to start moving.After the solve sequence is found, the sequence of moves is sent to all the motor controllers at once over differential serial. Each motor controller has a different ID number, so they can pick out the moves corresponding to their ID number. Using the output of the AND Board to keep the count of elapsed moves, the six motor controllers step through the sequence of moves until the cube is solved.Two PlayStation Eye cameras are positioned pointing towards opposite corners of the cube, so that all 6 faces can be seen with only 2 cameras. Jared was able to get these things running at ~150 fps under Linux, and at very low latency compared to your typical webcamFor consistent lighting, there's a bright LED next to each camera, lighting up the cube from the corners:Here's a better view of how the motors interface with the cube. Popping the cap off each center face reveals an adjustment screw, and a square cavity which the shafts interface with. Each of the shafts can be loosened to slide out of the cube, so that the cube can be removed from and inserted into the box.For added legitimacy, here's a scope shot of some signals during the fastest solve. The blue trace is one of the pins on the AND Board. When it toggles high at the end, the motor drivers think they are all done moving. From the high-speed video at the beginning of the post, you can see that the AND board actually turns on a few ms after the cube could be counted as being solved. The yellow trace is connected to the DTR pin on the USB FTDI adapter going from the computer to the motor drivers. When the solve button is pressed, the first thing the software does is toggle this pin, before even capturing the images from the webcams.Here's another entertaining scope shot. The yellow trace is the AND board, blue is the DC bus current measured with the LEM-Stick . The purple trace is the integral of the blue trace. During this particular test, the contraption drew 6 Amp-seconds of current (i.e. 6 coulombs of charge) at 40 V, meaning that the solve took 240 Joules of energy, and peak power was ~1300 watts.