Flipping A Coin 10,000 Times With A Dedicated Machine

Flipping a coin is often the initial example used to help teach probability and statistics to maths students. Often, there is talk of how, given a fair coin, the probability of landing heads or tails should approach 0.5. Of course, if you want to test this, it pays to have a machine do the hard work for you. [Andrew Consroe] has the rig to do just that.

The build consists largely of 3D printed parts. A large cylindrical shroud is used to keep the coin within the flipping area. A spring-loaded dowel is actuated by a stepper motor spinning a cam, which flips the coin. Once the coin has landed, it is photographed with a webcam. An image processing pipeline then determines whether the coin landed heads or tails. A black spot is used on one side of the coin to aid analysis, as the poor-quality webcam images weren’t good enough to recognise the coin in its standard form. Once the flip has been analysed, a sliding aperture is used to push the coin back towards the flipper for the next cycle.

The machine completes a flip approximately every two seconds, meaning 10,000 flips would take approximately 2.5 days. Unfortunately, due to noise and occasional coin escapes, [Andrew] hasn’t yet been able to achieve his goal. He aims to increase speed significantly before making an all-out attempt.

Coin flips can make for decent random numbers, but if you need better ones, perhaps NIST can help you out. Video after the break.

32 thoughts on “Flipping A Coin 10,000 Times With A Dedicated Machine

    1. Very overdesigned IMO… color 1 side of coin with red sharpie, one side with green sharpie, then at least you have equal amount of ink each side, then use a red beam to light sensor one direction and green beam to light sensor other direction, detect flip when it is re-centered. Massage your outputs how you like with a little logic, or (gasp) an ATtiny85 Then with a single motor cam drive reset arms, which can be 4 arms, and compress a spring with another cam, which lets go of it to release the flipper. Whole thing just continuously driven at 30 RPM.

      1. Hi, I love your sugesstion, can you please tell me what the red beam to light sensor would be as a product, sorry about the stupid question, but any help would be grareful

    1. The problem is that if you count a coin that bounced off the lid, you no longer have “identical” circumstances for all coins flipped…some may have bounced off the lid while others didn’t.

      I little taller and wider would be ideal…but it’s certainly close enough as is.

    1. I would think the particular flipping mechanism here would be do a terrible job giving reasonably random flips. It would be interesting to do an actual statistical analysis on the data generated. Even a device that gives a 0.1 or 0.9 chance of actually changing the coin state will still produce very close to 50% head and 50% tails, but the actual patterns of heads and tails will look completely different than a random sequence.

  1. This project is a good introduction to the statistics of project management where the odds of things going as planned is always 0.0% Maybe it will also be possible to compute the odds of this project ever achieving its goal. The other interesting number to be computed here is the number of bits of useful information derived from the experiment, and the challenge here will be in distinguishing the difference between this number and zero.

  2. “The machine completes a flip approximately every two seconds, meaning 10,000 flips would take approximately 2.5 days. ”

    10,000 flips at 2 seconds each is 20,000 seconds. 20,000 seconds is 5 hours, 33 minutes, and 20 seconds.

    100,000 flips, on the other hand, is 200,000 seconds which is approximately 2.31 days.

  3. Looking at the result at the end of the video:
    heads 4950 49.3%
    tails 5090 50.7%
    The different amount of metal on each side of the coin probably had a greater influence on any statistical bias than the ink dot, at least for only 10040 flips. It would be interesting to see the bias for each coin type (and years, a tiny bit more metal for some year numbers). e.g. years with 8’s in them would weight a tiny bit more than years with 1’s.

  4. It reminded me of Lancelot Hogben’s book “Mathematics for the million”, written at the hospital, so he had plenty of time to flip the coin manually for the examples in statistics. Unfortunately, he does not tell how many times he launched it.

  5. Great project and execution. One odd observation in one of composite result graphs with the small dots, it appears that the coin seldom lands in the 7 o’clock area. Is this some assymetrry in the flipper or am I just imagining this?

  6. I noticed the same thing when putting that graph together. Not exactly sure what the explanation is. The whole board was on top of a cushion to try to reduce noise so it may have been tilted slightly with 7 o’clock being the high spot. Thanks for the kind words and keen observation!

Leave a Reply to RavenCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.