Introduction: Sprinter: Two Player Jumping Game Using Arduino Android and Bluetooth
This project was done for the course : Physical Computing taught at Saarland University by Prof. Jürgen Steimle. We implemented “Sprinter” which is an interactive 2-player physical game. Sprinter utilizes the concept of physical computing to make game play fun and “physical”. Each of the player has 4 pads which have LEDS. The system randomly selects one of the 4 pads or each user by turning on the pads LEDS, and once this happens the user has to step on the pad and his score is incremented. At the end of one minute, the user with the higher score wins. The operation of the game can be seen in the video.”
Step 1: Hardware Requirements
Following are the hardware components used to build this project:
1- Arduino UNO
2- Bluetooth Module(HC-05)
3- Leds (Total 48)
4- Copper Tape
5- Connecting Wires(Male to Male, Male to Female and long wires)
6- Multiplexer(16 channel Analog Multiplexer)
Step 2: Software Requirements
Step 3: Constructing Pressure Pads
These pressure pads are without any built-in sensors. Just simple technique and copper tapes are used to detect player on the pad. Just to note construct one by one and keep on testing each pad after completion. Testing method in last of this step.
1- First of all cut cardboards as shown in Fig1. The size for each cardboard is 25 inches in length and 12 inches in width. Total are 8 card boards, of them 4 are for the red player and 4 for the blue player. Figure 1.
2- In the second step bend all pads from the center with almost 1 inch of width to keep a separation between two surfaces of pads. Figure 2.
3- In the third step insert LEDs in front separation. A total 6 LEDs per pad. 4 Pads with red LEDs and 4 Pads with blue leds. Reference Figure3.
4- Reference Figure4:
- As shown in Label -1
- Take two 12 inches long copper tape strips and attach along with LEDs.
One strip along with +ve pins of LEDs and second Strip with -ve pins of LEDs
Now Solder the pins with copper tape strips.
2. As shown in Label -2
- Connect +5V supply wire to +ve pins of LEDs.
3. As shown in Label -3
- Connect GND wire to -ve pins of LEDs.
4. As shown in Label -4
- Attach 4 wider copper tapes as shown in label 4.
- These wider tapes are to sense pressure when upper and lower tapes come in contact with each other.
5. As shown in Label -5
- solder input wire as shown in label-5. This would be +5v supply.
6. As shown in Label -6
- Solder a crossed wire between the left side's below contact point to right side's upper contact point.
7. As shown in Label -7
- Solder one wire from right side's below contact point that is sensing wire if the player is on the pads or not.
- This pad design is such a way that player should stand completely on Pad with both foots on the sides of the pads not just touching the pad with one foot.
- Also, attach one soft foam on the lower side of the pad so that it keeps both upper and lower surfaces apart.
Keep in mind the distance between pads and Arduino controller and cut wires accordingly. As from title photograph of this project you can see the wire distances are around 2 to 3 feet long for each pad.
Also, Block Diagram of Pad is in this step you can get a more clear view of pad design.
- After making each pad test the pad as shown in Figure5. Connect LED's +ve and -ve pin wires with a 5V supply and GND respectively.
- Now From Figure4 and Lable-4 input wire, also connects to 5V.
- Put pressure on both sides of Pad and read voltage at wire shown in Figure4 and Label-7.
- If you read around 5 voltage after putting pressure and no voltage without pressure then your pad is ready and continue to next pad.
Step 4: Connections With Arduino
All Connections with central Arduino controller are shown in Block Diagram.
1- Connect the Bluetooth controller at pin 0 and 1 on Arduino. Connect in a way that TX pin of Bluetooth connected to RX of Arduino and RX pin of Bluetooth connected to TX of Arduino.
2- Also connect 5V and GND to Arduino's 5V and GND.
3- Sometimes while loading sketch to Arduino its TX and RX pins messes with Bluetooth pins so it's better to remove power supply of Bluetooth while uploading the sketch to Arduino.
1- Connect multiplexer to according to the connections shown in the block diagram.
2- Arduino's pin 10,11,12,13 to select pins of multiplexer S0,S1,S2,S3 respectively.
3- Multiplexer is used select and give 5V to the randomly selected pad.
4- Total 8 pads are selected using 4 select pins of Multiplexer
5- Connect EN and GND pin of MUX with GND of Arduino.
6- Connect Op and VCC of MUX with 5V from Arduino.
7- Now look at step3 Figure4 and see the yellow wire labeled as "+5V supply for LEDs(2)".
8- Take Blue Player's these LED wire and connect to MUX pin 1 to 4 and same wires of RED Player with MUX pins 5 to 8.
9- Also connects -ve pins of LEDs with Arduino's GND. In step3 Figure4 it is labeled as "GND for LED(3)".
Pads Sensing Outputs:
1- Now again reference from Step-3 Figure4 labeled as "Sensing output of Pad(7)".
2- Take Blue players 1,2,3,4 pads sensing outputs and connects to pins 2,3,4,5 of Arduino along with pull down resistors as shown in block diagram.
3- Now for the red player do the same and connects 1,2,3,4 pads with Arduino pins 6,7,8,9 with pull down resistors.
Just to get overview look at Figure3. In initial steps, it looks bit messy :)
In next Figure, you can see you can make it look beautiful by covering with Red and Blue paper or plastic sheets. But do sheet covering after testing code and Functionality.
Step 5: Game Control Flow Chart
1. Hand Shaking: In the first step, a handshaking is done between Arduino and the Android Application. A "ready" flag is sent to the Application and the same flag is received as an Acknowledgement (ACK). Then We say the connection has been established.
2. Game start: "start" flag is sent to the Android Application and received again by the Arduino as an ACK. Then the game is started by the Application.
3. Game Run: Application let the game run for X amounts of time and receive both players score with tags P1: and P2:
4. Declare Winner: After X amounts of time, game is ended and the player with more score is declared as the winner.
Step 6: Source Code
Source code for Arduino and Android can be downloaded from the git repository link given below:
- Upload codes to Android and Arduino.
- Power on arduino. Bluetooth light should be blinking fast.
- Before running application on Android, pair your Bluetooth device.
- Go to Bluetooth of your Phone/Tablet and find for available devices.
- You will see Bluetooth named HC-05. Connect to it. It will ask for password. Usually default password is 12345
- After successful pairing you will see Bluetooth light start blinks slowly.
- Now disconnect Bluetooth.
- Open Sprinter App on Mobile.
- You will see splash screen for 2 seconds and then find paired devices.
- Click on that button and you will see that device again.
- Select that device.
- After successful connection you will move to Main Game Screen.
- Click on Play and game will start.
- If everything is ok ... Congratulation!!! now you can play your Interactive game :)
- Fahad Masood Butt, MSC CS Saarland University
- Umar Farooq, MSC CS Saarland University
We have a be nice policy.
Please be positive and constructive.