Play rock-paper-scissors utilizing a time-of-flight sensor and an Arduino UNO R4
July seventeenth, 2024
—
Owing to its simplicity and fast-paced nature, rock-paper-scissors is a good recreation to play with associates, and on the subject of translating it right into a digital format, many inventive variations may be made. This model by madmcu forgoes the everyday three-button enter scheme in favor of an AI mannequin working on an Arduino UNO R4 Minima and a time-of-flight (ToF) matrix sensor.
Whereas many ToF sensors have a single laser emitter and detector pair, the VL53L5CX accommodates an 8×8 grid of detectors that enables it to kind a really rudimentary picture comprised of shorter and longer distances. Due to this reality, madmcu was capable of start his undertaking by capturing a wide range of these “pictures” through the NanoEdge AI Studio and assigning labels for “unknown,” “nothing,” rock,” “paper,” and “scissors” throughout the dataset. From right here, a gesture classification mannequin was skilled on the dataset after which exported as an embedded mannequin to be used in firmware.

To be able to play rock-paper-scissors, the UNO R4 Minima begins by initializing the ToF sensor module and NanoEdge mannequin earlier than coming into the primary loop. The system constantly grabs new information from the sensor, classifies it, after which checks the worth towards the pc’s randomized choice to find out the winner. The sport continues till both the participant or the Arduino reaches three factors.
For extra details about the method of coaching a mannequin on ToF information, you’ll be able to learn madmcu’s undertaking right here on Instructables.