2 Player Wireless Pong w/ ESP 8266 Webserver and Xbee
OVERVIEW
This project is a wireless version of a 2 player pong game. The game is displayed on a visual studio based GUI available two separate screens and 2 mbeds programmed as the game controllers. Both mbed controllers have an analog joystick used to move the pong paddles left and right in the game, an xbee to communicate player 1's movement to player 2's board, a speaker with a sparkfun audio amplifier, an SD card read/writer, and a Huzzah ESP8266 wifi module to display the total player 1 and player 2 wins on a web page.
To initialize the game, both players have to connect their mbed controllers via USB to two computers with the pong executable program.The players then open the program and wait for their mbed's central light to flash continuously, showing that data is being transferred.
Once the game is initialized, both players are shown a start screen:
Player 1 and Player 2 can click start by pushing down on the analog joystick. The player the clicks start first will be shown a "waiting for second player" message until the second player also clicks the start button.
Once both players click start, the pong game begins. The pong ball initially starts in the middle of the screen and is randomly sent to either player. The object of the game is to make your opponent miss the pong ball sent in his or her direction. The match continues until one player scores 5 times and a new match can then begin.
The total amount of wins for Player 1 and Player 2 are stored on the SD card in player 1's controller. The scores from the card can be accessed online through the wifi module's local IP address.
DEMO
CODE
The program for both mbed controllers can be imported below:
The visual studio code for the Pong program is available via github:
https://github.com/Mpmart08/ECE-4180-Final-Project
WIRING GUIDE
Analog Joystick
mbed | Analog Joystick |
---|---|
VOUT | VCC |
p16 | VERT |
p15 | HORZ |
p14 | SEL |
GND | GND |
Class D Amplifier and Speaker
mbed | Class D Amp | Speaker | External 5V Supply |
---|---|---|---|
p25 | IN+ | ||
OUT+ | + | ||
OUT- | - | ||
PWR+ | 5V | ||
GND | IN-, PWR- | GND |
Xbee
mbed | Xbee |
---|---|
p9 | RX (3) |
p10 | TX(2) |
VOUT | VCC 3.3 (1) |
GND | GND (10) |
SD Card Reader/Writer (Player 1 only)
mbed | SD Card Reader/Writer |
---|---|
p8 | CS |
p5 | DI |
p7 | SCK |
p6 | DO |
VOUT | VCC |
GND | GND |
Huzzah ESP 8266 Wifi Module (Player1 only)
mbed | ESP 8266 | External 5V Supply |
---|---|---|
p26 | Reset | |
p28 | RX | |
p27 | TX | |
V+ | +5V | |
GND | GND | GND |
IMAGES
Game Set-Up
Player 1 Controller
Player 2 Controller
Wifi Webpage
Developed by:
Michael Martin Section-B
Rishi Bhargava Section-A
Fese Epie Section-B
Please log in to post comments.