Midterm project documentation: Light Maze – Shuyang Cai (Eric)

CONTEXT & SIGNIFICANCE:

During my previous research, I believe that it must involve effective communication and a certain level of exploration for a machine to be defined as interactive. Referring back to all the interactive projects I have come across, I found that they mainly fall into two categories: the functional ones (the eye-movement tracking machine for paralyzed people) and the entertaining ones (the R2D2 model shown on the class). Therefore, my partner and I decided to come up with a proposal that not only includes the two crucial characteristics of interactivity but also serves a particular function or entertains people. Basically, the main idea of our project came from one of the tasks during Recitation 3, in which joystick is used to control LEDs. By creating a 3*3 square matrix consisted of LEDs with different colors, we intend to create an entertaining maze game that requires people to reach the endpoint as fast as possible. The use of joystick actually guarantees the effectiveness of the communication between humans and the devices, for the joystick is better at sensing human movements and changing the resistance immediately and accordingly. Also, in order to promote its interactivity and entertaining ability, we designed two sets of mazes, so that two people can play the game at the same time and compete with each other. The significance of this project lies in that, as an entertaining game, everyone is able to play it, compete with their friends and enjoy themselves by doing so.

CONCEPTION AND DESIGN:

Initially, we added an instruction light and a buzzer to promote the interaction between users and our project. Once people successfully reached the endpoint, the instruction light in front of the maze will light up and the buzzer installed in the box will go off. Also, once people move through a LED and light it up, it wonā€™t turn off even after they make the next move, so as to record the paths that users have taken. To make the exterior of the project nice and neat, we designed a box to hide the main body of the circuit, and we decided that the material of the box would be wood, for plastic material is transparent but we donā€™t want people to see the circuit. It also seems to us that the texture of wood materials is a better fit of the maze than plastic materials. The only tricky thing is that we donā€™t know how big our box is going to be at the first place, so we actually cut a rather small box and later when we finished building the circuit, we found that there is no way we can put the circuit in the box. Therefore, we had to cut another larger box. We also had to make sure that the holes are of the exact size that the legs of LEDs can go through them, while the bulb has to be stuck on the surface of the board.

Previous version

Final version

Apart from laser cutting the wooden box, another challenge is to write the code. We defined the usersā€™ movement by giving xvalue and yvalue a certain range, and we also used two conditions in an if structure to define which LED lights up once a move is made. However, this way of coding only works with green LEDs, which are designed to be the normal path. When we try to apply the same code to the yellow LEDs, which provide chances of either speed up or slow down, it doesnā€™t work anymore. However, we eventually fixed this problem with the help of our professor. It turns out that to take every possibility of each move into consideration, it is not enough to just define what the movement is. It is also required to define the current position from which the move is made. Before the usersā€™ test, we had one set of the game done but without any red light, meaning that there is no way a player can die. Everyone can successfully reach the endpoint, it is just a matter of time.

Code:

#include “pitch.h”
int currentPosition = 2;
int melody[] = {
NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4
};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
4, 8, 8, 4, 4, 4, 4, 4
};

void setup() {
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10,OUTPUT);
pinMode(11, OUTPUT);
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);

digitalWrite(2, HIGH);
digitalWrite(10, HIGH);
digitalWrite(12, HIGH);
Serial.begin(9600);

}

void loop() {

int xvalue = analogRead(A1);
int yvalue = analogRead(A0);

boolean moveRight = false;
boolean moveLeft = false;
boolean moveUp = false;
boolean moveDown = false;

if (xvalue < 270) {
moveRight = true;
} else if ( xvalue > 750) {
moveLeft = true;
} else if (yvalue < 270) {
moveUp = true;
} else if (yvalue > 750) {
moveDown = true;
}

// Position 2
if (currentPosition == 2) {
if (moveRight == true) {
currentPosition = 3;
digitalWrite(3, HIGH);
delay(500);
}
if (moveDown == true) {
currentPosition = 8;
digitalWrite(8, HIGH);
delay(random(0, 1000));
}
} else if (currentPosition == 3) {
if (moveDown == true) {
currentPosition = 4;
digitalWrite(4, HIGH);
delay(500);
}
if (moveRight == true) {
digitalWrite(13,HIGH);
Serial.println(“You fail!”);
tone(9,1000,500);
digitalWrite(9,LOW);
delay(700);
digitalWrite(9,HIGH);
tone(9,1000,500);
Serial.end();
}
} else if (currentPosition == 8) {
if (moveRight == true) {
currentPosition = 4;
digitalWrite(4, HIGH);
delay(500);
}
if (moveDown == true) {
digitalWrite(13,HIGH);
Serial.println(“You fail!”);
tone(9,1000,500);
digitalWrite(9,LOW);
delay(700);
digitalWrite(9,HIGH);
tone(9,1000,500);
Serial.end();
}
} else if (currentPosition == 4) {
if (moveRight == true) {
currentPosition = 5;
digitalWrite(5, HIGH);
delay(500);
}
if (moveDown == true) {
currentPosition = 7;
digitalWrite(7, HIGH);
delay(random(0, 1000));
}
} else if (currentPosition == 5) {
if (moveDown == true) {
currentPosition = 6;
digitalWrite(6, HIGH);
if (currentPosition = 6) {
digitalWrite(11, HIGH);
Serial.println(“You win! Let’s check the time!”);

for (int thisNote = 0; thisNote < 8; thisNote++) {
int noteDuration = 1000 / noteDurations[thisNote];
tone(9, melody[thisNote], noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(9);
}
}
}
} else if (currentPosition == 7) {
if (moveRight == true) {
currentPosition = 6;
digitalWrite(6, HIGH);
if (currentPosition = 6) {
digitalWrite(11, HIGH);
Serial.println(“You win! Let’s check the time!”);

for (int thisNote = 0; thisNote < 8; thisNote++) {
int noteDuration = 1000 / noteDurations[thisNote];
tone(9, melody[thisNote], noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(9);
}
}
}

}
float millisecond = millis();
float second = millisecond/1000;
if (digitalRead(6) == HIGH) {
Serial.println(“You used ” + String(second) + ” seconds”);

Serial.end();
}
}

// delay(1500);

// float second = millis();
//
// /*y = A0
// x = A1
// xvalue < 270 && yvalue < 510 right
// yvalue > 750 && xvalue > 500 down
// */
//
// digitalWrite(2, HIGH);
// delay(150);
//
// if (xvalue < 270 && yvalue < 510 && digitalRead(2) == HIGH) {
// digitalWrite(3,HIGH);
// delay(150);
// }
//
// if (yvalue > 750 && xvalue > 500 && digitalRead(2) == HIGH) {
// digitalWrite(8, HIGH);
// delay(1500);
// }
//
// if (digitalRead(3) == HIGH && yvalue > 750 && xvalue > 500){
// digitalWrite(4, HIGH);
// delay(150);
// }
//
// if (digitalRead(4) == HIGH && yvalue < 510 && xvalue < 270){
// digitalWrite(5, HIGH);
// delay(150);
// }
//
// if(digitalRead(5) == HIGH && yvalue > 750 && xvalue > 500){
// digitalWrite(6,HIGH);
// delay(150);
// }
//
// if(digitalRead(6) == HIGH){
// Serial.print(“You used” + String(second) + “milliseconds”);
// Serial.end();
// }

FABRICATION AND PRODUCTION:

During the users’ test, however, we received some very useful feedback that can help us to improve the user experience of our project. One of the biggest problems seems to be that people have no idea how to hold the joystick. To fix this problem, we first think of making a hole on the upper surface of the box and fix the joystick through the hole, but later we found it is actually impossible due to the irregular shape of the joystick. So we eventually decided that we will attach a little stick to the joystick to instruct the correct direction of using it. Another commonly reported problem is that if the instruction light is red, people are likely to think they lose the game even if it actually means they have succeeded in reaching the end point. So we decided to use the full color led and use blue light to indicate playersā€™ success and red light to the failure. It is also mentioned several times that whether there way for plays to die in this game during usersā€™ test. At first, we think it would be more user-friendly if they can reach the end point anyway, it is just a matter of time.  But later we think it would be more exciting and competitive if there is a possibility of not being able to reach the endpoint. It is also mentioned during the users’ test that there should be clearer instructions about the functions of LEDs in different colors, so we added some specific instructions on the front surface of the box. We also added the sentence: ā€œtime is tickingā€, so as to remind players that the less time they use to get to the end point, the better. However, one limitation of this game is that players cannot move back once they have made their move. The main reason is that since it is a speed competition game and the chance to die is so small, going back is gonna be a waste of time. Also, if people are allowed to move backward, the coding would be even harder.

Producing:

Before User testing

After User testing 

CONCLUSIONS:

All in all, the goal of our project is to create an entertaining game that is highly interactive and enable people to compete with each other. The instruction light, as well as people using joysticks to control the LEDs,  are both communications with the project. Meanwhile, this project can be entertaining, as there is competition and people can always choose whether to take the risk. I think the significance of this project is to get two people together and compete for speed, reaction and luck with each other while having fun at the same time. Nevertheless, there are certain aspects that this project does not align with my definition of interactivity. For example, the maze is far too simple, which makes it more like a speed competition game than a true maze. It would be much more entertaining if there can be more LEDs, more paths or the color of LEDs can change from time to time. Another main problem is that since we used two separate Arduinos to control the two sets of lights, we also needed two reset buttons. As a result, the two players need to press the reset button respectively if they need to restart, which is very difficult to happen at the exact same moment and decreases the level of interactivity of this project. If we had more time, we would add more LEDs to it more difficult to reach the endpoint, we would also make the color of the LEDs changeable to make the task more challenging and engaging. As the maze is more difficult, we would also enable our players to move backward so that they can have more choices and better enjoy the game.

Generally speaking, a broad lesson I took from the failures and setbacks I came across during this project is to always think carefully, double check everything and start doing things early. Sometimes it is hard for one person to realize the mistake in circuit building or laser-cutting file preparing, but by asking the teammate to check for a second time is of great help. Also, as many problems cannot be foreseen before we actually face them, it is better for us to start early and leave enough time to deal with unexpected challenges and problems. One thing I take away from my accomplishment, on the other hand, is that when doing an interactive project, always leave people as many choices and possibilities. The more choices there are, the more entertaining the project is and the more interactivity can be generated by the desire of exploration and curiosity.

Leave a Reply