Skip to content

andychuong/arduino_controllers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino Controllers

An Arduino game controller system using Arduino and the p5.js library.

Arduino Controllers

Overview

This project creates an easily replicated and expandable Arduino controller system for building custom game controllers. The controller connections are designed to utilize various sensors and inputs that can be interchanged depending on each controller's purpose.

Key Features:

  • Modular controller design supporting 2 controllers with up to 3 analog and 5 digital inputs each
  • Compatible with Arduino Uno, Leonardo, and SparkFun RedBoard
  • Uses p5.js and p5.play libraries for easy game development
  • 3D printable enclosures included
  • Perfect for learning hardware and software development

Controllers and Hub

Project Structure

arduinocontrollers/
├── 3D/                    # 3D printable enclosure files (.stl, .3dm)
├── Arduino/               # Arduino sketches for controllers
│   ├── _3ana5digi/        # 3 analog, 5 digital input sketch
│   └── _5ana10digi/       # Full 5 analog, 10 digital input sketch
├── p5workspace/           # p5.js game examples and libraries
│   ├── libraries/         # p5.js, p5.play, p5.serialport
│   ├── shootinggame/      # Tank shooter game example
│   └── ...                # Various game demos
├── processing/            # Processing sketches for prototyping
└── Web/                   # Web deployment files

Quick Start

  1. Hardware Setup: Build your controller using the shield and perf board design
  2. Upload Arduino Code: Flash the _5ana10digi.ino sketch to your Arduino
  3. Install Dependencies: Download p5.serialcontrol and Node.js
  4. Run a Game: Open one of the HTML files in a browser with a local server

For detailed instructions, see GETTING_STARTED.md.

Hardware Requirements

Tools:

  • Soldering Iron & Solder
  • Wire Strippers
  • Side cutters & Pliers

Components:

  • Arduino compatible board (Uno, Leonardo, or RedBoard)
  • Perf Board (8cm x 6cm green perf boards or Arduino Uno shield)
  • Sensors: Joysticks, Buttons (with 10k ohm resistors), Potentiometers, etc.
  • Wire: 26 AWG Solid, Ribbon cable with crimps
  • Break Away Headers (20+)

Optional:

  • 3D printed enclosures (files in /3D folder)
  • M2.5 screws for mounting

3D Printed Enclosures

Software Requirements

Pin Mapping

Controller Analog Inputs Digital Inputs
Controller 1 A0, A1, A2 D2, D3, D4, D5, D6
Controller 2 A3, A4, A5 D7, D8, D9, D10, D11

Ribbon Cable Color Code:

  • Red: 5V Power
  • Brown: Ground
  • Orange: Analog 0/3 (Horizontal)
  • Yellow: Analog 1/4 (Vertical)
  • Green: Analog 2/5
  • Blue: Digital 2/7
  • Purple: Digital 3/8 (Menu button)
  • Grey: Digital 4/9
  • White: Digital 5/10
  • Black: Digital 6/11

Example Games

  • Pong Demo (pongdemo.js) - Classic pong using potentiometers
  • Tank Shooter (shootinggame/) - 1v1 tank battle game
  • Pipe Game (pipes.js) - Flappy bird style game
  • Running Game (running.js) - Side-scrolling runner

Resources

License

This project is open source. Feel free to modify and share!

Author

Created by andychuong

About

Game controllers made with Arduino

Topics

Resources

Stars

Watchers

Forks

Languages