Difference between revisions of "S15: Rubik's Cube Solver"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Team Members & Responsibilities)
(Team Members & Responsibilities)
 
(90 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Project Title ==
+
[[File:CMPE244 S15 RubikCubeSolver Complete.jpg|right|600px|Complete Setup]] <br>
 +
== Rubik's Cube Solver==
  
 
== Abstract ==
 
== Abstract ==
This section should be a couple lines to describe what your project does.
+
The Rubik’s Cube is a common 3-D combination puzzle known and loved by people of all ages. The mathematics of Rubik’s Cubes has been explored in great detail ever since the beginning of their production in the 1980’s.The aim of the project is to develop Rubik’s cube solving algorithm to solve the Rubik’s cube in shortest possible time without any human intervention. The project explored areas of - research and development, testing and debugging, and documentation.
  
 
== Objectives & Introduction ==
 
== Objectives & Introduction ==
Show list of your objectives. This section includes the high level details of your project. You can write about the various sensors or peripherals you used to get your project completed.
+
The goal of the project is to write the software and create the hardware required to autonomously solve the Rubik’s cube. The first part of this project consisted of research on the mathematics of the Rubik’s Cube and how that is used for various solutions to the cube. Next, the focus was put on making a Windows based GUI through which the user can input the arrangement of colors for all the faces on the cube. Finally, the commands to move the robotic arms are send via the sjone board to the servos.
 +
 
 +
 
  
 
=== Team Members & Responsibilities ===
 
=== Team Members & Responsibilities ===
*  Nikhil Chaturvedi
+
[http://linkedin.com/in/nikhilchaturvedi Nikhil Chaturvedi]<br>
 
**  Cube solving algorithm  
 
**  Cube solving algorithm  
**  Interface SJOne with cube solving arms
+
**  Connectivity from console to SJOne board
**  Bluetooth connectivity from console to SJOne board
+
**  Python GUI
*  Preeti Benake
+
[http://www.linkedin.com/in/preetibenake Preeti Benake]<br>
**  Python console for selecting the top face of the cube and Bluetooth interface
+
**  Build the cube solving claws
**  Build the cube solving arms
+
**  Interface cube solving algorithm with claws
*  Rajashree Kambli
+
**  Updating the wiki page
**  Python console for selecting the top face of the cube and Bluetooth interface
+
[http://www.linkedin.com/in/rajashreekambli Rajashree Kambli]<br>
**  Interface cube algorithm with arms
+
**  Connectivity from Console to SJOne board
*  Shahid Qureshi
+
**  Updating the wiki page
**  Bluetooth connectivity from console to SJOne board
+
[http://www.linkedin.com/in/qureshishahid Shahid Qureshi]<br>
 
**  Build the cube solving arms
 
**  Build the cube solving arms
  
Line 43: Line 46:
 
| 04/17/2015
 
| 04/17/2015
 
| Investigating Robotic arm design; eliminated few hardware options.
 
| Investigating Robotic arm design; eliminated few hardware options.
| Ongoing
+
| Completed on time
| --/--/2015
+
| 04/17/2015
 
|-
 
|-
 
! scope="row"| 3
 
! scope="row"| 3
Line 56: Line 59:
 
| 03/10/2015
 
| 03/10/2015
 
| 03/14/2015
 
| 03/14/2015
| Investigated BlueZ Bluetooth stack for Python and C.
+
| Investigated BlueZ Bluetooth stack for Python and C.(Decided not to go ahead with this method)
| Completed on Time
+
| Completed on time
 
| 03/14/2015
 
| 03/14/2015
 
|-
 
|-
Line 63: Line 66:
 
| 03/29/2015
 
| 03/29/2015
 
| 04/17/2015
 
| 04/17/2015
| Implementing Bluetooth interfacing of SJOne board using C BlueZ and Console using PyblueZ
+
| Implementing Bluetooth interfacing of SJOne board using C BlueZ and Console using PyblueZ (Decided not to go ahead with this method)
| Ongoing
+
| Completed on time
| --/--/2015
+
| 04/17/2015
 
|-
 
|-
 
! scope="row"| 6
 
! scope="row"| 6
| 04/08/2015
+
| 04/18/2015
| --/--/2015
+
| 04/20/2015
| Investigating implementation of Rubik cube solving algorithm (Kociemba's algorithm)
+
| Order and test the hardware components (Had delays getting parts from eBay)
| Ongoing
+
| Completed on time
| --/--/2015
+
| 04/27/2015
 +
|-
 +
! scope="row"| 7
 +
| 04/22/2015
 +
| 05/19/2015
 +
| Interfacing the motors to SJOne board
 +
| Completed
 +
| 05/20/2015
 +
|-
 +
! scope="row"| 8
 +
| 04/10/2015
 +
| 04/24/2015
 +
| Investigating and implementation of Rubik cube solving algorithm (Kociemba's algorithm)
 +
| Completed
 +
| 04/27/2015
 +
|-
 +
! scope="row"| 9
 +
| 04/10/2015
 +
| 05/08/2015
 +
| Implementation of Rubik cube solving algorithm (Custom). This algorithm replaced the other algorithm
 +
| Completed
 +
| 05/09/2015
 +
|-
 +
! scope="row"| 10
 +
| 04/28/2015
 +
| 05/15/2015
 +
| Build the Robot arm and test the controls
 +
| Completed
 +
| 05/21/2015
 +
|-
 +
! scope="row"| 11
 +
| 05/08/2015
 +
| 05/20/2015
 +
| Implement Bluetooth connectivity module
 +
| Completed
 +
| 05/20/2015
 +
|-
 +
! scope="row"| 12
 +
| 05/11/2015
 +
| 05/22/2015
 +
| Testing
 +
| Completed
 +
| 05/23/2015
 +
|-
 
|}
 
|}
  
 
== Parts List & Cost ==
 
== Parts List & Cost ==
Give a simple list of the cost of your project broken down by components. Do not write long stories here.
+
 
 +
{| class="wikitable"
 +
|-
 +
! scope="col"| Item#
 +
! scope="col"| Part Desciption
 +
! scope="col"| Vendor
 +
! scope="col"| Qty
 +
! scope="col"| Cost
 +
|-
 +
! scope="row"| 1
 +
| Servo Motors
 +
|
 +
| 6
 +
| $56.58
 +
|-
 +
|-
 +
! scope="row"| 2
 +
| Robotic Claw
 +
|
 +
| 2
 +
| $39.92
 +
|-
 +
! scope="row"| 3
 +
| Speed Rubik cube
 +
|
 +
| 2
 +
| $21.48
 +
|-
 +
! scope="row"| 4
 +
| Turnable table for Motors
 +
|
 +
| 1
 +
| $7.99
 +
|-
 +
! scope="row"| 5
 +
| Robotic Claw stands
 +
|
 +
| 2
 +
| $7.52
 +
|-
 +
! scope="row"| 6
 +
| Wires and other Accessories
 +
|
 +
| ---
 +
| $16.5
 +
|-
 +
|}
  
 
== Design & Implementation ==
 
== Design & Implementation ==
The design section can go over your hardware and software design.  Organize this section using sub-sections that go over your design and implementation.
 
  
 
=== Hardware Design ===
 
=== Hardware Design ===
Discuss your hardware design here.  Show detailed schematics, and the interface here.
+
The following system block diagram represents all the modules designed and interfaced with each other to form a complete working system that helps solve the cube. <br>
 +
[[file:CMPE244_S15_RubikCubeSolver_Systemblock.jpg|800px|System Block Diagram]]<br>
  
 
=== Hardware Interface ===
 
=== Hardware Interface ===
In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the '''Software Design''' section is isolated to talk about high level workings rather than inner working of your project.
+
The hardware implementation includes the the interfacing the robot claws to SJ One board. The following block diagram represents the connection of the motors to the board.
 +
[[File:S15 Rubik'sCubeSolver Motorblock.png|Right|Motor Connection with SJ One]]
 +
{| class="wikitable"
 +
|+ Servo Motor Pin Connectivity Table
 +
|-
 +
! scope="col"| '''Description'''
 +
! scope="col"| '''Motor Pin'''
 +
! scope="col"| '''SJOne Development Board Pins'''
 +
! scope="col"| '''Commands'''
 +
! scope="col"| '''Note'''
 +
|
 +
|-
 +
| Holder Servo Motor
 +
|
 +
|
 +
  P2.0 and P2.2 PWM
 +
|
 +
  PWM motor(PWM::pwm1, 50);
 +
  PWM motor(PWM::pwm3, 50);
 +
|
 +
  Sets PWM signal of 50 Hz
 +
  Sets PWM signal of 50 Hz
 +
  Opening and Closing the claw.
 +
|-
 +
| Tuner Servo Motor
 +
|
 +
|
 +
  P2.1 and P2.3 PWM
 +
|
 +
  PWM servo(PWM::pwm2, 50);
 +
  PWM servo(PWM::pwm4, 50);
 +
|
 +
  Sets PWM signal of 50 Hz
 +
  Sets PWM signal of 50 Hz
 +
  Turn the claw clockwise and anticlockwise.
 +
|-
 +
|}
 +
<br>
 +
==== Robot claw interface ====
 +
 
 +
[[File:CPME244_S15_RubikCubeSolver_motor.jpg|150px|left|Servo Motor]]
 +
'''''Motor''''' :The motors used to achieve the movement are MG995 Servo motor. Servo motors are preferred due to the precise movements of the arms by 90 degree, which was required. The rotation was controlled by the PWM value passed to the particular motor. The open and close function of the claw was controlled by one motor(holder motor). The clockwise and anticlockwise rotation of the claw was controlled by the other motor(turner motor). The figure depicts the claw attached to the motor (turner motor).<br>
 +
 
 +
[[File:CPME244 S15 RubikCubeSolver claw.jpg|200px|right|Robot claw]]
 +
'''''Robot Claw''''' : We choose to use the Dangu Claw because of the design and features. It was designed to in corporate both the motors on. One for opening and closing operation and the other for turning the claw. The features of the claw are as follows, <br>
 +
* The Dagu Aluminum Gripper (with Servos) is made from 3mm thick aluminium
 +
* The gripper will open in excess of 50mm
 +
* The servos provide 2.3Kg/cm of torque at 6V. and 1.8Kg/cm@3.3V
 +
* It comes pre-assembled in a plastic bag
 +
* Servo Features : Standard PWM Interface
 +
 
 +
==== Bluetooth Interface ====
 +
[[File:CMPE244_S15_RubikCubeSolver_Bluetooth.jpg|350px|left|Bluetooth Connection]]
 +
Basic Bluetooth module (JY-MCU HC-06) was borrowed from Sreeharsha to use in the project. This particular series (HC-06) has four pins RX, TX, VCC and GND works in slave mode. <br>
 +
Note: Although VCC pin indicates that the module works with 3.6-6V, connecting it to the LPC1758 3.3V output worked fine.<br><br>
 +
This project uses UART3 for communication.The setting for UART is: Baud Rate - 115200, no parity, one start bit and one stop bit.<br> <br>
  
 
=== Software Design ===
 
=== Software Design ===
Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level.  Do not show the details of the code.  For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it. 
+
 
 +
==== Cube Solving Algorithm ====
 +
[[File:CMPE244_S15_RubikCubeSolver_Cubesolver.jpg|Flowchart of cube solving algorithm]]
 +
 
 +
==== Integrating the Motors and Claws ====
 +
 
 +
[[File:CPME244_S15_RubikCubeSolver_motor_flowchart.jpg|Flowchart of cube solving Claws]]
  
 
=== Implementation ===
 
=== Implementation ===
This section includes implementation, but again, not the details, just the high levelFor example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
+
==== Cube Solving Algorithm ====
 +
 
 +
The cube algorithm takes a scrambled cube and give a solution string.
 +
The steps involved in solving the cube is as follows,
 +
 
 +
1. Read the scrambled colors from the text file that the Python GUI
 +
module wrote to. <br>
 +
2. Read these values into the main position holder array. <br>
 +
3. Hold a reference to the adjacent colors with respect to the top face. <br>
 +
4. Calculate the permutations for aligning the front, back, left and
 +
right faces to the top face. Calculate the movements and the number of
 +
rotations required to make these movements <br>
 +
5. Make changes to the main position holder after getting the
 +
movements based on the permutations.<br>
 +
6. Calculate the permutations for solving the bottom layer which
 +
consists of colors on bottom, left, right, front and back faces. <br>
 +
7. Calculate the the rotations for this solution. <br>
 +
8. Check if all the faces contain just one color. If yes, goto step 9,
 +
else goto step 6. <br>
 +
9. Stop the algorithm.
 +
 
 +
==== Python GUI Module ====
  
== Testing & Technical Challenges ==
+
We need a way to have the cube solving algorithm know the scrambled
Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again?
+
cube colors. While we could easily do this by manually changing these
Make a smooth transition to testing section and described what it took to test your project.
+
values for every run in the solver algorithm, this does not make for a
 +
good system design. The Python module presents a GUI for each face of
 +
the cube using which we select the colors of them based on a scrambled
 +
cube. After reading each face, we check if the total number for each
 +
color is the same. If yes, we write the faces of the cube to a file on
 +
the local machine.
 +
 
 +
==== Cube rotating arms ====
 +
 
 +
The robotic arms take the solution from the cube solving algorithm and
 +
convert them into the corresponding movements. We made use of two
 +
robotic claws, with two servo motors for each claw. This gives us four
 +
degrees of freedom to turn the cube. Here is how the arm functions,
 +
 
 +
The claws are mounted at 90 degrees to each other and the rotations
 +
are as follows, <br>
 +
 
 +
1. The right side is turned clockwise and counter clockwise. <br>
 +
2. The bottom side is turned clockwise and counter clockwise. <br>
 +
3. To turn the top face and left face, the whole cube is rotated and a
 +
combination of the right claw and the left claw is used. <br>
 +
 
 +
The cube rotating algorithm reads the solution file that the cube
 +
solving algorithm wrote to and converts the characters into a simpler
 +
notation for ease of programming.
 +
 
 +
==== Bluetooth module ====
  
Include sub-sections that list out a problem and solution, such as:
+
This module sends the solution string from the solving algorithm to
 +
SJOne board. The sender is written in Java, which searches for
 +
Bluetooth devices in its vicinity and the service of each device. On
 +
SJOne board, we have a Bluetooth device which is set at 115200 Baud
 +
rate and listens for incoming connections and reads bytes of data sent
 +
from the Java console. We used Blue cove stack for our implementation.
  
=== My Issue #1 ===
+
== Testing & Technical Challenges ==
Discuss the issue and resolution.
+
1. The most challenging part of the project was to get the solution to
 +
a scrambled cube. Initially we chose to solve a 3x3 cube but we chose
 +
a 2x2 cube instead because solving a 3x3 cube took a lot of time and
 +
with the limited time we had, we could not spend more time trying to
 +
solve instead of actually getting to a solution.<br><br>
 +
2. The 2x2 cube solving algorithm used too much of memory allocation
 +
for calculating a lot of combinations for aligning top face with the
 +
adjacent sides. Due to this we could not run the algorithm on SJOne
 +
board. Instead, we chose to run the algorithm on a PC and send the
 +
solution string to the board to run the servo motor controller.<br><br>
 +
3. We have two robotic arms which can turn left/right and top/bottom.
 +
Due to this, there we had to figure out a way to rotate the other
 +
remaining faces using a combination of the turns of the two claws.<br><br>
 +
4. We had problems using the BlueCove Bluetooth stack in Java to
 +
connect to SJOne board which had a Bluetooth device on board. We were
 +
unable to get the push service from the device and resorted to using
 +
BlueTerm application on Android for connecting with the code that is
 +
running on SJOne board. We are still working to find a solution to
 +
this, but since the other much important modules took up time, we
 +
could not give enough time to this.
  
 
== Conclusion ==
 
== Conclusion ==
Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project.  How has this project increased your knowledge?
+
This project turned out to be more complex than we initially thought it would be. Through good engineering practices we could solve most of the problems we encountered and eliminated many design ideas based on these solutions. We learnt many technologies from scratch like programming in Python for example and learnt many good programming practices in C
  
 
=== Project Video ===
 
=== Project Video ===
Line 113: Line 337:
 
== References ==
 
== References ==
 
=== Acknowledgement ===
 
=== Acknowledgement ===
Any acknowledgement that you may wish to provide can be included here.
+
 
 +
We would like to thank Preet, our instructor for CMPE244, for the wonderful class and imparting engineering lessons with some philosophy on becoming better engineers added every lecture. We would also like to thank our wonderful ISAs - Divya, Dhawal and Shashank, for guiding us. A special thanks to Sreeharsha for lending us the Bluetooth device and guiding us with the use of the same.
 +
A shout out to the good people at Southern Lumber wood store for giving us free plywood pieces.
  
 
=== References Used ===
 
=== References Used ===
List any references used in project.
+
 
 +
http://www.nxp.com/documents/user_manual/UM10360.pdf
 +
 
 +
Preetpal Kang, Lecture notes of CMPE 244, Computer Engineering, Charles W. Davidson College of Engineering, San Jose State University, Jan-May 2015.
 +
 
 +
http://www.socialledge.com/sjsu/index.php?title=Main_Page
 +
 
 +
http://upcommons.upc.edu/pfc/bitstream/2099.1/23666/7/Annex3Datasheet%20m%C3%B2dul%20Bluetooth%20JY-MCU.pdf
 +
 
 +
http://www.electronicoscaldas.com/datasheet/MG995_Tower-Pro.pdf
 +
 
 +
https://www.thenewboston.com/videos.php?cat=99  (We used this website to learn about the basics of the Python GUI)
 +
 
 +
http://bluecove.org/
 +
 
 +
http://kociemba.org/
  
 
=== Appendix ===
 
=== Appendix ===
 
You can list the references you used.
 
You can list the references you used.

Latest revision as of 23:11, 29 May 2015

Complete Setup

Rubik's Cube Solver

Abstract

The Rubik’s Cube is a common 3-D combination puzzle known and loved by people of all ages. The mathematics of Rubik’s Cubes has been explored in great detail ever since the beginning of their production in the 1980’s.The aim of the project is to develop Rubik’s cube solving algorithm to solve the Rubik’s cube in shortest possible time without any human intervention. The project explored areas of - research and development, testing and debugging, and documentation.

Objectives & Introduction

The goal of the project is to write the software and create the hardware required to autonomously solve the Rubik’s cube. The first part of this project consisted of research on the mathematics of the Rubik’s Cube and how that is used for various solutions to the cube. Next, the focus was put on making a Windows based GUI through which the user can input the arrangement of colors for all the faces on the cube. Finally, the commands to move the robotic arms are send via the sjone board to the servos.


Team Members & Responsibilities

  • Nikhil Chaturvedi
    • Cube solving algorithm
    • Connectivity from console to SJOne board
    • Python GUI
  • Preeti Benake
    • Build the cube solving claws
    • Interface cube solving algorithm with claws
    • Updating the wiki page
  • Rajashree Kambli
    • Connectivity from Console to SJOne board
    • Updating the wiki page
  • Shahid Qureshi
    • Build the cube solving arms

Team Schedule

Sl.No Start Date End Date Task Status Actual Completion Date
1 02/28/2015 03/02/2015 Finalized high level design architecture Completed on time 03/02/2015
2 02/28/2015 04/17/2015 Investigating Robotic arm design; eliminated few hardware options. Completed on time 04/17/2015
3 03/07/2015 03/09/2015 Investigated interfacing console with SJOne board. Completed on time 03/09/2015
4 03/10/2015 03/14/2015 Investigated BlueZ Bluetooth stack for Python and C.(Decided not to go ahead with this method) Completed on time 03/14/2015
5 03/29/2015 04/17/2015 Implementing Bluetooth interfacing of SJOne board using C BlueZ and Console using PyblueZ (Decided not to go ahead with this method) Completed on time 04/17/2015
6 04/18/2015 04/20/2015 Order and test the hardware components (Had delays getting parts from eBay) Completed on time 04/27/2015
7 04/22/2015 05/19/2015 Interfacing the motors to SJOne board Completed 05/20/2015
8 04/10/2015 04/24/2015 Investigating and implementation of Rubik cube solving algorithm (Kociemba's algorithm) Completed 04/27/2015
9 04/10/2015 05/08/2015 Implementation of Rubik cube solving algorithm (Custom). This algorithm replaced the other algorithm Completed 05/09/2015
10 04/28/2015 05/15/2015 Build the Robot arm and test the controls Completed 05/21/2015
11 05/08/2015 05/20/2015 Implement Bluetooth connectivity module Completed 05/20/2015
12 05/11/2015 05/22/2015 Testing Completed 05/23/2015

Parts List & Cost

Item# Part Desciption Vendor Qty Cost
1 Servo Motors 6 $56.58
2 Robotic Claw 2 $39.92
3 Speed Rubik cube 2 $21.48
4 Turnable table for Motors 1 $7.99
5 Robotic Claw stands 2 $7.52
6 Wires and other Accessories --- $16.5

Design & Implementation

Hardware Design

The following system block diagram represents all the modules designed and interfaced with each other to form a complete working system that helps solve the cube.
System Block Diagram

Hardware Interface

The hardware implementation includes the the interfacing the robot claws to SJ One board. The following block diagram represents the connection of the motors to the board. Motor Connection with SJ One

Servo Motor Pin Connectivity Table
Description Motor Pin SJOne Development Board Pins Commands Note
Holder Servo Motor
 P2.0 and P2.2 PWM
 PWM motor(PWM::pwm1, 50);
 PWM motor(PWM::pwm3, 50);
 Sets PWM signal of 50 Hz
 Sets PWM signal of 50 Hz
 Opening and Closing the claw.
Tuner Servo Motor
 P2.1 and P2.3 PWM
 PWM servo(PWM::pwm2, 50);
 PWM servo(PWM::pwm4, 50);
 Sets PWM signal of 50 Hz
 Sets PWM signal of 50 Hz
 Turn the claw clockwise and anticlockwise.


Robot claw interface

Servo Motor

Motor :The motors used to achieve the movement are MG995 Servo motor. Servo motors are preferred due to the precise movements of the arms by 90 degree, which was required. The rotation was controlled by the PWM value passed to the particular motor. The open and close function of the claw was controlled by one motor(holder motor). The clockwise and anticlockwise rotation of the claw was controlled by the other motor(turner motor). The figure depicts the claw attached to the motor (turner motor).

Robot claw

Robot Claw : We choose to use the Dangu Claw because of the design and features. It was designed to in corporate both the motors on. One for opening and closing operation and the other for turning the claw. The features of the claw are as follows,

  • The Dagu Aluminum Gripper (with Servos) is made from 3mm thick aluminium
  • The gripper will open in excess of 50mm
  • The servos provide 2.3Kg/cm of torque at 6V. and 1.8Kg/cm@3.3V
  • It comes pre-assembled in a plastic bag
  • Servo Features : Standard PWM Interface

Bluetooth Interface

Bluetooth Connection

Basic Bluetooth module (JY-MCU HC-06) was borrowed from Sreeharsha to use in the project. This particular series (HC-06) has four pins RX, TX, VCC and GND works in slave mode.
Note: Although VCC pin indicates that the module works with 3.6-6V, connecting it to the LPC1758 3.3V output worked fine.

This project uses UART3 for communication.The setting for UART is: Baud Rate - 115200, no parity, one start bit and one stop bit.

Software Design

Cube Solving Algorithm

Flowchart of cube solving algorithm

Integrating the Motors and Claws

Flowchart of cube solving Claws

Implementation

Cube Solving Algorithm

The cube algorithm takes a scrambled cube and give a solution string. The steps involved in solving the cube is as follows,

1. Read the scrambled colors from the text file that the Python GUI module wrote to.
2. Read these values into the main position holder array.
3. Hold a reference to the adjacent colors with respect to the top face.
4. Calculate the permutations for aligning the front, back, left and right faces to the top face. Calculate the movements and the number of rotations required to make these movements
5. Make changes to the main position holder after getting the movements based on the permutations.
6. Calculate the permutations for solving the bottom layer which consists of colors on bottom, left, right, front and back faces.
7. Calculate the the rotations for this solution.
8. Check if all the faces contain just one color. If yes, goto step 9, else goto step 6.
9. Stop the algorithm.

Python GUI Module

We need a way to have the cube solving algorithm know the scrambled cube colors. While we could easily do this by manually changing these values for every run in the solver algorithm, this does not make for a good system design. The Python module presents a GUI for each face of the cube using which we select the colors of them based on a scrambled cube. After reading each face, we check if the total number for each color is the same. If yes, we write the faces of the cube to a file on the local machine.

Cube rotating arms

The robotic arms take the solution from the cube solving algorithm and convert them into the corresponding movements. We made use of two robotic claws, with two servo motors for each claw. This gives us four degrees of freedom to turn the cube. Here is how the arm functions,

The claws are mounted at 90 degrees to each other and the rotations are as follows,

1. The right side is turned clockwise and counter clockwise.
2. The bottom side is turned clockwise and counter clockwise.
3. To turn the top face and left face, the whole cube is rotated and a combination of the right claw and the left claw is used.

The cube rotating algorithm reads the solution file that the cube solving algorithm wrote to and converts the characters into a simpler notation for ease of programming.

Bluetooth module

This module sends the solution string from the solving algorithm to SJOne board. The sender is written in Java, which searches for Bluetooth devices in its vicinity and the service of each device. On SJOne board, we have a Bluetooth device which is set at 115200 Baud rate and listens for incoming connections and reads bytes of data sent from the Java console. We used Blue cove stack for our implementation.

Testing & Technical Challenges

1. The most challenging part of the project was to get the solution to a scrambled cube. Initially we chose to solve a 3x3 cube but we chose a 2x2 cube instead because solving a 3x3 cube took a lot of time and with the limited time we had, we could not spend more time trying to solve instead of actually getting to a solution.

2. The 2x2 cube solving algorithm used too much of memory allocation for calculating a lot of combinations for aligning top face with the adjacent sides. Due to this we could not run the algorithm on SJOne board. Instead, we chose to run the algorithm on a PC and send the solution string to the board to run the servo motor controller.

3. We have two robotic arms which can turn left/right and top/bottom. Due to this, there we had to figure out a way to rotate the other remaining faces using a combination of the turns of the two claws.

4. We had problems using the BlueCove Bluetooth stack in Java to connect to SJOne board which had a Bluetooth device on board. We were unable to get the push service from the device and resorted to using BlueTerm application on Android for connecting with the code that is running on SJOne board. We are still working to find a solution to this, but since the other much important modules took up time, we could not give enough time to this.

Conclusion

This project turned out to be more complex than we initially thought it would be. Through good engineering practices we could solve most of the problems we encountered and eliminated many design ideas based on these solutions. We learnt many technologies from scratch like programming in Python for example and learnt many good programming practices in C

Project Video

Upload a video of your project and post the link here.

Project Source Code

References

Acknowledgement

We would like to thank Preet, our instructor for CMPE244, for the wonderful class and imparting engineering lessons with some philosophy on becoming better engineers added every lecture. We would also like to thank our wonderful ISAs - Divya, Dhawal and Shashank, for guiding us. A special thanks to Sreeharsha for lending us the Bluetooth device and guiding us with the use of the same. A shout out to the good people at Southern Lumber wood store for giving us free plywood pieces.

References Used

http://www.nxp.com/documents/user_manual/UM10360.pdf

Preetpal Kang, Lecture notes of CMPE 244, Computer Engineering, Charles W. Davidson College of Engineering, San Jose State University, Jan-May 2015.

http://www.socialledge.com/sjsu/index.php?title=Main_Page

http://upcommons.upc.edu/pfc/bitstream/2099.1/23666/7/Annex3Datasheet%20m%C3%B2dul%20Bluetooth%20JY-MCU.pdf

http://www.electronicoscaldas.com/datasheet/MG995_Tower-Pro.pdf

https://www.thenewboston.com/videos.php?cat=99 (We used this website to learn about the basics of the Python GUI)

http://bluecove.org/

http://kociemba.org/

Appendix

You can list the references you used.