Skip to main content
Version: ACS CC

Automatic Card Shuffler and Dealer

Automatic card shuffler and dealer for board games with WiFi control interface to select shuffling and distribution operations.

info

Author: Dragusin Matei Cosmin
GitHub Project Link: Repository

Description

This project is an automatic card shuffler and dealer for board games controlled via WiFi web interface. The device consists of multiple motor systems:

  1. Shuffling System: Two DC motors driving rubber rollers in alternating sequence to shuffle cards effectively (5 cycles per shuffle operation)
  2. Card Distribution System: A DC motor that feeds cards combined with a MG90S servo motor for precise card delivery
  3. Rotatable Platform: A 28BYJ-48 stepper motor with ULN2003 driver providing 180° rotations for dealing cards to different positions

Users interact with the device through a responsive web interface accessible via WiFi, allowing them to:

  • Start automatic shuffling sequence
  • Distribute individual cards
  • Manually control each motor independently
  • Control the stepper motor position with automatic home return functionality

Motivation

The motivation behind this project is to create a fun and interactive device that can enhance the experience of playing card games. The automatic shuffler and dealer saves time and effort, allowing players to focus on enjoying the game rather than dealing with the tedious task of shuffling and dealing cards. The WiFi control adds modern convenience and allows multiple players to operate the device from their phones.

Architecture

System Overview

Software Architecture

Log

Week 5 - 11 May

  • Purchased all necessary components for the project
  • Individually tested all motors to verify functionality
  • Completed the 3D design of the device

Week 12 - 18 May

  • Assembled the 3D printed parts
  • Attached the motors to the main structure
  • Started software development, focusing on motor control
  • Configured WiFi communication for the user interface

Week 19 - 25 May

  • Implemented complete WiFi web interface with responsive design
  • Developed asynchronous motor control system using Embassy framework
  • Added stepper motor position tracking and home return functionality
  • Integrated servo motor control with precise timing for card distribution
  • Optimized shuffling algorithm with alternating motor sequence
  • Added comprehensive manual control for all motor systems

Hardware

The automatic card shuffler uses a Raspberry Pi Pico 2W as the main controller, which connects to the local WiFi network and is controlled through a web interface. The mechanical system includes three DC motors driving rubber rollers for card movement, one MG90S servo motor for card delivery precision, and one 28BYJ-48 stepper motor for the rotating dealing platform, all powered through appropriate motor drivers.

BreadboardDC Motor ViewDealer View
BreadboardDC Motor ViewDealer View
Full ViewSide View
Full ViewSide View

Schematics

Schematics

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2 WThe main microcontroller running embedded Rust software with WiFi connectivity35 RON
ULN2003 Stepper Motor DriverControls the 28BYJ-48 stepper motor for precise 180° rotations of the distribution platform17 RON
28BYJ-48 Stepper MotorProvides precise positioning control for the rotating card distribution platform15 RON
GA12-N20 DC Motor with GearboxDrives the rubber rollers for card shuffling and distribution (3 units required)75 RON
L298N Dual Motor DriverControls the DC motors for shuffling and distribution (2 units needed)40 RON
Servomotor MG90SProvides precise angular control (0°-180°) for card delivery mechanism25 RON
Consumables3D printing filament, screws, rubber rollers, and assembly materials50 RON

Software

The software is built using the Embassy async framework for Rust embedded systems, providing real-time motor control and WiFi connectivity.

Key Features

  • Asynchronous Task Architecture: Three main tasks running concurrently

    • dc_motor_control_task: Handles all DC motor operations including shuffling sequences
    • servo_stepper_control_task: Manages servo and stepper motor precision control
    • server_task: Provides HTTP web server for WiFi control interface
  • Atomic State Management: Thread-safe control using atomic flags for motor coordination

  • Responsive Web Interface: Mobile-friendly HTML interface with real-time status updates

  • Position Tracking: Stepper motor position tracking with automatic home return

  • Optimized Shuffling: 5-cycle alternating motor sequence for effective card shuffling

Libraries Used

LibraryDescriptionUsage
embassy-executorAsync/await executorManaging concurrent motor control and networking tasks
embassy-timeTimekeeping and delaysPrecise timing for motor sequences and servo control
embassy-rpRP2350 HALHardware abstraction for Raspberry Pi Pico 2W
embassy-syncSynchronization primitivesThread-safe communication between tasks
embassy-netNetwork stackTCP/IP networking for web interface
cyw43WiFi Chip DriverDriver for Pico W's onboard CYW43439 WiFi chip
fixedFixed-point numbersPrecise PWM duty cycle calculations for servo control
defmtLogging frameworkDebug information and system monitoring
defmt-rttRTT debug channelReal-time debugging via probe-rs
static_cellStatic allocationMemory management for network resources
cortex-m-rtRuntime supportARM Cortex-M startup and exception handling
panic-probePanic handlerDevelopment-time error reporting

Control Interface

The web interface provides comprehensive control over all system functions:

Main Functions:

  • START AMESTECARE: Executes 5-cycle alternating shuffle sequence
  • IMPARTE CARTE: Coordinated servo and DC motor card distribution

Manual Controls:

  • Individual DC motor control (Left, Right, Distribution forward/backward)
  • Servo positioning (0° and 180° positions)
  • Stepper motor rotation (180° steps in both directions)
  • Automatic home return for stepper motor
  1. Commercial Card Shuffler Reference