Traditional casino environments, especially Blackjack tables, often struggle with the manual overhead of chip management and player tracking. Relying on physical tallies and manual entry is not only time-consuming for the dealer but also prone to human error, leading to potential disputes and a slower gaming experience.
To modernize this process, we developed a Connected Blackjack system as part of an IoT project within the RIOC (Réseaux Informatiques et Objets Connectés) program at UniLaSalle Amiens. This solution automates player identification and bankroll management using RFID technology and LoRaWAN communication. Developed within a constrained 50-hour window, the primary objective was to discover the LoRa protocol through a concrete application, allowing us to fully apprehend this communication method and evaluate its suitability for such a real-time transactional environment.
By scanning a personal badge, players can instantly view their virtual balance on a local display and place bets via a matrix keypad. On the other side of the table, the dealer manages the game through a dedicated, touch-friendly web dashboard, receiving real-time updates on transactions and seamlessly settling bets. This project successfully created a secure, reliable, and user-friendly bridge between physical hardware and a centralized database, while providing a comprehensive understanding of LoRa's practical implementation and constraints
2. Features & FunctionalityThe system is designed to create a seamless bridge between physical casino assets and digital management, ensuring both ease of use for the player and high-precision control for the dealer.
Player Side: The Interactive Terminal
The player interface is built for tactile engagement and immediate feedback, replacing traditional physical chips with a digital "Smart Wallet" experience.
- Secure Authentication (2FA): Players log in by tapping their personal RFID card or wristband, then input a secure PIN code via the matrix keypad. This Two-Factor Authentication ensures that lost or stolen badges cannot be exploited (show the video at the end).
- Virtual Balance Display: A high-contrast display (OLED/LCD) provides real-time updates on the player’s credit balance and current bet, eliminating "guesstimate" betting (show the video at the end).
- Keypad Interaction: The physical keypad allows players to input bets and confirm transactions, ensuring a deliberate and error-free user experience.
Player Side: The Personal Web Dashboard
Beyond the physical table, players have access to a dedicated self-service web portal to track their gambling journey and monitor their bankroll.
Personal Statistics: A visual breakdown of their historical performance, including total games played, cumulative wins, and total losses.
Recent Activity: Players can instantly check the outcome of their last hand (Gain, Loss, or Tie), the exact amount involved, and the physical table number where it occurred.
Global Leaderboard: A competitive, gamified element that displays the top players with the highest balances. This fosters friendly competition and drives engagement across the casino floor.
Dealer Side: The Control Hub
The dealer manages the flow of the game through a centralized tablet interface, specifically designed to reduce cognitive load and eliminate manual bookkeeping.
Real-time Monitoring: Using an asynchronous data fetch, dealers can see every active player at their specific table and their live bets at a glance, without ever refreshing the page.
Smart Chip Calculator (Automated Gain/Loss): Instead of manually calculating payouts and math formulas, the dealer uses a touch-friendly interface to input the physical chips left in front of the player (e.g., tapping "+" on 100€, 25€, or 5€ chip icons). The system automatically calculates the net profit or loss against the initial bet and updates the database instantly.
Table Analytics: Provides instant data on player historical performance and betting trends.
Security: Multi-Layered Protection
To maintain the integrity of the "House, " the system employs a "Defense in Depth" strategy:
Hardware-Bound Tokens: Each RFID token uses a Unique Identifier (UID). The system recognizes only verified tokens registered in the database.
Encrypted Payloads: Communication between the nodes and the gateway is secured by the LoRaWAN protocol, and server-side data extraction relies on strict byte-level parsing to prevent injection.
3. Hardware ArchitectureThe physical terminal was designed to showcase the technology while remaining functional for a casino floor.
📦 Enclosure: Laser-Cut PrecisionThe main body was generated using Box.py, creating precise DXF interlocking panels for a sturdy, professional finish.
Front Interface: The LCD screen is flush-mounted in the top-left, with the project logo etched below. An intuitive "Signal" icon and "SCAN HERE" text guide the player to the hidden RFID sensor.
- Front Interface: The LCD screen is flush-mounted in the top-left, with the project logo etched below. An intuitive "Signal" icon and "SCAN HERE" text guide the player to the hidden RFID sensor.
The "Backstage" View: To highlight the engineering, the top panel is made of transparent acrylic, allowing a full view of the internal wiring and the SODAQ Explorer board.
- The "Backstage" View: To highlight the engineering, the top panel is made of transparent acrylic, allowing a full view of the internal wiring and the SODAQ Explorer board.
Branding: Large-scale logos are laser-engraved on the lateral panels.
- Branding: Large-scale logos are laser-engraved on the lateral panels.
Slide-in Mounting Deck: We engineered a secondary wooden plate that slides into two wooden guide rails (plinthes). This locks the electronics in place without messy adhesives and allows for easy maintenance.
- Slide-in Mounting Deck: We engineered a secondary wooden plate that slides into two wooden guide rails (plinthes). This locks the electronics in place without messy adhesives and allows for easy maintenance.
Component Placement: The RFID module is secured directly behind the front engraving for high-sensitivity reads. Custom cable channels were cut into the internal plate to keep the "Backstage" view clean.
- Component Placement: The RFID module is secured directly behind the front engraving for high-sensitivity reads. Custom cable channels were cut into the internal plate to keep the "Backstage" view clean.
Connectivity: A square cutout in the rear allows for the power supply and the Matrix Keypad ribbon cable, which connects to a dedicated side-pedestal for better ergonomics.
- Connectivity: A square cutout in the rear allows for the power supply and the Matrix Keypad ribbon cable, which connects to a dedicated side-pedestal for better ergonomics.
This section details the integration between the physical IoT layer (LoRaWAN) and the centralized management system (Flask/SQL), ensuring real-time synchronization between a player’s physical actions and their digital account.
The Backend: Python-based Server
The heart of the application is a Python 3 server utilizing the Flask micro-framework. It operates as a multi-threaded system to handle two concurrent communication streams:
Web Stream: Manages HTTP requests for the Dealer and Player dashboards.
IoT Stream: A dedicated background thread runs a Paho-MQTT client. This client stays connected to the The Things Network (TTN) broker using SSL/TLS encryption (Port: 8883) to listen for incoming LoRaWAN messages without blocking the web interface.
The Database: SQL Structure
A SQLite database provides a persistent and relational storage system. It is designed with two primary entities to manage the casino environment:
JOUEUR (Player): Stores unique RFID UIDs, encrypted PINs, current balances, and real-time game status (e.g., table_id, en_jeu). It also tracks historical data such as total wins/losses and the last bet amount.
CROUPIER (Dealer/Admin): Stores administrative credentials and assigns dealers to specific physical tables to filter the data they see on their dashboard.
The Frontend: UX/UI Dashboard
The interface is built with HTML5, CSS3, and JavaScript.
Dealer Focus: The dashboard is optimized for rapid use during a game. It features a dynamic table view that fetches data via an AJAX API (/api/table_data). This allows the dealer to see new bets appearing in real-time without refreshing the page.
Security: Session management ensures that only authenticated dealers can access the "update balance" or "kick player" functions.
Logic Flow: Bridging LoRaWAN to the Database
The "bridge" follows a specific bidirectional logic to ensure data integrity:
- Uplink (Device → Server): The IoT device sends a Hex-encoded payload via LoRaWAN.
- Decoding: The Flask server receives this through the MQTT thread, decodes the Base64 payload, and uses Python's struct library to unpack the bytes and extract commands (e.g., 0x08 for a Badge Scan, 0x09 for a Bet).
- Processing: If a bet is placed (
0x09), the server queries the SQL database to verify therfid_uidagainst the receivedpassword_pin. If authenticated and the balance is sufficient, it deducts the bet and updates theJOUEURtable. - Downlink (Server → Device): The server generates a specific byte-packed confirmation payload (e.g.,
0x01for Bet OK, or0x00containing the player's balance). This is pushed back to the TTN MQTT broker via a downlink, which transmits it to the end-node to trigger visual feedback (LCD update or LEDs).
The heart of the terminal is a SODAQ Explorer board programmed via the Arduino IDE. The logic is designed as a linear state machine to ensure the player is never lost during the transaction process. To optimize battery life and network bandwidth, we designed a custom byte-level protocol instead of sending heavy JSON strings.
📶 Phase 1: Initialization & Network JoinUpon power-up, the LCD displays Initialisation. The SODAQ attempts to join The Things Network (TTN) using OTAA (Over-the-Air Activation). Once the handshake is successful, a test payload is sent to confirm the link.
The system waits in an "Idle" state, displaying Scanner carte pour jouer.
The player taps their RFID card against the "Signal" icon.
- The player taps their RFID card against the "Signal" icon.
The system captures the UID and sends it via a 0x08 Uplink.
Structure:[Command: 0x08] [UID (48 bits)] [Table ID (4 bits)]
- Structure:
[Command: 0x08] [UID (48 bits)] [Table ID (4 bits)] - The system captures the UID and sends it via a 0x08 Uplink.Structure:
[Command: 0x08] [UID (48 bits)] [Table ID (4 bits)]
The screen immediately updates to Verification en cours....
- The screen immediately updates to
Verification en cours....
If the backend validates the UID, it displays the player on the dealer's dashboard and sends a 0x00 Downlink back to the terminal.
Payload Structure:[Command: 0x00] [PIN (2 bytes)] [Balance (2 bytes)]
- Payload Structure:
[Command: 0x00] [PIN (2 bytes)] [Balance (2 bytes)]
The terminal then guides the player through the "Smart Wallet" setup:
Balance Display: Shows Compte trouvé! followed by the actual balance.
- Balance Display: Shows
Compte trouvé!followed by the actual balance.
Bet Entry: The player uses the Matrix Keypad to enter their table buy-in.
Constraints: Max 1000€ and cannot exceed the user's total balance.
- Constraints: Max 1000€ and cannot exceed the user's total balance.
Controls: Key # to reset/clear, Key D to validate the amount.
- Controls: Key # to reset/clear, Key D to validate the amount.
- Bet Entry: The player uses the Matrix Keypad to enter their table buy-in.Constraints: Max 1000€ and cannot exceed the user's total balance.Controls: Key # to reset/clear, Key D to validate the amount.
To finalize the transaction, a 4-digit PIN is required.
Security: If the entered PIN doesn't match the one received in the downlink, the screen displays BAD PIN CODE - Try Again.
- Security: If the entered PIN doesn't match the one received in the downlink, the screen displays
BAD PIN CODE - Try Again.
Validation: If correct, the terminal sends a 0x09 Uplink to lock the bet.
Structure:[Command: 0x09] [UID] [Bet Amount] [PIN]
- Structure:
[Command: 0x09] [UID] [Bet Amount] [PIN] - Validation: If correct, the terminal sends a 0x09 Uplink to lock the bet.Structure:
[Command: 0x09] [UID] [Bet Amount] [PIN]
Once the server processes the bet, it sends a 0x01 Downlink (Success).
The screen displays Succes - Attendre mise.
- The screen displays
Succes - Attendre mise.
The player's digital balance is updated, and the dealer is notified.
- The player's digital balance is updated, and the dealer is notified.
After a short timeout, the terminal resets to the "Scan Card" screen for the next player.
- After a short timeout, the terminal resets to the "Scan Card" screen for the next player.
While the full source code manages complex timings and I2C/SPI peripherals, the core logic relies on a robust error-handling system for the LoRaWAN stack.
Note on connectivity: In a casino environment, a "frozen" screen is not an option. We implemented specific feedback for network states:
Timeouts/Busy: Displays Erreur - patientez... while the RN2483 module retries.
- Timeouts/Busy: Displays
Erreur - patientez...while the RN2483 module retries.
Fatal Errors: Displays Contacter Assistance to signal a hardware or network blackout.
- Fatal Errors: Displays
Contacter Assistanceto signal a hardware or network blackout.
Note on connectivity: In a casino environment, a "frozen" screen is not an option. We implemented specific feedback for network states:Timeouts/Busy: Displays6. Results & ConclusionErreur - patientez...while the RN2483 module retries.Fatal Errors: DisplaysContacter Assistanceto signal a hardware or network blackout.
- Project timeline (50h) vs. Achievement.
- Future improvements (e.g., Leaderboards, advanced statistics).







Comments