Assignment 1: Ball Drop Game
The project consists of developing a controller to play “Ball Drop Game“, a TCP sockets multiplayer game developed by Tom Igoe. The main idea was to use an Arduino with multiple sensors to control a player through TCP sockets in a game running on someone’s computer. We learned about the various layers of protocol we need to build a network in order to build this communication. The physical layer and the datalink layer were defined by our hardware and their addresses, in this case the Arduino and the laptop connected to a same WiFi network.
The network layer and the IP adresses were managed by the local network, while the transport layer consisted of a TCP socket between each player(client) and the computer(server). We used sessions to open and close the connection to the server with a physical interface, and finally we sent characters through the connection as commands to the player on-screen. The game itself consists of a screen where each player is a bar, and the idea is to collide with a ball that falls from the top of the screen as many times as possible.
Bill of Materials
The system consists of an Arduino Nano 33 IoT connected to five buttons and two LEDs. One of the LEDs indicates power while the other LED indicates connection. The array of four buttons displayed in a rectangular position are the controls for the game, UP, DOWN, RIGHT and LEFT. The remaining button is used to connect and disconnect from the server. Below you can see how the player would move in the game.
We had already connected in class through our computer terminal, and thanks to Tom Igoe’s example the process to implement the same protocol through the Arduino was straightforward. I also have to thank Tirta and Sam Krystal for helping me out with implementing the pull-up logic with the Arduino code Tom had shared. As you can see below, the circuit on the left used a setup where the resistors were connected to ground. On the right, there is no resistor going into ground, since the Arduino’s internal resistors “pull-up” the excess voltage.
After learning how to use the laser cutter I decided to iterate through cardboard before settling on a wooden enclosure using the plywood. The process wasn’t as fluid as I thought, since the laser cutter did not work perfectly and the seams would not fit sometimes. Anyways, I changed the layout several times until I was satisfied.
I then proceeded to solder the buttons and the wiring in order to have a button pad. The PCB I had was kind of frustrating to work with because it’s hole arrangement did not permit a symmetric disposition of every element.
Finally, I decided on the design below. I decided to go for a small breadboard because of its size and weight. I also added another LED, so one of them would indicate the device is on and the other indicates connection.
Thanks for reading!