Skip to content

Concept-Bytes/Open-Chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenChess - Modular Smart Chess Board

OpenChess is a complete Arduino-based smart chessboard system featuring modular architecture, multiple game modes, and AI integration. Build your own intelligent chess board that can detect piece movements, provide visual feedback, and even play against you using Stockfish AI!

Features

Multiple Game Modes

  • Human vs Human: Classic chess gameplay with visual move indicators
  • Human vs AI: Play against Stockfish engine via WiFi API
  • Sensor Test: Verify your board's sensor grid and LED mapping
  • Physical Game Selection: Choose modes by placing pieces on center LEDs

Hardware Integration

  • 88 NeoPixel Matrix: Full-color LED feedback and animations
  • Hall Effect Sensors: Detect magnetic chess pieces on every square
  • 74HC594 Shift Register: Efficient sensor matrix scanning
  • WiFi Connectivity: Connect to Stockfish API for AI gameplay

Visual Feedback

  • Move Indicators: Red selection, white valid moves
  • Animations: Fireworks, captures, promotions, confirmations
  • Game Status: Visual feedback for invalid moves and game states

AI Integration

  • Stockfish API: Professional-strength chess engine
  • Difficulty Levels: Easy, Medium, Hard, Expert
  • Real-time Analysis: FEN notation and move parsing
  • WiFi Hotspot Support: Connect to mobile hotspot for internet access

Project Structure

Core Files

  • OpenChess.ino: Main program with game mode selection and coordination
  • board_driver.h/.cpp: Hardware abstraction for LEDs, sensors, and animations
  • chess_engine.h/.cpp: Chess rules, move validation, and game logic

Game Modes

  • chess_moves.h/.cpp: Human vs Human chess implementation
  • chess_bot.h/.cpp: Human vs AI chess with Stockfish integration
  • sensor_test.h/.cpp: Hardware testing and calibration mode

Connectivity

  • wifi_manager.h/.cpp: WiFi connection and web interface (SAMD/IoT boards)
  • wifi_manager_rp2040.h/.cpp: Placeholder for RP2040 boards
  • stockfish_settings.h: AI difficulty configuration

Configuration

  • arduino_secrets_template.h: WiFi credentials template
  • README.md: This documentation

Legacy (Reference)

  • Scripts/Chess.ino: Original monolithic implementation
  • Scripts/Sensor_Test.ino: Original sensor test

Hardware Requirements

Essential Components

  • Arduino Board: Nano RP2040 Connect, Uno, or compatible
  • 88 NeoPixel Matrix: GRBW LEDs recommended
  • 64 Hall Effect Sensors: One per square (A3144 or similar)
  • 74HC594 Shift Register: For sensor matrix scanning
  • Chess Pieces with Magnets: Neodymium magnets embedded in base

Optional Components

  • WiFi Module: For AI gameplay (built-in on RP2040 Connect)
  • Power Supply: 5V for NeoPixels, adequate amperage for 64 LEDs

Software Dependencies

Required Libraries

  • Adafruit NeoPixel v1.14: Specific version for RP2040 compatibility
  • WiFiNINA: For boards with WiFi capability
  • Standard Arduino Libraries: SPI, Wire, etc.

Installation

  1. Open Arduino IDE
  2. Go to Sketch > Include Library > Manage Libraries
  3. Install Adafruit NeoPixel version 1.14 (not latest!)
  4. Install WiFiNINA if using WiFi features

Quick Start

1. Hardware Setup

  1. Connect NeoPixel matrix to pin 17
  2. Wire shift register: SERpin 2, SRCLKpin 3, RCLKpin 4
  3. Connect column sensors to pins 6-13
  4. Embed magnets in chess piece bases

2. Software Configuration

  1. Copy arduino_secrets_template.h to arduino_secrets.h
  2. Edit arduino_secrets.h with your WiFi credentials
  3. Compile and upload OpenChess.ino

3. Game Selection

  1. Power on the board
  2. Wait for 4 white LEDs in the center
  3. Place any piece on a LED to select mode:
    • Position (3,3): Human vs Human
    • Position (3,4): Human vs AI
    • Position (4,3): Future mode
    • Position (4,4): Sensor Test

How to Play

Human vs Human Mode

  1. Set up pieces in starting position
  2. Pick up your piece (shows red + valid moves in white)
  3. Place on valid square (green confirmation flash)
  4. Opponent's turn

Human vs AI Mode

  1. Connect to WiFi (automatic with credentials)
  2. Set up pieces in starting position
  3. You play as White (bottom), AI plays as Black (top)
  4. Make your move AI calculates response
  5. Follow LED indicators to make AI's move physically

Sensor Test Mode

  1. Place pieces on starting squares
  2. LEDs light up where pieces are detected
  3. Remove/add pieces to test sensor grid
  4. Perfect for calibration and troubleshooting

Configuration

WiFi Setup

Edit arduino_secrets.h: \\cpp #define SECRET_SSID
YourWiFiName
#define SECRET_PASS \YourPassword
\\

AI Difficulty

Edit OpenChess.ino line 37: \\cpp ChessBot chessBot(&boardDriver, &chessEngine, BOT_EASY); // BOT_EASY, BOT_MEDIUM, BOT_HARD, BOT_EXPERT \\

Hardware Pins

Modify pin assignments in board_driver.h if needed.

Troubleshooting

Common Issues

  1. NeoPixels not working: Ensure you have NeoPixel library v1.14
  2. WiFi not connecting: Check credentials in arduino_secrets.h
  3. Sensors not responding: Run Sensor Test mode first
  4. Slow AI response: Try BOT_EASY difficulty (6-second vs 15-second moves)

Debug Output

Enable Serial Monitor (9600 baud) for detailed diagnostic information.

Contributing

Contributions welcome! Areas for enhancement:

  • Additional game modes (King of the Hill, Chess960, etc.)
  • Bluetooth connectivity
  • Mobile app integration
  • Tournament mode with time controls
  • Opening book integration

License

MIT License - See LICENSE file for details.

Acknowledgments

  • Stockfish Team: For the incredible chess engine API
  • Adafruit: For the excellent NeoPixel library
  • Arduino Community: For the development platform
  • Chess.com: For inspiration on digital chess interfaces

Build your own intelligent chess board and experience the future of tabletop gaming!

For questions, issues, or contributions, please visit: GitHub Repository

About

Open Chess A Smart Chess Board you can build at home!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published