Dice4Me is a high-performance, physical "Dice-as-a-Service" (DaaS) platform that bridges the digital and physical worlds. Built on the Raspberry Pi 5, this project allows anyone in the world to trigger a mechanical dice roll in real-time through a dedicated web interface or by simply mentioning the bot on X (Twitter).
While most online gaming and randomization use software-based Pseudo-Random Number Generators (PRNG), Dice4Me returns to the roots of probability: Pure Physics.
How It WorksThe system stays idle until a command is received. Once a user clicks the "Roll" button on the website or sends a roll mention on X:
The Trigger: The Pi 5 captures the event instantly using the X Stream API (v2) or a secure web socket.
- The Trigger: The Pi 5 captures the event instantly using the X Stream API (v2) or a secure web socket.
The Action: A high-torque hobby servo, driven by the Pi 5's hardware PWM, agitates the dice chamber to ensure a fair and chaotic tumble.
- The Action: A high-torque hobby servo, driven by the Pi 5's hardware PWM, agitates the dice chamber to ensure a fair and chaotic tumble.
The Evidence: After the roll, a high-definition camera captures the result.
- The Evidence: After the roll, a high-definition camera captures the result.
The Delivery: The raw image is instantly uploaded to the web gallery and replied back to the user on X as photographic proof.
- The Delivery: The raw image is instantly uploaded to the web gallery and replied back to the user on X as photographic proof.
Low-Latency Streaming: By migrating from polling to a Stream-based architecture, the system achieves near-zero latency between a social media mention and physical hardware movement.
- Low-Latency Streaming: By migrating from polling to a Stream-based architecture, the system achieves near-zero latency between a social media mention and physical hardware movement.
The Power of Pi 5: Leveraging the Raspberry Pi 5’s improved processing power to handle simultaneous camera captures, servo controls, and API handshakes without breaking a sweat.
- The Power of Pi 5: Leveraging the Raspberry Pi 5’s improved processing power to handle simultaneous camera captures, servo controls, and API handshakes without breaking a sweat.
The "Anti-Algorithm" Philosophy: I intentionally avoided OCR (Optical Character Recognition). By providing the raw photo of the dice, the system ensures 100% transparency. Users trust their eyes more than a line of code saying "You rolled a 6."
- The "Anti-Algorithm" Philosophy: I intentionally avoided OCR (Optical Character Recognition). By providing the raw photo of the dice, the system ensures 100% transparency. Users trust their eyes more than a line of code saying "You rolled a 6."
Security & Longevity: To protect the mechanical components and manage API limits, the system features a 30-second cooldown and is shielded by Cloudflare Turnstile to prevent bot-driven mechanical fatigue.
- Security & Longevity: To protect the mechanical components and manage API limits, the system features a 30-second cooldown and is shielded by Cloudflare Turnstile to prevent bot-driven mechanical fatigue.
Controller: Raspberry Pi 5
- Controller: Raspberry Pi 5
Actuator: High-Torque Hobby Servo (PWM Controlled)
- Actuator: High-Torque Hobby Servo (PWM Controlled)
Vision: Pi-compatible Camera / USB Webcam
- Vision: Pi-compatible Camera / USB Webcam
Software Stack: Python, Tweepy (Stream API), Cloudflare Turnstile, Custom Web Backend.
- Software Stack: Python, Tweepy (Stream API), Cloudflare Turnstile, Custom Web Backend.
Dice4Me isn't just a dice roller; it's an exploration of Hardware-as-a-Service and a tribute to the tactile nature of randomness in a digital age.









Comments