Project Name: Smart Card Shuffler


Project Functional Description:

The Smart Card Shuffler is designed to take a standard deck of 52 cards and reorder it based on the user’s selected mode: Poker, Random, or Custom. The user interacts with a Flutter-based mobile app, which connects to the Raspberry Pi via BLE to configure the shuffle mode:

  • Random Mode: Performs a standard shuffle, but the algorithm optimizes the process for speed, determining the most efficient way to reorder and dispense the cards.
  • Poker Mode: Allows the user to predefine specific poker hands to be dealt.
  • Custom Mode: Enables special sorting options, such as resetting the deck or bringing specific cards to the top.

Once the user selects a mode, the desired deck order is sent to the Raspberry Pi. The user then loads a standard deck into the device and presses Start to begin the sorting process.

Card Identification & Sorting Mechanism

A Pi Camera positioned beneath the deck captures and identifies each card using computer vision. The Raspberry Pi processes this data and determines the optimal sorting strategy. It sends commands over UART to the stm32 microcontroller, which performs motor control. The mechanical sorting process operates as follows:

Card Feeding & Identification:
  • A stepper motor rotates a wheel to align slot 1 with the feeder mechanism.
  • Dual DC motors push a single card from the deck into the assigned slot.
  • The process repeats for all 52 cards, ensuring each card’s value is recorded.
Optimized Reordering & Dispensing:
  • The algorithm accounts for both card positioning and time efficiency when determining the optimal dispensing order.
  • In Random Mode, the algorithm not only shuffles the deck but also ensures an efficient dispensing sequence to minimize sorting time.
  • The stepper motor realigns the first card with the dispensing mechanism.
  • A small motor-controlled trapdoor releases each card in sequence, ensuring precise deck reconstruction.

Power Supply & Connectivity

The system is powered by wall power and a PC power supply with internal voltage regulation providing 3.3V, 5V, 9V, and 12V outputs to support various components, including the Raspberry Pi, motors, stm32, and camera module.

This process ensures the deck is sorted efficiently, whether for poker games, card tricks, or other applications requiring controlled shuffling.

Project Specific Design Requirements (PSDRs):

  1. PSDR #1 (Hardware): An ability for the microcontroller to interface with a stepper motor driver to move stepper motor in precise increments
  2. PSDR #2 (Hardware): An ability for the microcontroller to communicate with Raspberry Pi over a UART connection.
  3. PSDR #3 (Hardware): An ability for the microcontroller to control brushed DC motors with certain speed and direction to feed 1 card
  4. PSDR #4 (Software): A mobile application that can be used to select desired order of cards and communicate with raspberry pi via Bluetooth
  5. PSDR #5 (Software): An algorithm that determines an order of loading/unloading cards optimized for time given the original order of deck and parameters concerning shuffled order of cards

  6. Stretch PSDR #1: Provide greater functionality through phone application for Poker screen, to allow for continuous game modes, simulating game feature and Poker modifications.
  7. Stretch PSDR #2: Implementation of STM32 firmware using an RTOS to guarantee smooth motor control and timely communication