Basketball Illustration
Basketball Illustration
basketball outline drawing in eps10
basketball outline drawing in eps10

arcade Basketball game

An arcade influenced basketball game, developed using Microcontrollers and IOTs.

Demonstration

Overview

Introduction

  • A Basketball game, that takes heavy influence from Arcade basketball games in both functionality and design facets.
  • Built using IOT’s like Arduinos, IR sensors and switches.
  • Uses a web Interface to output readings.

Objectives

  • Implementing a sensor system to detect basketball shots.
  • Creating visual and audio feedback to enhance the gaming experience.
  • Implement game logic, including time limits, and scoring rules.

Components (hardware)

Arduino UNO

  • An open source electronics platform
  • Utilizes C++ as its native language
  • Has a dedicated IDE for writing Arduino code

Digital pins

  • Used for input(0v) and output (5v) operations

Eg:- Controlling and LED

Analog pins

  • Uses ADC to convert analog to digital signals (max 5v)

Eg:- Converting the readings of a light sensor

Components (hardware)

Infrared (IR) sensors

  • electronic devices that can detect infrared radiation
  • consist of an IR transmitter and an IR receiver
  • Used widely in object detection

Transmitter (TX)

  • Emits infrared radiation up to a defined distance
  • Any object within its range deflects the IR rays

Receiver (RX)

  • Detects the reflected IR radiation.
  • Emits a signal either HIGH or LOW depending on the state

Components (Software)

Arduino IDE

  • The environment for writing Arduino code
  • Used for uploading out code to the Arduino
  • Serial plotter to visualize Voltage across the Arduino
  • Serial Monitor acts as a console for debugging

Void setup()

  • Used for one time configurations

Eg: Setting up digital pins

Void loop()

  • Code block the executes in perpetuity

Eg: Main logic, like listening to IR sensor readings etc...

Components (Software)

Communication protocols

Used to bridge the communication gap between the Arduino and the web Interface in real time with efficacy

Web Sockets

  • A communication protocol used for real time communication between clients and servers
  • An upgrade from the widely used HTTP protocol
  • Allows full duplex communication

Serial port

  • A communication protocol used to read and write data to serial ports (USB ports )
  • Used in conjunction concurrently with web sockets

Project design (hardware implementation)

Arduino UNO

For the purposes of this project, the Arduino is connected through the USB and is powered by the computer itself.

Illustration of a Laptop

USB connection

Project design (hardware implementation)

Infrared (IR) sensor

The infrared sensor has 3 terminals, used in detecting

the ball

IR sensor

  • VCC (Voltage common collector):

Powers the IR sensor with a max voltage of 5v

  • Output

This terminal sends either a HIGH(5v) or LOW (0v) signal to the Arduino, and is connected to one of the digital pins.

  • Ground

This terminal is connected to the ground pin in the Arduino for safety purposes

Project design (hardware implementation)

2 pin Switch

The 2 pin switch has two terminals, and is used to start the game upon pressing it.

  • Ground Pin

As usual, it connected to the ground pin for safety reasons

  • Output

This terminal is connected to one of the digital pins in the Arduino

Project design (Software architecture)

Developing a game Interface on the web (client 1)

Initial steps for the project’s software architecture entails designing a web interface to display the scores, highscores, change timers, etc..

Program the Arduino to detect IR sensor readings and switch presses (client 2)

Since all the hardware components are connected (IR sensor , switch), we program the Arduino to detect the IR sensor readings and also the switch presses.

Create a backend server with Node js using Webscokets and serial port

Here, we create a backend server with Websockets using Node.js that sits in between the web Interface (Client 1) and the Arduino (Client 2) to facilitate full-duplex communication between the two.

Project design (Software architecture)

Frontend (client 1)

Flat Web Browser Illustration

Arduino connection to the backend using serial port

USB Conn

Filled In Server Icon
laptop

Game interface connection to the backend using Websockets

Server running on the laptop

(HOST)

Arduino (client 2)

Project design (Software architecture)

Abstract game logic

An abstracted Macro level implementation of the core game logics

**This is explained under the presumption that every component is working as expected

IF switch is pressed, send “S” to the computer ELSE do nothing

Arduino (switch)

Arduino (IR sensor )

IF Object is detected send “1” to the computer ELSE IF no object is detected send “0


Backend server (HOST)

IF Client 1 is connected, read data from Client 2 and send it to Client 1

ELSE wait for client 1 to connect


Frontend (Game Client)

IF data received from HOST contains “S”, start the game ELSE do Nothing

IF data received from HOST contains “1” & gameHasStarted, then increment the score by +2 Else do Nothing


Features

Game features

  • Variable time modes
  • Leaderboards
  • Audio FX
  • Tutorials

UI design

  • Intuitive and user friendly design
  • Animations for an engaged user experience
  • Pertains to all age groups
  • Easy to navigate

Future potentials

Project upscaling

  • Higher capital investment
  • Relative ease in time constraints
  • More advanced IOTs like rasberryPi
  • Stand alone displays

Commercial use

  • Requires project upscaling
  • Could be a useful addition to parks and homes and other centers
  • Branding
  • Commercial production is not a far fetch under ideal circumstances