DD: Android Things Rubik’s Cube Solver (2)

Time for an update! I just received the first claw with 2 servos and I had the urge to put it together as soon as I saw the package.

The specs of the claw stated that it was 55mm wide when open, and most modern cubes are ~56mm, so -as expected- it is too small to handle a standard cube, but hey, it was cheap.

Since I was expecting this, I had already ordered some mini cubes (30mm) and in the meantime I also have some 2x2x2 to try with, so not too much of an issue. I even got a spare mini DaYan, which a pretty good speed cube, and you can soften the springs to make it easier to move and require less torque from the servos (which I indeed did)

Now, into the details: I got the claw with 2 MG996 servos. As it happens these servos have a range of 180 degrees, which means that:

  • I need to tweak the pulse duration range to get the complete angle radio
  • I will only be able to do 2 types of moves, either R & R’ or R and 2R, but not the 3 of them, since I’d need at least and angle range of 270 for that (to go from -90 to 180

Anyway, I got the claw doing the basic move, which is (starting from 0 degrees turn and cube held):

  • Turn 90 degrees
  • Release
  • Get back to 0 degrees
  • Grab

These movements are what is needed to perform a turn of one face and the return to the start position.

One important point to make is that whenever you use a motor, you should use an external power source and not the 5v output from a board. That output is meant to power electronic circuits and can’t drain much power. Best case you’ll reboot the board, worse case you’ll damage it. So here it is, again, in bold:

When using any motor, use an external power source

While Android Things has 2 PWM outputs I could, in theory, have used them directly, but looking ahead I know I’ll need 4 PWM, so it is a good idea to have them connected to a PWM expander, a PCA9685, for which I wrote a driver for Android Things a while ago as part of PlattyThings.

Note how it has special pins for power input (use them!) and it has pins to connect up to 16 servos to it.

Now into the bad news: one servo was defective. As soon as any minor torque was needed it started spinning loose. That has made impossible to test actual turning of the face with a cube while holding the cube myself.

On the bright side, I did learn how a servo is built internally, which is interesting.

While I do have some other motors, nothing really fit. I have a 360 continuous rotation servo, but that would need me timing the twist, I also have some stepper motors, but that will require a lot of GPIO ports and a different connection to the claw (it is designed to fit with a servo) and finally some mini servos (MG90S), which I suspect do not have enough torque, so I did not even try.

Ultimately I decided to order a new servo from another model – a MG946- that in theory has a wider rotation range to solve both problems.

Other considerations is if I should make the structure for the solver using cardboard or Lego. I just tried and the servos fit quite well into the Lego system, so maybe that’s what it’s going to be.

And that is it for now until the next shipment arrives. It will probably be some mini cubes or the second claw.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.