Portable Single Player Chess

By the Maples: Final Documentation

Introduction

The Portable Single Player Chess Device is a device aimed to combat boredom and encourage individuals to learn how to play chess. The device was created by the Maples team, including Emma, Yiming, and Kira, and was personalized for the team's client Russia. Developed as a final project for Physical Computing, the Maples worked closely with CLASS, a community based organization that aids disabled adults living in the Pittsburgh community, to produce a working instrument for a client from CLASS. More information on the inital meeting and interview process can be found here.

Creation

The final product of the Portable Single Player Chess device includes a portable chess game and base product that manuvers the chess board for the user. The device was developed with the idea of only one person using it at a time, so all elements are meant for single player use. Hence, the product includes one button, located to the side of the chess board, that can be used to rotate the chess board and activate a choosen audio file. When clicked, the button causes the chess board to rotate 180 degrees, so the user can play a round as the "white team" and the more accessibly play themselves back as the "black team". During the rotation movement, a speaker will output a sound file stating whose turn it is, with the options being "White's turn" or "Black's turn." Overall, the product is a rectangular base with a cutout section meant for the chess board. On the sides of the base it includes the clients name, "Russia," cutout from acryilc material. 

Narration

Created to benefit Russia, the intended use of the product lies when Russia arrives to CLASS early in the morning, way before any of her friends have begun to arrive. In this situation, Russia would be able to arrive at CLASS and grab the product we have created to be able to play a game chess. She would place the portable chess board on top of the device into the designated cutout slot and begin to set up the pieces. Then, after plugging the device into a nearby outlet, would start her game of chess in which she would play against herself. The white button located to the side of the board would allow the chess game to rotate 180 degrees, to allow Russia to play as both the black and white team in chess. 

Clear device with colorful wiring at the bottom of the image. The upper half contains a black and white grid of squares for the chess board game.

Overview of final product. Includes view of internal electronics as well as the chess board that sits on top of the device.

Clear box containing colorful wiring and a metallic grey square with circular center cutout.

Isometric view of the internals of the product. The metallic square is the turn table that allows the game board to rotate smoothly. 

Top view of metallic grey square with circular central cutout, along with many colorful wirings connecting a black box to another, larger black rectangle.

Top view of the internal wiring of the product. The black motor, seen in the center of the circular, it what is responsibly for creating the torque used to rotate the board.

Isometric view of clear product showing white button and black speaker, along with a black power cord located at the bottom right.

Another viewpoint of the arudino wiring to the button and speaker.

Black and red triangular stripes laid on a grey background with miniature chess pieces in the top half of the photo.

Inside view of the portable chess board. This illustrates the sizing of the pieces and how to store the pieces within the board during transportation.

Copy of VID_20231207_015136.mp4

Video demonstrating the speaker and MP3 files. Activated by each button press, the speaker will annouce whose turn it is using the audio files "whites turn" and "blacks turn." Additionally, during the start up sequence the speaker will play "Hi, ready to play?" as requested by the client.

Prototype  & Process

The prototype the Maples group created was designed to explicitly show the sizing and functionality of the final product. While not all technical aspects of the product were shown during the prototype step, the general height, width, and depth of the product were made to test. Ultimately, this allowed us to make alternations to the shape of the product to best fit the client. Additionally, the turn table and rotating board was added as a part of the prototype to better demonstrate the functionality of the product. Excluding the metal turntable, the prototype was entirely cardboard. 

Square cardboard plate with small lips on the edge, lightish brown.

Board game base cutout. Square made from cardboard to estimate sizing of portable chess board. Small holes have been cut out to test placement of screws.

Cardboard cutout box on top of a white table. Two small white buttons are located on the right side of the box, with a blue screen placed in between.

Orginal protoyped design, included connected chess board as seen in the center-left, as well as two buttons and an LCD screen.

Lightish brown square and circle cardboard cutouts. The square shape overlies the circle.

Same square cardboard cutout as shown to the left, includes the circular base the board sits on. 

Copy of VID_20231205_131611.mp4

Video of motor rotation. Base off given inputs from the button the motor rotates 180 degrees in a given direction.

Throughout the prototype process, our goal was to finalize the sizing, functionality, and any additional aspects wanted for the final product. When presented to the client, Russia, we learned of a few key functions and changes she wanted us to make. These included portablity, replacing the LCD screen with a speaker, and including only one, instead of the initial two, buttons. In response to these requests, we were easily able to adapted to the latter two, but struggled with the concept of creating a portable but usable device. For the final product, we ended up dividing the device into two seperate components. This allowed for the chess board to have the portable functionality Russia requested, while allowing us to develop a working product with the materials we had available. 

Our group ran into many issues during the prototype process, partly due to the fact that we created multiple prototypes as we could not decide on a final design. One bit of feedback we received from multiple individuals was to consider the size and shape of the product. This feedback led us to try a design that included a circular base, as this would have minimized the size while still allowing enough room for the internal electronics. Unfortunately, while the design would have beneficial for the listed reasons, the logistics of the round base design did not justify the necessary amount of materials that would have been required. After looking at many alternatives, our group returned to our orginal design with only slight adjustments on the height and custom sizing for the board we obtained. 

Red marker on a whiteboard table, red lettering nearby a cardboard cutout at the top of the photo.

Notes from prototype critque, includes additions, requests, and updates to be made to the product.

Hand holding a small electronic speaker, behind it is colorful wiring and a messy table.

Speaker and volume testing. Figuring out the correct clarity for the speaker to have and which volume best accomodates that.

Rectangular black and white grid, half of a standard chess board.

Demonstarting portablility and compactness of the chess board. Shows sizing of board when folded.

Rainbow wires covering other electronic components. Someone in a grey sweaters stands at the left.

Learning how to wire all the components together, making sure all the electronics work when connected to each other.

Black and white chess board with black pieces at the top, white pieces at the bottom.

Game board setup, testing out the magnetic chess pieces.

Multiple black boxes and colorful wiring on a white background.

Motor testing and wiring, trying to figure out the best kind of motor and how to integrated with our device.

Conclusion

Technical Details

/***************************************************************

* Project name: Portable Single Player Chess

* Project author: Emma, Kira, Yiming

* Project discription:

*     - This project is worked for CMU 60-223 Physical Computing project3

*     - This machine is aiming to help Russia to play chess by herself.

*     1. When it start, user can play chess piece and then press the bottom.

*     2. After pressed, it will rotate and play voice to notice which side is playing.

* Project Pin map:

*     2: servo motor

*    11: Botton0

*     4: voice player pin0

*     5: voice player pin1

****************************************************************/


#include "Arduino.h"

#include "DFRobotDFPlayerMini.h"

#include <Servo.h>


#if (defined(ARDUINO_AVR_UNO) || defined(ESP8266))  // Using a soft serial port

#include <SoftwareSerial.h>

SoftwareSerial softSerial(/*rx =*/4, /*tx =*/5);

#define FPSerial softSerial

#else

#define FPSerial Serial1

#endif



const int BOTTOMPIN0 = 11;

const int SERVO_PIN = 12;

int track = 2;  //2 = "Ready to Play", 1 = "White's Turn", 3 = "Black's Turn"


Servo myMotor;

DFRobotDFPlayerMini myDFPlayer;


int state;

bool isPress0;

unsigned long bottomTime;


void setup() {

  pinMode(BOTTOMPIN0, INPUT);

  state = 0;

  isPress0 = false;

  myMotor.attach(SERVO_PIN);


#if (defined ESP32)

  FPSerial.begin(9600, SERIAL_8N1, /*rx =*/D3, /*tx =*/D2);

#else

  FPSerial.begin(9600);

#endif

  Serial.begin(115200);



  if (!myDFPlayer.begin(FPSerial, /*isACK = */ true, /*doReset = */ true)) {  //Use serial to communicate with mp3.

    Serial.println(F("Unable to begin:"));

    Serial.println(F("1.Please recheck the connection!"));

    Serial.println(F("2.Please insert the SD card!"));

    while (true) {

      delay(0);  // Code to compatible with ESP8266 watch dog.

    }

  }

  Serial.println(F("DFPlayer Mini online."));

  myDFPlayer.volume(22);   //Set volume value. From 0 to 30

  myDFPlayer.play(track);  //Play the first mp3

  track = 1;

}


void voicePlay(int index) {

  myDFPlayer.play(index);

}


//This function is aiming to limit the bottom press gap larger than specific time

void bottomDetect() {

  if (millis() - bottomTime > 700) {

    isPress0 = digitalRead(BOTTOMPIN0);

  }

}


//This function is aiming to initialize bottom press and time

void initBottom() {

  isPress0 = false;

  bottomTime = millis();

}




// state0 is beginning state.

// it will automatically get into this state, and play the 1st voice message: ready to play

// and  rotate to the initial position, then play second voice: white's turn

// and goto state1

void state0() {

  voicePlay(2);

  delay(2000);

  myMotor.write(0);

  voicePlay(3);

  delay(2000);

  bottomTime = millis();

  state = 1;

}


// state1 is white playing state

// once white player played and pressed the bottom

// it will play the voice: black's turn

// then rotate to 180 degree and goto state2

void state1() {

  bottomDetect();

  if(isPress0) {

    voicePlay(1);

    state = 2;

    initBottom();

    myMotor.write(180);

    delay(2000);

  }

}


// state2 is black playing state

// similarly once black player played and pressed the bottom

// it will play the voice: white's turn

// then rotate to 0 degree and go back to state1

void state2() {

  bottomDetect();

  if (isPress0) {

    voicePlay(3);

    state = 1;

    initBottom();

    myMotor.write(0);

    delay(2000);

  }

}


// this function is for naving between different state

// there was more state, but since we removed some functions, there're only 3 left

// Although we don't need using different states since it is getting simple, but since it works well, we don't reconstruct everything

void runStates() {

  switch (state) {

    case (0):

      state0();

      break;

    case (1):

      state1();

      break;

    case (2):

      state2();

      break;

  }

}


void loop() {

  runStates();

}