The Birth of the 'Candybination' Machine
Since the midterm project was first introduced, I was interested in making a slot machine. Our original idea was very similar to a regular slot machine, having a chip to bet, a lever to pull, and 3 wheels to spin to see if you won, however, this idea "lacked creativity and wasn't very interactive".
The internal mechanisms would be doing a lot more than the person playing the machine and having a machine based around money limits the potential to appeal to a large audience.
At this point, we went back to the drawing board and thought of a game similar to whack a mole -- but with LEDs instead of little gophers and buttons to press instead of hitting them with hammers. While this game would’ve been fun, it was also lacking key interactive elements.
As a result we decided to look back at the slot machine idea. Since the start, I wanted to incorporate a luck element, but the interaction had to be more than just pulling a lever..
How could we improve this?
Well first of all we wanted to rework the reward system. In the original idea, there wasn’t really an appealing award – a slip of paper (money) that said you won. But after some thinking we ended up turning it into a candy dispensing machine! The new design incorporates the lucky wheels (cut down from 3 to 2), but also has 2 other mini puzzles to solve before you can get your candy.
How Does it Work?
The first puzzle activates the button and requires all 3 LEDS to be on. To turn these on, you must turn 3 corresponding dials to their correct randomized value. Sort of like a combination lock. These can be done in any order and will stay on as you find their sweet spot.
After that, the button becomes active and you can press it to spin the 2 wheels and hope that they land on the same icon. The wheels cycle through 4 different icons. If you get unlucky (66% chance), then the lever is reset and the light puzzle is randomized again. However, if you win (33% chance), then the right side of the machine releases a candy, which you can then watch travel down a track to the candy exit at the bottom.
Overall, the improvements and innovations on the slot machine design helped make our project more interactive and interesting in general. The reward is more satisfying and we were able to give the project a theme not relating to money, thus appealing to a greater audience.
Message
Through observation of human interaction with our machine, we noticed quickly that people either walked away happy with a smile, or upset with criticism. By the nature of design, people are attracted to play the machine when other people win. If they see others' successes, they're more likely to give it a shot themselves.
This trend very similarly mirrors human behavior patterns when gambling.
While our machine doesn't cost the user any money, it does cost their time. Yes it can be fun to test your luck and play the game, but it can also get boring and repetitive. Some people will leave after losing once, but others will keep trying till they win big. At the end of the day, everyone will interact with the machine differently, and studying these patterns can provide insight into the psychology of gambling.
Mechanical parts:
3x potentiometers
3x 180 degree servo motors
3x LEDs
1x buzzer
1x button
Physical Components:
Lots of cardboard/paper
Paint
Tape/Glue
Lots of wires
Candies
Reflecting on this project, I’ve gained not only technical knowledge in coding but also skills in project management and time management. Initially, the idea of building a slot machine seemed straightforward, but as we tested different ideas on how it could work, we realized that creating an interactive experience involved much more than simply making a functional machine. By going back to the drawing board, reworking our reward system, and incorporating puzzles, we developed a machine that appealed to a wider audience and was more engaging.
Through the project, I learned the importance of flexibility and iterative design. We encountered several challenges, like finding the right motors and ensuring the dials worked correctly, which required us to problem-solve on the go. Working with Isaac, I also learned to balance responsibilities. I felt like I put in more of the work towards the start, but he pulled through in the end. Observing user reactions gave us insight into the psychology behind interactive machines. This was an overall very valuable experience in being able to bring an idea into the world.
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
int icon1;
int icon2;
int deg1;
int deg2;
int i = 0;
int buzzer = 9;
///
int poten1 = A0;
int poten2 = A1;
int poten3 = A2;
int led1 = 10;
int led2 = 11;
int led3 = 12;
int thresh1 = random(50, 950);
int thresh2 = random(50, 950);
int thresh3 = random(50, 950);
int status1;
int status2;
int status3;
int lever = 12;
////
int state = 1;
int ministate = 1;
////
int button = 2;
int buttonON = 0;
void setup() {
Serial.begin(9600);
pinMode(poten1, INPUT);
pinMode(poten2, INPUT);
pinMode(poten3, INPUT);
pinMode(buzzer, OUTPUT);
pinMode(lever, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(button, INPUT);
servo1.attach(3);
servo2.attach(5);
servo3.attach(7);
servo3.write(0);
}
void loseSound() {
tone(buzzer, 400);
delay(100);
tone(buzzer, 300);
delay(100);
tone(buzzer, 200);
delay(100);
tone(buzzer, 400);
delay(100);
tone(buzzer, 300);
delay(100);
tone(buzzer, 200);
delay(100);
tone(buzzer, 400);
delay(100);
tone(buzzer, 300);
delay(100);
tone(buzzer, 200);
delay(100);
tone(buzzer, 100);
delay(100);
}
void state1() {
int potenread1 = analogRead(poten1);
int potenread2 = analogRead(poten2);
int potenread3 = analogRead(poten3);
if (status1==1 && status2 ==1 && status3==1) {
state = 2;
buttonON = 0;
}else {
if (potenread1 >= thresh1 - 50 && potenread1 <= thresh1 + 50){
digitalWrite(led1, HIGH);
status1 = 1;
} else {
status1 = 0;
digitalWrite(led1, LOW);
}
if (potenread2 >= thresh2 - 50 && potenread2 <= thresh2 + 50){
digitalWrite(led2, HIGH);
status2 = 1;
} else {
status2 = 0;
digitalWrite(led2, LOW);
}
if (potenread3 >= thresh3 - 50 && potenread3 <= thresh3 + 50){
digitalWrite(led3, HIGH);
status3 = 1;
} else {
status3 = 0;
digitalWrite(led3, LOW);
}
}
delay(10);
}
void state2() {
if (digitalRead(button) == 1 && buttonON == 0) {
buttonON = 1;
randomSeed(analogRead(A4));
icon1 = random(1,4);
if (icon1 == 1) {
deg1 = 30;}
if (icon1 == 2) {
deg1 = 100;}
if (icon1 == 3) {
deg1 = 165;}
randomSeed(analogRead(A4));
icon2 = random(1,4);
if (icon2 == 1) {
deg2 = 165;}
if (icon2 == 2) {
deg2 = 90;}
if (icon2 == 3) {
deg2 = 20;}
i = 2;
ministate = 2;
}
if (ministate ==2) {
if (i >0) {
servo1.write(180);
servo2.write(0);
delay(500);
servo1.write(0);
servo2.write(180);
delay(500);
i -=1;
} else {
servo1.write(deg1);
servo2.write(deg2);
delay(500);
ministate = 1;
if (icon1 == icon2) {
state = 3;} else if (icon1 != icon2) {
servo3.write(0);
loseSound();
noTone(buzzer);
state = 1;
thresh1 = random(50,950);
thresh2 = random(50,950);
thresh3 = random(50,950);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
status1 = 0;
status2 = 0;
status3 = 0;
}
}
}
}
void blink() {
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
delay(200);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
delay(200);
}
void resetLights() {
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
status1 = 0;
status2 = 0;
status3 = 0;
}
void loop() {
if (state == 1) {
state1();
}
if (state == 2) {
state2();
}
if (state ==3) {
tone(buzzer, 400);
blink();
tone(buzzer, 600);
blink();
tone(buzzer, 800);
blink();
tone(buzzer, 900);
servo3.write(0);
blink();
tone(buzzer, 1000);
delay(3000);
servo3.write(90);
delay(500);
servo3.write(0);
noTone(buzzer);
randomSeed(analogRead(A4));
thresh1 = random(50, 950);
randomSeed(analogRead(A4));
thresh2 = random(50, 950);
randomSeed(analogRead(A4));
thresh3 = random(50, 950);
resetLights();
state = 1;
}
}