jiatians@andrew.cmu.edu – Intro to Physical Computing: Student Work https://courses.ideate.cmu.edu/60-223/f2018/work Intro to Physical Computing: Student Work Sun, 16 Dec 2018 16:38:47 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.25 Bingo Box by Team Jeffrey: Final Documentation https://courses.ideate.cmu.edu/60-223/f2018/work/bingo-box-by-team-jeffrey-final-documentation/ https://courses.ideate.cmu.edu/60-223/f2018/work/bingo-box-by-team-jeffrey-final-documentation/#respond Tue, 11 Dec 2018 23:27:28 +0000 https://courses.ideate.cmu.edu/60-223/f2018/work/?p=5154 overview

This project is a Bingo-style game for Jeffrey to play with his 6-year-old granddaughter, Stella. This game, partially disguised as trivia, would be used as a tool to spark conversations about interests and personal topics as a way to get both young kids and adult family members to know each other better. See here for documentation of our initial meeting with Jeffrey and see here for documentation of our prototype.

What we built

 

 

We built an electronic board-game, with very simple rules, which could be used for both a 73 year old and a 6 year old. The game-play is a mix between Trivial Pursuit, Bingo and Truth or Dare.

Before the game starts, each Player writes down a set of questions for the other player to answer. The use of this analog method is to create a constantly evolving game, which grows and complexifies as Stella does. Player 1 asks a question from their stack of cards, and player 2 picks a spot on the board and attempts to answer. If answered correctly, player one presses their green button which locks the location on the button pad (as seen in the image below). If the answer is wrong, however, the illuminated button disappears, and player 2 must try again in the next round. This format continue until one player obtains 5 lit-up buttons in a row.

For a long game play, penalty cards such as “Tell me a story in song” or “Invent a short dance routine”, may be given to the person who has answered wrong at the end of each turn. For a short game play, the penalty card may be given at the end of the game.

 

Player 1 reading a question card, while player 2 chooses a position on the button pad.

 

Detail shot of the LCD screen, giving the players indications: “Green asks, Pink answers.” You also get a sense of the box’s transparency, which was a customer request made by Jeffrey.

 

Detail shot of the button pad, correct and incorrect buttons, as well as the LCD screen. 

 

Detail shot of the speakers and box design on the back face.

 

Narrative Sketch

Stella gets dropped off by her single father at Jeffrey’s house, for their weekly Wednesday hangout. Stella would like to play a game, but Jeffrey isn’t sure how to successfully entertain a 6-year girl. Instead of having his wife help him out, he pulls out their customized board-game.

Stella likes to start, because she enjoys the pretty colors the button pad generates. As the game starts, a rainbow pattern illuminates the board, making Stella smile.

The first step of the game is for each player to write down a list of personalized questions on their assigned cards, which can be re-used or re-written as pleased. The aim of these questions is to generate conversation, and learn something from one another. Then, Stella starts by pressing a button of her chosen location on the button pad. Jeffrey asks her a question from his green deck of cards .

 

Player 1 chooses a location on the board.

Stella attempts to answer the question. If answered correctly, Jeffrey will select the green button, locking in the position on the buttonpad. If the answer is incorrect, Jeffrey presses the red button, and the button’s light goes out. Stella can then try again during the next round. In a long-play game, Stella would then have to perform a penalty found on the white stack of cards.

 

Player 2 reads the card from their stack, and prompts Player 1 to answer. If correct, Player 2 presses the “correct” button, and the button pad stays lit.

 

After Stella’s turn, Jeffrey can pick a position and attempt to answer a question. The game goes on until a player is able to line up 5 of their colored buttons on the pad. During a short play game, the loser must perform a penalty found on the white stack of cards, only at the end of the game.

 

When the game is over, the orange “reset” button can be pressed, a rainbow pattern appears and the board is cleared. 

 

How we got here

Initial Meeting and Brainstorm

On November 1st, 2018, our group – Chloé Desaulles, Jiatian Sun, Jianxiao Ge –  firstly met up with Jeffrey, who is an older man participating in the CMU Osher program, with the intention of building a useful device for him.

 

 

We had a meeting and interviewed Jeffrey in the university cafe. After the first interview, we started by brainstorming ideas to make Jeffrey’s life easier or more pleasurable. He did not seem to need anything fixed, so we tried to look into ways of enhancing good things in his life. It became clear very quickly that he kept gravitating towards his granddaughter Stella, and the time he and his wife get to spend with her. We additionally noticed that Jeffrey might not perfectly know how to interact with a six-year-old, often letting his wife entertain her.

Our main challenge was creating an interesting and fun game for such a wide age gap. Making a game intuitive and worth playing was a hard thinking exercise considering none of us had any game design experience. In addition, we needed to add physical computing elements into the game, which made it even harder.

Finally, we were inspired by the traditional game Gomoku & Bingo and decided to create a similar game with trivia elements, which match Jeffrey’s interests, and a simple and colorful button interface, with a changeable gameplay so the game can be adaptable as Stella grows up.

Preliminary sketches of our game board.

Prototype and the Second Meeting

After settling on the concept and gameplay, we started working on the layout and board design, option for big buttons with fun interactions, which would make the game more interesting to a 6-year-old. However, because large buttons took up too much space, we ended up with a medium sized button.

Working on the conceptualization and physical design/implementation of the game board.

We then started programming the colored buttons, LCD screen, and button pads separately and finally got together to merge our individual codes.

Jianxiao and Jiatian working on merging code sections.

The LCD screen welcoming Jeffrey and Stella to their custom game.

One of the biggest challenges we met during prototype was the core part of our game, the button pad. The RGB keypad we needed was out of stock at that time. We contacted the manufacturer Adafruit and received a reply that it would be two weeks before we could have the keypad available. Therefore, we had to order the LED version of the pad as an alternative in order to finish the prototype on time.

 

Setup of our first button pad trial with LED keypad.

 

Button Pad is able to light up according to the color of LED beneath it.

 

The completed first prototype.

We met Jeffrey again after the prototype presentation. Jeffrey seemed very excited by our prototype and believed he and Stella would have fun playing the game. He was also happy about our choices in tactility and color and even suggested we add sound (which is something we had been shying away from because we thought it might be irritating Jeffrey and his wife). What’s more, he gave us a lot of input when it came to the aesthetics of the board, suggesting we should make it out of clear acrylic so that Stella could see the colorful wiring on the inside. Some other fabrication advice he and Zach gave us included building a box to hold question and penalty cards. The crit was useful for our team and allowed us to move confidently forward with our design.

 

Jeffrey giving us feedback on our prototype.

 

Final Fabrication

After the second meeting, we adjusted the game based on the feedback. For example, combine the card box with the game board, add the game sound effect, and remove people’s name from the instruction on the LCD screen to involve other family members as well.

Chloé and Jiatian adjusting the game after the second meeting.

Another good news was that RGB Keypad, which was out of stock before, had been replenished. With the help of Zach, we got the keypad in time and immediately started to adjust the code as well as the soldering and testing.

Soldering four 4*4 RGB Keypads together.

At the same time, we started the design of the game box and material preparation. According to Jeffrey’s suggestion, we chose the white fog-faced acrylic as the main material to highlight the colorful buttons and create a light and transparent visual effect.

We sketched the game board by hand and determined the general layout. After actually measuring the size of each part, we drew it exactly one-to-one and then redrew it in our laptop using Autocad and Adobe Illustrator.

 

Rough hand sketch of game board design and dimensions.

 

Drawing it one-to-one after measuring the size of each part.

 

While Jiatian was in charge of the code adjustment and part testing,  Chloé and Jianxiao took the acrylic to the laser cut studio. The laser cutting process was not as smooth as expected. Because of the measuring error, the buttons and the LCD screen couldn’t be embedded smoothly. So we measured again, adjusted the size and then carried out a second laser cut, finally got the panel in line with the requirements and started the assembly.

 

During the assembly, we found that the card box was smaller than expected, so the card could only be erected. But we thought it would make it easier to pull out the cards and make the game go more smoothly, so we didn’t redo the box.

 

On December 4th, a month after the initial meeting, we had the final presentation and met Jeffrey again. We were delighted to see that he was very pleased with our final product. He played the game with us and was ready to give it to his granddaughter Stella as a Christmas present.

Jeffrey playing the game with us during the final desk crits.

Here is our team! (From left to right: Jiatian Sun, Jeffrey, Chloé Desaulles, Jianxiao Ge)

Conclusions and lessons learned

To our surprise, almost all of the oral feedbacks we received during the final crit were positive, whether it was about the experience of the game or the design of the box itself. (which, of course, could be because people were too shy to make suggestions in person). We were happy to see that older people seemed to be very interested in the game. Some of them even thought that it had commercial value. Since the question cards can be written by the players themselves, it gives the game more possibilities. It can be a bridge for family members to communicate and learn from each other, even if there is a huge age gap.

After the crit, we also see a lot of very good advice from the written feedback. For example, “It would be useful to add the name/instructions onto the game.” Because of the novel mechanics of the game, people may be confused when they start to play. Although we try to give each step a hint on the LCD screen, some instructions are not clear and accurate due to the size of the screen. At the same time, an extra game description may help people understand the game faster.

Here is another one: “It could be smaller/thinner – effects portability. Would be nice if users could choose which colors they are in the button pad – maybe they have a favorite color.” The final volume of the game box was indeed larger than we expected. In order to prevent the electronic components from being unable to fit, we reserved much space during the box design. But when we actually assembled it, we found that most of the space in the box was empty. If we can make full use of space, the game can be greatly improved in portability (although the portability may be not that important for a family game box). For the color part, we did take Jeffrey and Stella’s preferences into account and set up keyboard lighting based on their favorite colors. It might be a better idea to let players themselves choose the own lighting colors.

We didn’t have much experience working with older people before, but the process of working with Jeffrey was very pleasant. He was very talkative and provided us with many practical suggestions, which helped us adjust in different stages and finally completed a work that satisfied us all. Due to the time limit, our initial interview could only be held in the university cafe. Although we talked a lot, it seemed difficult for us to get Jeffrey’s demand quickly from his conversation, which made us struggle about where to start in the brainstorm. Next time we have the opportunity to cooperate with the elderly, maybe we will choose their home as the interview place. On the one hand, it can make them feel more comfortable and be willing to talk more, on the other hand, it is more convenient for us to observe the details of their life so that we can understand their needs more quickly.

All in all, this project is an interesting interdisciplinary cooperation experience. We had a lot of brainstorming in the early stage and repeatedly discussed and improved the design scheme according to Jeffrey and Zach’s feedback. In the post-fabrication stage, we divided the work according to everyone’s background and expertise, and finally achieved satisfactory results. If you have any more questions or suggestions, please feel free to contact us by email: jianxiag@andrew.cmu.edu, thanks!

Technical details

Schematic

Code

/* 
 *  This code makes reference to sample code of Adafruit seesaw liborary
 * whose source code can be viewed at https://github.com/adafruit/Adafruit_Seesaw
 * 
 * Game Logic part Author: Caroline Sun & Jianxiao Ge
 * This is a game is similar to Bingo. To create a enjoyable gaming experience, we add extra
 * features like playing sound sound to the game.
 */
 
#include "Adafruit_NeoTrellis.h"
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

#define DEBUG 1

// TONES  ==========================================
// Start by defining the relationship between 
//       note, period, &  frequency. 
#define  c     3830    // 261 Hz 
#define  d     3400    // 294 Hz 
#define  e     3038    // 329 Hz 
#define  f     2864    // 349 Hz 
#define  g     2550    // 392 Hz 
#define  a     2272    // 440 Hz 
#define  b     2028    // 493 Hz 
#define  C     1912    // 523 Hz 
// Define a special note, 'R', to represent a rest
#define  R     0

#define Y_DIM 8 //number of rows of key
#define X_DIM 8 //number of columns of keys

//Define game states
#define QUESTION 0
#define ANSWER 1
#define NEXT 2

//Define Answer to Questions
#define YESJ 2
#define YESS 4
#define NOJ 3
#define NOS 5

//Define button pins
#define RESET 6
#define NEXTJ 5
#define NEXTS 6

//Define player states
#define STELLA 0
#define JEFFREY 1

//Define Board Value
#define MIDDLE 3
#define INVALID (-1)
#define BINGOSIZE 5

//Define speaker pins
#define SPEAKER 9

//Color value
int val = 125;

//Declare game States
int isStart;
int state;
int player;
int currSquare;
int scoreS;
int scoreJ;
int SIZE = 8 ;
int totalSize = SIZE * SIZE;
int board[64];

// Set overall Speaker configuration
long tempo = 10000;
int pause = 1000;
int rest_count = 100;


// MELODY and TIMING  =======================================
//  melody[] is an array of notes, accompanied by beats[], 
//  which sets each note's relative length (higher #, longer note) 

//This is the tune of correct answer
int successMelody[] = {  c,  e,  g,  C, C, C};
int successBeats[]  = { 8, 8, 8,  8, 8,8}; 
int SUCCESS_MAX_COUNT = sizeof(successMelody) / 2; 

//This is the tune of wrong answer
int failureMelody[] = {  g,  e,  d,  c, c};
int failureBeats[]  = { 8, 8,  8,  8, 8}; 
int FAILURE_MAX_COUNT = sizeof(failureMelody) / 2; 

//This is the tune of winning
int winMelody[] = {  e,  e,  e,  e, f, f, f, f,  g,g, g, g, g, g, g, g, f, f, f, f,  e,e, e, e, d, d, d, d};
int winBeats[]  = { 16, 16, 16, 16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16};
int WIN_MAX_COUNT = sizeof(winMelody) / 2; 

//This is the tune of reset
int resetMelody[] = {  c,  c,  c,  c, g, g, g, g,  c,  c,  c,  c, g, g, g, g};
int resetBeats[]  = { 16, 16, 16, 16, 16,16,16,16, 16, 16, 16, 16,16,16,16,16};
int RESET_MAX_COUNT = sizeof(resetMelody) / 2; 


// PLAY TONE FUNCTION  ==============================================
// Pulse the speaker to play a tone for a particular duration
void playTone(int tone_, int beat, int duration) {
  long elapsed_time = 0;
  if (tone_ > 0) { // if this isn't a Rest beat, while the tone has 
    //  played less long than 'duration', pulse speaker HIGH and LOW
    while (elapsed_time < duration) {

      digitalWrite(SPEAKER,HIGH);
      delayMicroseconds(tone_ / 2);

      // DOWN
      digitalWrite(SPEAKER, LOW);
      delayMicroseconds(tone_ / 2);

      // Keep track of how long we pulsed
      elapsed_time += (tone_);
    } 
  }
  else { // Rest beat; loop times delay
    for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count
      delayMicroseconds(duration);  
    }                                
  }                                 
}

//Play Melody function
void playMelody(int* pitches, int* beats, int count){
  // Set up a counter to pull from melody[] and beats[]
  int tone_,beat,duration;
  for (int i=0; i<count; i++) {
    tone_ = pitches[i];
    beat = beats[i];

    duration = beat * tempo; // Set up timing

    playTone(tone_,beat,duration); 
    // A pause between notes...
    delayMicroseconds(pause);
  }
}

//create a matrix of trellis panels
Adafruit_NeoTrellis t_array[Y_DIM/4][X_DIM/4] = {
  
  { Adafruit_NeoTrellis(0x2E), Adafruit_NeoTrellis(0x2F) },

  { Adafruit_NeoTrellis(0x30), Adafruit_NeoTrellis(0x31) }
  
};


//pass this matrix to the multitrellis object
Adafruit_MultiTrellis trellis((Adafruit_NeoTrellis *)t_array, Y_DIM/4, X_DIM/4);


//Print Board Function for testing
void printBoard(){
  Serial.println("board");
  for(int i = 0;i < totalSize;i++){
    Serial.print(board[i]);
    Serial.print(" ");
  }
  Serial.println("");
}

//Helper function that cleans up a array
void cleanArr(int *arr, int n){
  for(int i = 0; i < n;i++){
    arr[i] = 0;
  }
}


//Write a two-line message to the LCD screen
void writemessage(String message1, String message2){
   lcd.backlight();
   lcd.setCursor(0, 0);
   lcd.print(message1);
   lcd.setCursor(0, 1);
   lcd.print(message2);
}

//Turn on the button first being pressed
int turnOnFirstPressed(int num){
  int val = 125;
  if(player == JEFFREY) val = 255;
  trellis.setPixelColor(num, Wheel(val));
  trellis.show();
  return num;
}


// Input a value 0 to 255 to get a color value.
// The colors are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return seesaw_NeoPixel::Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return seesaw_NeoPixel::Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return seesaw_NeoPixel::Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  return 0;
}


//Check if one index is in bound of a board
bool inBound(int x, int y, int width, int height){
  return x>=0 && y >=0 && x < width && y <height; 
}

//define a callback for key presses
TrellisCallback blink(keyEvent evt){
  
  if(evt.bit.EDGE == SEESAW_KEYPAD_EDGE_RISING){
    //Wheel(map(evt.bit.NUM, 0, X_DIM*Y_DIM, 0, 255))
    Serial.print("blink! ");
    Serial.print(evt.bit.NUM);
    Serial.print(" ");
    Serial.print(val);
    Serial.println(" prit");
    trellis.setPixelColor(evt.bit.NUM, Wheel(val));
    val = val>125? 125: 225;
    
  }//on rising
  else if(evt.bit.EDGE == SEESAW_KEYPAD_EDGE_FALLING)
    trellis.setPixelColor(evt.bit.NUM, 0); //off falling
    
  trellis.show();
  return 0;
}

//The function that checks if there exists winner on the board
bool checkWinner(){
  int rowCorrect[2];
  int colCorrect[2];
  int diagDownCorrect[2];
  int diagUpCorrect[2];
  int currCont[2] = {0,0};
  
  cleanArr(rowCorrect,2);
  cleanArr(colCorrect,2);
  cleanArr(diagUpCorrect,2);
  cleanArr(diagDownCorrect,2);
  cleanArr(currCont, 2);

  //Check if there is bingo in a row
  for(int i = 0; i < SIZE; i++){
    for(int j = 1; j < SIZE; j++){
      int currP = board[i * SIZE + j];
      if(board[i * SIZE + j] == board[i * SIZE + j -1] && board[i * SIZE + j]!=INVALID){
        currCont[currP] += 1;
        if(currCont[currP] > rowCorrect[currP]) rowCorrect[currP] = currCont[currP];
      }
      else{
        cleanArr(currCont, 2);
      }
    }
  }

  cleanArr(currCont, 2);
  //Check if there is Bingo in a column
  for(int j = 0; j < SIZE; j++){
    for(int i = 1; i < SIZE; i++){
      int currP = board[i * SIZE + j];
      if(board[i * SIZE + j] == board[(i-1) * SIZE + j] && board[i * SIZE + j]!=INVALID ){
        currCont[currP] += 1;
        if(currCont[currP] > colCorrect[currP]) colCorrect[currP] = currCont[currP];
      }
      else{
        cleanArr(currCont, 2);
      }
    }
  }


  //Check if there is bingo in a diagonal
  for(int xShift = -SIZE +1; xShift<SIZE;xShift++){
  cleanArr(currCont, 2);
  for(int diagX = 1; diagX<SIZE;diagX++){
    int xPos = diagX + xShift;
    int yPos = diagX;
    int prevX = xPos -1;
    int prevY = yPos -1;
    if(!inBound(xPos,yPos,SIZE,SIZE) || !inBound(prevX,prevY,SIZE,SIZE)){
      cleanArr(currCont,2);
      continue;
    }
    int currP = board[yPos * SIZE + xPos];
    if(currP == board[prevY * SIZE + prevX] && currP!=INVALID){
        currCont[currP] += 1;
        if(currCont[currP] > diagDownCorrect[currP]) diagDownCorrect[currP] = currCont[currP];
      }
      else{
        cleanArr(currCont, 2);
      }
  }
  }

  for(int xShift = 0; xShift<2 * SIZE -1;xShift++){
  cleanArr(currCont, 2);
  for(int diagX = 1; diagX<SIZE;diagX++){
    int xPos = -diagX + xShift;
    int yPos = diagX;
    int prevX = xPos +1;
    int prevY = yPos -1;
    if(!inBound(xPos,yPos,SIZE,SIZE) || !inBound(prevX,prevY,SIZE,SIZE)){
      cleanArr(currCont,2);
      continue;
    }
    int currP = board[yPos * SIZE + xPos];
    if(currP == board[prevY* SIZE + prevX] && currP!=INVALID){
        currCont[currP] += 1;
        if(currCont[currP] > diagUpCorrect[currP]) diagUpCorrect[currP] = currCont[currP];
      }
      else{
        cleanArr(currCont, 2);
      }
  }
  }

  int sScore = max(colCorrect[STELLA],max(rowCorrect[STELLA],max(diagDownCorrect[STELLA],diagUpCorrect[STELLA])));
  int jScore = max(colCorrect[JEFFREY],max(rowCorrect[JEFFREY],max(diagDownCorrect[JEFFREY],diagUpCorrect[JEFFREY])));
  
  //Display the winner of the game
  if(sScore >= BINGOSIZE-1 && jScore >=BINGOSIZE-1){
    Serial.println("Both of you wins!");
    writemessage("  Both of you  ","    Wins!   ");
    playMelody(winMelody,winBeats,WIN_MAX_COUNT);
    return true;
  }
  if(sScore >= BINGOSIZE-1){
    Serial.println("Pink wins!");
    writemessage("     Pink       ","     Wins!      ");
    playMelody(winMelody,winBeats,WIN_MAX_COUNT);
    return true;
  }
  if(jScore >= BINGOSIZE-1){
    Serial.println("Green wins!");
    writemessage("     Green    ","      Wins!      ");
    playMelody(winMelody,winBeats,WIN_MAX_COUNT);
    return true;
  }
  return false;
}

//The callBack function on the Trellis Buttons
//This function tells the Button to update the game state, 
//if it is pressed when someone is answering question
TrellisCallback gameControl(keyEvent evt){
  if(isStart){
      // go through every button
   if(state == QUESTION){
      if(evt.bit.EDGE == SEESAW_KEYPAD_EDGE_RISING){
        currSquare = turnOnFirstPressed(evt.bit.NUM);
        if(currSquare>=0){
          state = ANSWER;
        }
     }
   }
  }
}

//Setup the game
void setup() {
  Serial.begin(9600);
  //while(!Serial);

  if(!trellis.begin()){
    Serial.println("failed to begin trellis");
    while(1);
  }

  //Register all buttons
  pinMode(YESJ,INPUT_PULLUP);
  pinMode(YESS,INPUT_PULLUP);
  pinMode(NOJ,INPUT_PULLUP);
  pinMode(NOS,INPUT_PULLUP);
  pinMode(NEXTJ,INPUT_PULLUP);
  pinMode(NEXTS,INPUT_PULLUP);
  pinMode(RESET,INPUT_PULLUP);

  //Register speaker
  pinMode(SPEAKER,OUTPUT);

  //Initialize LCD
  lcd.init();                      // initialize the lcd
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Pink & Green");
  lcd.setCursor(0, 1);
  lcd.print("Welcome to BINGO");

  //Clear board
  for(int i = 0; i< SIZE * SIZE;i++){
    board[i] = -1;
  }
  
  //Go through each button on the board and display different color
  for(int i=0; i<Y_DIM*X_DIM; i++){
      trellis.setPixelColor(i, Wheel(map(i, 0, X_DIM*Y_DIM, 0, 255))); 
      trellis.show();
      delay(20);
  }

  //Setup the trellis button pad
  for(int y=0; y<Y_DIM; y++){
    for(int x=0; x<X_DIM; x++){
      //activate rising and falling edges on all keys
      trellis.activateKey(x, y, SEESAW_KEYPAD_EDGE_RISING, true);
      trellis.activateKey(x, y, SEESAW_KEYPAD_EDGE_FALLING, true);
      trellis.registerCallback(x, y,gameControl);
      trellis.setPixelColor(x, y, 0x000000); //addressed with x,y
      trellis.show(); //show all LEDs
      delay(20);
    }
  }

  //Randomize a player to start the game
  float r = random()%2;
  if( r > 0){
    player = STELLA;
  }
  else{
    player = JEFFREY;
  }

  //Reset Game State
  isStart = 1;
  state = QUESTION;
  scoreS = 0;
  scoreJ = 0;
  currSquare = -1;

 //Display welcome message
  writemessage("Pink & Green","Welcome to BINGO");

}


void loop() {
  trellis.read();
  delay(20);

  //If Rest Button is pressed, reset the game
  if(digitalRead(RESET)<1){
    writemessage("     Reset!     ","                ");
    delay(500);
    playMelody(resetMelody,resetBeats,RESET_MAX_COUNT);
    setup();
    return;
  }
  //let the game continue only if the game has not ended yet
  if(isStart){
   //If it is question and question time
   if(state == QUESTION){
    
    //Display messages showing states
    if(player ==STELLA)
      writemessage("   Green asks     ", "  Pink answers    ");
    else
      writemessage("   Pink asks  ", "  Green answers   ");
   }
   //If it is revealing answer state,
   else if(state == ANSWER){
    if(player==STELLA){
      writemessage("   Is Pink's    ", " answer correct? ");
      //If Pink's answer is correct
      if(digitalRead(YESJ)<1){
        board[currSquare] = STELLA;
        Serial.print("Pink places at position: ");
        Serial.println(currSquare);
        printBoard();
        //play music
        playMelody(successMelody,successBeats,SUCCESS_MAX_COUNT);
        //Change game state to next round
        currSquare = -1;
        state = QUESTION;
        isStart = !checkWinner();
        player = !player;
      }
      //If Pink's answer is wrong
      else if(digitalRead(NOJ)<1){
        trellis.setPixelColor(currSquare, 0);
        trellis.show();
        //play music
        playMelody(failureMelody,failureBeats,FAILURE_MAX_COUNT);
        //change game state to next round
        currSquare = -1;
        state = QUESTION;
        isStart = !checkWinner();
        player = !player;
      }
    }
    else{
      writemessage(" Is Green's  ", "answer correct? ");
      //If Green's answer is correct
      if(digitalRead(YESS)<1){
        board[currSquare] = JEFFREY;
        Serial.print("Green places at position: ");
        Serial.println(currSquare);
        printBoard();
        playMelody(successMelody,successBeats,SUCCESS_MAX_COUNT);
        currSquare = -1;
        state = QUESTION;
        isStart = !checkWinner();
        player = !player;
      }
      //If Green's answer is wrong
      else if(digitalRead(NOS)<1){
        trellis.setPixelColor(currSquare, 0);
        trellis.show();
        playMelody(failureMelody,failureBeats,FAILURE_MAX_COUNT);
        currSquare = -1;
        state = QUESTION;
        isStart = !checkWinner();
        player = !player;
        
      }
    }
   }
  }
  
}

Chloé Desaulles

Jiatian Sun

Jianxiao Ge

]]>
https://courses.ideate.cmu.edu/60-223/f2018/work/bingo-box-by-team-jeffrey-final-documentation/feed/ 0
Team Jeffrey – Prototype Documentation https://courses.ideate.cmu.edu/60-223/f2018/work/team-jeffrey-prototype-documentation/ https://courses.ideate.cmu.edu/60-223/f2018/work/team-jeffrey-prototype-documentation/#respond Thu, 15 Nov 2018 18:05:36 +0000 https://courses.ideate.cmu.edu/60-223/f2018/work/?p=5009

 

Introduction

This post is a detailed explanation of our team’s process towards a functioning behave’s-like prototype. After our first conversation with our older collaborator Jeffrey, we decided to make a bingo-style game for him to play with his 6 year old granddaughter, Stella. This game, partially disguised as trivia, would be used as a tool to spark conversations about interests and personal topics as a way to get to know each other.

 

 

Part one of Prototype Demo

Part two of Prototype Demo

Product

This game is essentially a mix of the core ideas behind trivial pursuit, bingo and truth or dare. Each user comes up with a set of questions which are personally relevant to them at the beginning of each game, and then switch stacks. This allows for it to be analog and generative, a constant change of questions and induced conversation between each game. Player A picks a card from player B’s stack, reads the question and attempts to answer it. Example questions could be: Who is my favorite artist? What are the lyrics to the star spangled banner? How did I meet my wife? What do I want to be when I grow up? What is Taylor Swift’s new hit song?

 

If answered correctly, player A gets to choose a box, which will illuminate to show the person’s color. Player A may then press the “Correct” button, to forward the turn to player B.

 

If answered incorrectly however, player A must pick a penalty card. Penalty cards require you to complete a certain task, such as inventing a funny song on the spot about a given sentence, or telling a story as a response to a prompt. When the story is completed, player A presses “Incorrect” and forwards the turn to player B. No buttons light up.

The buttons serve as a function to alternate turns and keep count of score.

The first player to reach five boxes in a row wins the game.

 

Process

 

We started by brainstorming ideas to make Jeffrey’s life easier or more pleasurable. He did not seem to need anything fixed, so we started looking into ways of enhancing good things in his life. It became clear very quickly that he kept gravitating towards his granddaughter, and the time he and his wife get to spend with her. We additionally noticed that Jeffrey might not perfectly know how to interact with a six year old, often letting his wife entertain her. We therefore decided to create a game with trivia elements, which match Jeffrey’s interests, and a simple and colorful button interface, with a changeable game play so the game can be adaptable as Stella grows up.  

 

Preliminary sketches of our game board

 

We started by creating a game plan, which would be fitting for both a 6 and 73 year old.  This ended up being on of our biggest challenges, as none of our group members had any game design experience.

 

Working on conceptualization and physical design/implementation of the game board.

 

After settling on a concept and game play, we started working on layout and board design, option for big buttons with fun interactions, which would make a ‘trivia’ game more interesting to a 6 year old.

Setup of  our first button pad trial. We are currently waiting for the RGB version of the pads, which should arrive in the mail in a week or two.

 

We then started programming the colored buttons, LCD screen and button pads separately and finally got together to merge our individual codes.

Button Pad are able to light up according to the color of LED beneath it.

The LCD screen welcoming Jeffrey and Stella to their custom game.

 

J and Ca working on merging code sections.

 

Last Tuesday, we were lucky to be able to meet with Jeffrey again to discuss our idea and game implementation. We received a lot of design feedback. He seemed very excited overall at the idea of being able to play this new custom game with Stella.

 

Jeffrey, Ca and C discussing game intricacies and board aesthetics.

 

 

Discussion

As mentioned prior, because our team is so diverse and complementary in skill set, our main challenge was creating an interesting and fun game for such a wise age gap. Making a game intuitive and worth playing was a hard thinking exercise considering none of us had any game design experience.  We ended up settling on a malleable and analog game, which would allow Jefferey and Stella to change the questions by hand as Stella grows older. We additionally tried to make the  interface loose so Stella can invent her own rules if she one day wishes.

 

November 13th critique:

Jeffrey seemed very excited by our prototype and believed he and Stella would have fun playing the game. He gave us a lot of input when it came to the aesthetics of the board, suggesting we should make it out of clear acrylic so that Stella could see the colorful wiring on the inside. Some other fabrication advices he gave us include building a box to hold question and penalty cards.

The crit was useful for our team and allowed us to move confidently forward with our design. Jeffrey in particular seemed happy about our choices in tactility and color, and even suggested we add sound (which is something we had been shying away from because we thought it might be irritating Jeffrey and his wife).

Over the next few weeks, we will be starting fabrication while waiting for the RGB button pads. We will working on making a clean and durable product, which will hopefully bring joy to Jeffrey and Stella for a long time.

]]>
https://courses.ideate.cmu.edu/60-223/f2018/work/team-jeffrey-prototype-documentation/feed/ 0
Final Project – Initial Meeting with Jeffrey https://courses.ideate.cmu.edu/60-223/f2018/work/initial-meeting-with-jeffrey/ https://courses.ideate.cmu.edu/60-223/f2018/work/initial-meeting-with-jeffrey/#respond Tue, 06 Nov 2018 16:24:29 +0000 https://courses.ideate.cmu.edu/60-223/f2018/work/?p=4866 A brief introduction

On November 1st, our group (David, Caroline and Chloé) met up with Jeffrey, an older man participating in the Osher program next to our physical computing lab, with the intention of building him a useful device. In order to do so, it was necessary for our group to gain a better understanding of who he was as a person: what he enjoyed doing, what tasks he had issues completing, what the course of his day looked like. We bought him a coffee and sat down to talk about his life.

our meeting agenda
  • Introduction to our past projects
  • Talk about assistive device research, how we started by doing it for ourselves
  • Show each individual project and talk about our technical abilities
  • Ask Jeffrey to tell us about himself, including his habits and self-identified personality traits.
  • Ask Jeffrey to share an experience he has really enjoyed recently.
  • Ask Jeffrey to tell us about his hobbies/what he enjoys doing in his free time.
  • Ask Jeffrey when was the last time he felt frustrated with something in his home and at work.
Meeting summary and major takeaways

As we started the conversation with questions mainly in two directions: Jeffrey’s interest and problems he faces, the discussion initially carried out with emphasis on Jeffrey’s personal interest, daily activities and the arrangement of his house. However, we later discovered that when talking about his own life, he talked a lot about his granddaughter Stella, for example, his granddaughter’s favorite shows, his granddaughters’ hobbies, his granddaughters’ achievements in primary school and so on. Thus, with more questions focusing on interactions between his granddaughter and him, we discovered that he and his wife moved to Pittsburgh actually to help their son taking care of their granddaughter.

However, Jeffrey also acknowledged that he rarely participates in Stella’s favorite activity in spare time: cooking, since this always create a huge mess in the kitchen. Therefore, we thought it would be meaningful to create an implement that can let Jeffrey and Stella share some meaningful time together and enhance their understanding for each other. This eventually became the main focus of the talk, yet before coming down to this thought, we have drifted through a lot of other options, for example, making a comparatively intelligent suitcase for Jeffrey, since he suggested that he needs a “self-driving” suitcase to carry his lecture materials around, which is obviously too hard to be finished in such a short duration of time.

Also, he proposed that if we are trying to make anything related to his hobby of playing tennis, it could be something that improves his forehand. These options generally turned out to be too hard for us as the course project and there was not much we can improve for these options.

Therefore, even though we discussed broadly with Jeffrey from different aspects of his life, eventually we narrow down to his interaction with his granddaughter.

Meeting with Jeffrey in the cafe.

our thoughts after holding the meeting and discussing as a team

Jeffrey is very approachable, so the whole meeting followed our agenda and went very smoothly. Although he is a retired man, he has a really busy schedule and teaches several courses at the same time. We tried to start brainstorm from the problems he met during the daily life but found that he seemed to keep everything in order while what he suggested us to build is too hard, making us a little overwhelmed at one point. Finally,  we decided to start our design with his interaction with his granddaughter.

Ideation sketching during group meeting

The first interview was done in a university cafe because time was tight. The whole team thought the discussion was going well, but we would like to visit him at his house next time so that we could observe the details of his life more carefully, and also communicate with his wife and granddaughter, which would be very helpful for us to know Jeffrey better.

 

Chloé Desaulles

Jiatian Sun

Jianxiao Ge

 

]]>
https://courses.ideate.cmu.edu/60-223/f2018/work/initial-meeting-with-jeffrey/feed/ 0
Don’t Chew Your Nail https://courses.ideate.cmu.edu/60-223/f2018/work/dont-chew-your-nail/ https://courses.ideate.cmu.edu/60-223/f2018/work/dont-chew-your-nail/#respond Thu, 25 Oct 2018 19:05:12 +0000 https://courses.ideate.cmu.edu/60-223/f2018/work/?p=4588 Don’t Chew Your Nail

The glasses helps people stop chewing their nails by warning them with a vibrator when their hands come to close to their faces.

Detailed look of the glasses

Overview of the glasses that helps you stop chewing nails

 

 

Inside of the glasses

Look of Vibrator from the Outside

Tape for hiding wires has Consistent Color With the glasses Frame

How the glasses work

  1. Wear the glasses
  2. Try to chew your nail
  3. The vibrator of the glasses starts vibrating

Decision Points in the Design Process

First Decision Point: IR Proximity Sensor to IR Distance Ranger

Initially my design was to use the infrared proximity sensor, since it is small and fit good onto a glasses. Yet after testing on the breadboard, I figured out that the proximity sensor is only sensible to items around 5 centimeters away from it, which is shorter than the distance from my eyes to my mouth.

The initial design was to use the IR proximity sensor

Thus, I researched online the sensor distance for all available distance sensors in the lab and it turned out that IR distance ranger is able to detect items 20 centimeters away from it. Thus, I changed my design, even though IR distance ranger will look larger than the proximity sensor.

Later design changed to use IR ranger

Second Decision Point: From 9v Battery to 6v button Batteries

Change to the button battery

Initially, I made use of 9v amazon battery, yet later on I changed to use battery buttons which are easier to hide and significantly lighter.

Other process Images

Try to solder wires onto Arduino nano

Try to record the correct position of sensor I finally got by a lot of trials

Discussion

Response

Critique One: Hide the mechanical part better

“Use a better containment to hold wires/sensors.”

“It would look better if the sensors can be hidden.”

“Think of making aesthetic improvements to your sunglasses, especially since you would be wearing them everyday.”

I agree that I need to make improvement to the look of the glasses by hiding mechanical parts better. The overall look of the glasses could have been largely improved if I have drilled holes through the glasses and pull wires through the interior of the glasses. However, because of the limitation of time and some wires needed to be re-soldered frequently, that failed to achieve finally.

Critique 2: Good use of sensors for detection

“Cool use of sensors”

“Two sensors: great way to detect the motions”

Besides using two sensors for detection,  I also need to figure out the orientation of both sensors so that they can be directed towards user’s mouth. This turned out to be tons of trials and errors and since I used tape to hold the sensors, it took me some time to fix sensors towards a certain direction to prevent them from turning away as the tape looses.

Self-critique

I really need a device to solve my nail chewing problem, so the idea behind the project was good initially. However, the sunglasses is not something wearable for daily life, especially not in winter of Pittsburgh. Yet, the sunglasses is a good choice for simply demo of the concept, since it is cost effective and reduces the difficulty of hiding wires with its large frame. Another problem is that I should have hided wires better by cutting and drilling the glass frame, so I can get rid of tapes on the glasses. Before the critique, when I resolved to use tapes because I needed to re-solder the Arduino frequently, I chose to use tapes that have consistent color with the glasses to hide wires below them better.

Also, in retrospect,  I could have done better with soldering. My project eventually failed to work because several wires broke just before the critique. Now, I realized that probably I should have used softer wires to connect different components on Arduino. Specifically, when I tried to connect the button battery to the Arduino, I used wires so hard that they frequently broke free of the soldering tin that wrapped around them.

What I Learned

What I learned about soldering is mentioned in the self-critique. Apart from that, another thing I learned is to make better management of time. Setting milestones for my project could have saved me more time to make better fabrication in my project.

Next steps

The next step will be changing from the sun glasses to glasses with lenses fitting to my eyes. To achieve this, I should re-solder my Arduino nano and figure out a working configuration for holes to contain wires on  the sunglasses. Then, I can redo the fabrication that I have done to the sunglasses to a normal glasses and transfer the chip to the normal glasses.

Schematic

“Don’t Chew Your Nail” Schematic

 Code

/*
 * Author: Caroline Sun
 * Description:
 * the code takes input from 2 distance sensor
 * and turns on the vibrator only when the object 
 * is close to both sensors
 */

int DISTANCEPIN = A3;
int DISTANCEPIN2 = A0;
int VIBRATORPIN = 11;
int LIGHTPIN = 13;

//Initialization
void setup() {
  pinMode(DISTANCEPIN,INPUT);
  pinMode(DISTANCEPIN2,INPUT);
  pinMode(VIBRATORPIN,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int dis = analogRead(DISTANCEPIN);
  int dis2 = analogRead(DISTANCEPIN2);
  Serial.println(dis);
  //Only start the vibrator if the hand is at the middle of the face
  if(dis>200 && dis2>200){ 
   digitalWrite(VIBRATORPIN,HIGH);
   digitalWrite(LIGHTPIN,HIGH);
  }
  else{
   digitalWrite(VIBRATORPIN,LOW);
   digitalWrite(LIGHTPIN,LOW);
  }
  delay(20);
  
  
}
]]>
https://courses.ideate.cmu.edu/60-223/f2018/work/dont-chew-your-nail/feed/ 0
Project 1: Surprise: “High Five!” https://courses.ideate.cmu.edu/60-223/f2018/work/project-1-surprise-high-five/ https://courses.ideate.cmu.edu/60-223/f2018/work/project-1-surprise-high-five/#respond Tue, 25 Sep 2018 15:27:11 +0000 https://courses.ideate.cmu.edu/60-223/f2018/work/?p=4036

High Five Box

Narrative

A wooden cube with a cardboard hand sticking out of one side. When the user tries the “high-five” the hand, the hand swivels back into the cube and a second hand pops up on a different side of the cube. Now, when the user tries to “high-five” the second hand, it swivels back inside the cube and the first hand flips back out again.

Design details

Taped wires inside the box to create turning space for the hand

Well-cut hole to fix the motor at the top of the box

How to Trigger the surprise

Try to “high five” with the hand

The hand refuses your high five and turns away.

Design Process

Testing out the appropriate sensing distance for the distance ranger

We started off testing the appropriate distance we should set for the distance ranger.

Paper Box Prototype

Later, when Roy was lazer-cutting the box, Caroline tried to figure out the turning angle of the hand by testing the motor and sensor in a paper box. We thought about putting the hand and the sensor on the same surface so that we can hide sensor and forces users to approach the sensor if they want to do high-five. This is why the paper box has . It turns out that the sensor can only have a correct detection of distance when it is facing up, so we eventually changed our plan to let both sensors stick out and face up.

Creating the Hand

After testing the sensor and motor, we started cutting the cupboard hand to fit onto the motor. We made several cupboard hands, since the initial design was too  large to fit into the box. .

Box On Top of Shelf

One interesting thing happened before our presentation is that because we set the sensor to be so sensitive that if we placed it in a cube it would turn forever until running out of battery, so we had to place it at the top of the shelf.

Schematic

High Five Box Schematic

LINK TO CODE
#include <NewPing.h>
#include<Servo.h>

boolean isFirstHand = true;

#define TRIGGER_PIN1  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN1     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE1 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

#define TRIGGER_PIN2  8  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN2     9  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE2 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
#define TOOCLOSE 20

#define HANDSPIN 6
NewPing sonar1(TRIGGER_PIN1, ECHO_PIN1, MAX_DISTANCE1); // NewPing setup of pins and maximum distance.
NewPing sonar2(TRIGGER_PIN2, ECHO_PIN2, MAX_DISTANCE2);
Servo hands;


void setup() {
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
  hands.attach(HANDSPIN);
}

void loop() {
  int dataNum = 5;
  int distance1[dataNum];
  int distance2[dataNum];

  //Collect some data from each sensor
  for(int i = 0;i<dataNum;i++){
    delay(20);
    distance1[i] = sonar1.ping_cm();
    distance2[i] = sonar2.ping_cm();
  }

  //Get rid of the highest and lowest data for each sensor
  //and get the average of the remaining data
  int distanceSum1 = 0;
  int distanceSum2 = 0;
  int distancemax1 = -1;
  int distancemax2 = -1;
  int distancemin1 = 10000;
  int distancemin2 = 10000;
  for(int i = 0; i<dataNum;i++){
    distanceSum1 = distanceSum1 + distance1[i];
    distanceSum2 = distanceSum2 + distance2[i];
    if(distance1[i]<distancemin1){
      distancemin1 = distance1[i];
    }
    if(distance2[i]<distancemin2){
      distancemin2 = distance2[i];
    }
    if(distance1[i]>distancemax1){
      distancemax1 = distance1[i];
    }
    if(distance2[i]>distancemax2){
      distancemax2 = distance2[i];
    }
  }
  double distanceAvg1 = (double)(distanceSum1 - distancemin1 - distancemax1)/(double)(dataNum-2);
  double distanceAvg2 = (double)(distanceSum2 - distancemin2 - distancemax2)/(double)(dataNum-2);

  //Print out the data 
  Serial.print("Ping1: ");
  Serial.print(distanceAvg1); // Send ping, get distance in cm and print result (0 = outside set distance range)
  Serial.println("cm");
  Serial.print("Ping2: ");
  Serial.print(distanceAvg2); // Send ping, get distance in cm and print result (0 = outside set distance range)
  Serial.println("cm");

  //If something approaches sensor to a certain distance,
  //the motor would be turned
  if(distanceAvg1<= TOOCLOSE){
    if(isFirstHand){
      isFirstHand = false;
      hands.write(0);
      delay(500);
    }
  }
  if(distanceAvg2<=TOOCLOSE){
      if(!isFirstHand){
        isFirstHand = true;
        hands.write(80);
        delay(500);
      }
  }

  
}

 

Discussion

. So wiring the circuit was rather quick and simple. We predicted that writing the code would be easy as well, however, it was more complex than we anticipated because of the unreliability of the ultrasonic sensors. The sensors would read erratic distances so we had to implement a filtering function so that the distances the Arduino was receiving were more accurate. Essentially, we took the median of every five distance readings and this helped the accuracy of the ultrasonic sensors.

Another process that turned out to be more difficult than we thought it would be was the fabrication of the final setup. Designing the cube so that the servo and sensors would be in the right locations required a lot of measuring and relatively tight tolerances. The process of laser cutting the wood was also more difficult than it should have been because the laser cutter we first used didn’t perform reliably to our inputs.

From doing this project we learned that we can’t assume everything we use is going to function perfectly. The ultrasonic sensors’ unreliability and the malfunctioning laser cutter added a lot of complications that we didn’t originally account for. If we were to do the project again, we would probably add a feature to the box that hid the ultrasonic sensors to increase the element of surprise. Or we might even have considered different sensors that could operate from inside the cube. There are some other small things that could have be done to increase the surprise factor so if we had spent less time in the idea generation phase and more time in making the actual project then we could have made a more surprising device. One thing we could have done to trick the user is add a phony functionality that the user could see but it didn’t actually do anything. For example, we could have put the cube on wheels so the user would think that the cube would move at some point but we would keep the motors completely passive. We had a lot of fun doing this project and it made us realize all the devices you can create with relatively simple circuits and hardware.

 

]]>
https://courses.ideate.cmu.edu/60-223/f2018/work/project-1-surprise-high-five/feed/ 0
Training Heart Rate Zone Monitor Watch https://courses.ideate.cmu.edu/60-223/f2018/work/training-heart-rate-zone-monitor-watch/ https://courses.ideate.cmu.edu/60-223/f2018/work/training-heart-rate-zone-monitor-watch/#respond Thu, 30 Aug 2018 12:06:08 +0000 https://courses.ideate.cmu.edu/60-223/f2018/work/?p=3846 Project Title: Training Heart Rate Zone Monitor Watch

Project Creator: Ashley Hah and Marissa Kuhns

Short Description:  A useful heart rate detection watch that can be worn doing training to show the heart rate level of the runner. Heart rate levels are shown by different colors of the watch in real time.

Response: I think the project is well designed, since changing color gives runners immediate feedback on their heart rate levels which make it possible for runners to adjust their speed at appropriate time. It would be better if the watch has internet or bluetooth connection so that it can send data back to the user and data can be analyzed to give the user better training plan.

]]>
https://courses.ideate.cmu.edu/60-223/f2018/work/training-heart-rate-zone-monitor-watch/feed/ 0