Home > web3.0 > body text

This Robot Flips a Coin Based on Twitch Chat Commands

WBOY
Release: 2024-08-13 09:13:11
Original
867 people have browsed it

Making decisions is hard, which is why humanity has come up with all sorts of goofy ways to alleviate some of the mental burden. Pros/cons lists, for example, are supposed to add as much objectivity as possible to the decision-making process

This Robot Flips a Coin Based on Twitch Chat Commands

This internet-connected robot will flip a coin for you at the drop of a chat comment.

Making decisions is hard, which is why humanity has come up with all sorts of goofy ways to alleviate some of the mental burden. Pros/cons lists, for example, are supposed to add as much objectivity as possible to the decision-making process — or at least to give you clarity about the choice you’re subconsciously rooting for. But the ultimate decision maker is obviously the good ol’ fashioned coin flip. You get 50:50 odds and the entertainment of watching something shiny tumble through the air.

To make coin flips accessible to his chat over the internet, Terence Grover built this robot.

This robot lets anyone flip Grover’s very special coin via a simple command in a live stream chat. Commenting “!heads” flips the coin with heads as the prediction, and commenting “!tails” does the opposite. After receiving the command, the robot flips the coin. It then snaps a photo and analyzes that to determine which face is up. Finally, it displays the results and repositions the coin for the next flip. Grover also created a nifty graphic to display some basic statistics on the previous flips, including the heads:tails ratio and the percentage of correct predictions.

The heart of the machine is a small solenoid that provides the flipping actuation. If we have one criticism, it is that the solenoid seems weak and unable to give the coin a vigorous flip — though we’ll let the statisticians debate whether or not that affects the odds. A Raspberry Pi single-board computer controls that solenoid via a relay. It also controls a servo motor that opens and closes a 3D-printed iris mechanism, which is a clever way to recenter the coin over the solenoid after each flip.

The Raspberry Pi runs a simple server that uses the GPIO pins to toggle the relay in response to a command received over the network, which is how it is able to integrate with the chat comments. It detects the coin face using a computer vision machine learning model trained on this specific coin in this machine, using images from a connected Raspberry Pi Camera. To speed up that process, it first crops most of the photo by detecting a circle of the approximate diameter of the coin. That makes the image very small and easy to process.

A separate webcam watches the robot in action and streams the video to online viewers. That camera has a delay of a few seconds, but that matches up well with the computer vision processing time and so viewers see the detected results at about the same time as they see the corresponding flip in the video.

And to introduce a little extra drama, Grover gave the robot a special €2 coin celebrating some Monégasque prince. According to Grover, that is worth €1,000 and that raises the stakes of the coin flips.

The above is the detailed content of This Robot Flips a Coin Based on Twitch Chat Commands. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!