Skip to main content
Version: ACS CC

Randomness-audited Wheel-of-Fortune

A motorized wheel that randomly chooses its output and also proves how fair it is.

info

Author: Radu-Alexandru Vasilescu
GitHub Project Link: https://github.com/UPB-PMRust-Students/acs-project-2026-vasilescuradu

Description

The Randomness-audited Wheel-of-Fortune is an arcade-like product, designed to be fun and interesting. The user chooses the number of full rotations, presses the “start game” button and the wheel begins to rotate. When it stops, the result is displayed on the LCD screen, along with fairness statistics. The project uses an entropy source - the jitter from an unconnected analog pin – to create a carnival experience. At the same time, fairness is guaranteed by the chi-square test and the distribution of the results is logged on an SD card for external audit.

Motivation

I am interested in how mathematics can be used in practical contexts and the wheel-of-fortune shows exactly that. Probabilities and statistics have applications in domains such as economics, physics, gambling, etc. Therefore, they are one of the most straightforward ways to show that mathematics is not only about theory, but also about real-life situations.

Architecture

Project architecture

Log

Week 27 April - 3 May

I created the documentation, containing a lot of details about the project.

Week 10 - 17 May

I created the motorized wheel and presented a spin demo for the hardware milestone. Also, I wired the pot and the button.

Week 18 - 24 May

I wired the SD card reader, the EEPROM and the LEDs. I implemented most of the required software and presented a demo for the software milestone.

Week 25 - 31 May

I replaced the DC gear motor and VNH2SP30 driver with a 28BYJ-48 stepper motor and ULN2003 driver, which lets the wheel land exactly on the target slot without speed/brake calibration. I added a 16x2 LCD (4-bit mode) that shows the result and the chi-square fairness verdict after each spin, moved the start button to an analog input, and repurposed the potentiometer to select the number of full rotations.

Hardware

The hardware architecture revolves around the STM32 microcontroller. The physical rotation of the wheel is powered by a 28BYJ-48 stepper motor controlled via a ULN2003 driver, which gives exact, repeatable positioning on the target slot without any speed or brake calibration. The system is powered via a 5V USB connection. User inputs are handled by a 50k potentiometer to configure the number of full rotations and a physical push button (read as an analog voltage level) to start the game. A 16x2 LCD displays the resulting slot and the fairness verdict after each spin. The AT24C256 I2C EEPROM is used for stats logging. The MicroSDHC 8GB card and the SD card reader nano module are used for external audit. All components are prototyped and connected using a standard 830-point breadboard and a dedicated jumper wire set.

Schematics

KiCAD Schematic

Bill of Materials

DeviceUsagePrice
STM32 Nucleo BoardThe main microcontroller running the logic~ 100.00 RON
28BYJ-48 5V Stepper Motor and Blue ULN2003 Driver SetPhysically rotates the wheel16.97 RON
50k Mono PotentiometerAnalog input to select the number of rotations1.49 RON
White Round Cap Push ButtonAnalog input to trigger the spin event1.99 RON
830 Tie-Point Breadboard and Jumper Wire KitPrototyping and interconnecting all electronic modules39.00 RON
SD card reader nano moduleInterfaces with the SD card for data logging16.00 RON
AT24C256 I2C EEPROM ModulePersistent storage for statistics across reboots9 RON
MicroSDHC 8GB cardPhysical storage medium for the external audit logs38 RON
Display LCD1602 HD44780Used for displaying results and statistics14 RON

Software

The software architecture is written entirely in Rust, utilizing the Embassy asynchronous execution framework. This allows the microcontroller to handle multiple concurrent tasks—such as driving the stepper motor, managing user inputs, and logging data to the SD card—without blocking the CPU.

LibraryDescriptionUsage
embassy-stm32Async HALHardware abstraction (GPIO, ADC, I2C, SPI). The EEPROM (raw I2C) and the 16x2 LCD (4-bit GPIO bit-banging) are driven directly through this HAL, without a dedicated driver crate.
embassy-executorAsync task executorRuns the main loop and the SD logger as concurrent async tasks.
embassy-syncAsync synchronization primitivesSignal that passes the latest stats snapshot to the SD logger task.
embassy-timeTimekeeping, delays and timeoutsStepper step timing, button debounce, LCD timing.
embedded-halStandard hardware traitsSPI/GPIO traits for the SD card interface.
embedded-hal-busSPI/I2C bus-sharing helpersExclusiveDevice wrapper for the SD card on the SPI bus.
embedded-sdmmcFAT filesystem & SD card driverWriting CSV audit logs to the SD card.
defmtEfficient logging frameworkDebug/info logging over RTT during development.
cortex-mCortex-M core accessCycle-accurate short delays (asm::delay) for the LCD enable pulse.
  1. Embassy Book - Official documentation for the Embassy async Rust framework.
  2. STM32 Rust Ecosystem - Repositories and Hardware Abstraction Layers for STM32 microcontrollers.