Introduction: LOVE MATCHING
Love Matching is a University Project made with Arduino Uno by Anna Berruezo and Mònica Font. What we wanted to do is a real time tinder where two people sit in front of each other and by asking them some questions, a Barbie and a Ken will get closer or get away depending on their answers.
If they match even if it's yes o no, they would get closer, if their answers are opposites the dolls would get away. The moment they finish the questions, the game ends. If you match is good, the dolls would be closer than if the match doesn't correspond.
Step 1: Electronic Materials Nedded
To make that possible we use:
- Arduino Uno Board : 20 €
- 2 medium 180-degree servo motors: 15,9 €
- 4 buttons (2 green, 2 red): 5,62 €
- Solderless Breadboard: 6,8 €
- Cables Dupont Jumpers for Breadboard: 3€
- 4 Resistors 220 ohms: 1€
- 2 Capacitor 1000uF 105C 10x20 R-5: 1,52 €
- 1 greenLED : 0,67€
Step 2: Other Materials Nedded
To make the assembly we use:
- 1 m^2 of wood: 15,57 €
- Barbie: 30 €
- Ken: 30 €
- Solicone gun: 10,20 €
- Nails; 1,59 €
- Cute sheets of paper to write the questions: 0,50€
Step 3: Questions to Ask
We write the questions in different papers so the users can read them at the same time and answer them. There are different versions of papers, with different shapes and colors.
Beach or mountain
Cat or dog
Fast food or good restaurant
Invisibility or flying powers
Travel to past or to future
Sex or food
Play or watch sport
Exotic site trips or classical capitals
Sing or dance
Blue or green
Sports car or 4x4
House or flat
Hotel or country house
Football or basketball
Public or private transport
In a company, boss or worker
Nap or party
Day or night
Sciences or letters
Movie or series
Individual or collective team sports
Up or down
Winter or summer
Marry in a church or in the beach
Have a kid or several kids
Travel with friends or partner
Go shopping or see a match
Relaxing trip or adventure trip
Massage or sauna
Sports with partner or alone
Reading or writting
Homecinema or cinema
Cook or eat
Pizza or pasta
Sweetheart or distant
Beach or swimming pool
Sky or surf
In favor or against abortion
Forgive an infidelity or not
Big or small tattoo
Night or day dates
Iphone or android
Nutella o nocilla
Do you like the person in front of you
In your home or mine
Step 4: Hardware Connection Map
Step 5:
Open Arduino and copy and paste the following cose into your program window. Press verify button and Upload to Board.Have fun!
/*
Buttons and motors
*/
//include servos 1 and 2
#include <Servo.h>
Servo myservo1; // create servo object to control a servo
Servo myservo2; // create servo object to control a servo
// variable to store the servo position2 that starts in 180
int pos = 20; // variable to store the servo position that starts in 0
int led = 4;
int brightness = 255;
const int buttonPingreen1 = 8; // the number of the pushbutton pin 7
const int buttonPinred1 = 7; // the number of the pushbutton pin 6
const int buttonPingreen2 = 6; // the number of the pushbutton pin 5
const int buttonPinred2 = 5; // the number of the pushbutton pin 4
int buttonStategreen1 = 0; // variable for reading the pushbutton status 0-no apretat
int buttonStatered1 = 0; // variable for reading the pushbutton status
int buttonStategreen2 = 0; // variable for reading the pushbutton status
int buttonStatered2 = 0; // variable for reading the pushbutton status
int status1 = 0, status2 = 0; //status per guardar si shan apretat 0-No ha apretat res 1-Ha apretat green 2-Ha apretat red
int times = 0;
void setup() {
myservo1.attach(10); // attaches the servo on pin 9 to the servo object myservo2.attach(9); // attaches the servo on pin 10 to the servo object
// initialize the pushbutton pin as an input:
pinMode(buttonPingreen1, INPUT);
pinMode(buttonPinred1, INPUT);
pinMode(buttonPingreen2, INPUT);
pinMode(buttonPinred2, INPUT);
Serial.begin(9600);
myservo1.write(pos); // tell servo to go to position in variable 'pos' myservo2.write(160);
analogWrite(led, brightness);
pinMode (led, OUTPUT);
}
void loop() {
// read the state of the pushbutton value:
if (status1 == 0) { // if no button in user 1 is pressed wait for a button
buttonStategreen1 = digitalRead(buttonPingreen1);
buttonStatered1 = digitalRead(buttonPinred1);
if (buttonStategreen1 == LOW) // if user 1 presses button green status changes to green pressed
{
status1 = 1;
analogWrite(led, 0);
Serial.println("User 1 green");
}
if (buttonStatered1 == LOW) // if user 1 presses button red status changes to green presse
{
status1 = 2;
analogWrite(led, 0);
Serial.println("User 1 red");
}
}
if (status2 == 0) { // if no button in user 2 is pressed wait for a button
buttonStategreen2 = digitalRead(buttonPingreen2);
buttonStatered2 = digitalRead(buttonPinred2);
if (buttonStategreen2 == LOW) // if user 2 presses button green status changes to green pressed
{
status2 = 1;
analogWrite(led, 0);
Serial.println("User 2 green");
}
if (buttonStatered2 == LOW) // if user 2 presses button red status changes to green pressed
{
status2 = 2;
analogWrite(led, 0);
Serial.println("User 2 red");
}
}
if (status1 > 0 && status2 > 0) { // if user 1 and user 2 had pressed a button do that
Serial.println("2 apretats");
times = times + 1;
delay (1000);
// green1 i green2 o red 1 i red2
if ((status1 == status2)) // if user 1 and user 2 answers are the same
{
pos = pos + 14;
if (pos > 160) {
pos = 160;
}
// goes from pos to 0 in steps of 18º
myservo1.write(pos); // tell servo to go to position in variable 'pos' myservo2.write(160 - pos);
} else {
// green 1 i red2 o red1 i green2
pos = pos - 14;
if (pos < 20) {
pos = 20;
} // goes from pos to 0 in steps of 18º
myservo1.write(pos); // tell servo to go to position in variable 'pos' myservo2.write(160 - pos);
}
status1 = 0; // put the state buttons to no pressed again
status2 = 0;
analogWrite(led, brightness);
}
if (times == 10) {
delay (6000);
analogWrite(led, 0);
myservo1.write(20); // tell servo to go to position in variable 'pos' myservo2.write(160);
// wait for a second
}
}
Step 6: Prototyping
Step 7: Difficulties Found
One of the difficulties of this project is writing the code because if something is missing, it gets all the code wrong, for example a parenthesis, a coma or a claudator. In our case we started writing the code for the four buttons and the two servomotors. After many times trying to write it worked, except the first movement and the limits of the servomotor: the beginning 0º and the end 180º which started vibrating without sense. Also, we did not buy an Arduino plate so every time we wanted to write the code and check if it works, we had to go to the laboratory to take a plate and its cable. Apart, we did not weld the cables, so every time we had to mount and it can be easily wrong. In additon, at the beggining we want to put many things like a screen but time was thrown on us and every time we saw it more complicated.
Step 8: Attributions to Sources
One of the sources that we consulted most is the Arduino references, a page that gave us information about how to use each product, how to write its code and how to connect them.
Apart from that, the hour from “Aula Oberta” in Elisava help us because if any part did not work, we could make some questions at the teachers and they answered, helping us a lot. In addition, each class of “Usos Acadèmics en anglès 1” was still good for learning things that even did not know.
Step 9: Next Steps
A next step that we can include in our project is a screen which will show the different questions to ask to the users.
The next step we can include is a speaker. When the questions end up, the speaker will make one sound or another depending if the players have matched or not. If they match, the sound will be loving, but if they do not match, the sound will be ridiculous. Another possible step is introducing a blower with confetti inside. If they match, it would throw a confetti made of pink hearts, but if they do not match, it would throw another confetti in form of middle black heart simulating that there is no love.
The last difficulty of our project is that we needed to write the different questions somewhere so, we needed a screen. Using a screen requires having another Arduino plate because it has to be connected directly to it so we had to took two.