# 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. Ken Hansen says:

Very clever design.

1. RW ver 0.0.1 says:

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. Thomas Apostolidis says:

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

2. Raven says:

Oh I love this. It hlods true to my faith in statistics. on the 4th flip it landed on its edge ;-)

1. scott.tx says:

needs a slipperyer bottom so that doesnt happen… as much.

1. Dissy says:

Does that mean this is the statistical version of a … freudian slip?
(Thank you, I’ll show myself out)

3. rclark says:

Neat! A clear lid (even cellophane) would keep the coin from the occasional escape…

1. ratStomper says:

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.

4. Truth says:

Statistically would the black ink dot on one side not bias the experiment.

1. ameyring says:

The results would have to be examined. A way to minimize bias it to put a white dot of the same size on the other side of the coin.

1. But light would push harder against the white dot completely invalidating this experiment!

1. Chris Maple says:

Do it in the dark, turning on a light only when the coin is stable.

1. InverseInductor says:

But you change the outcome by measuring it

2. Soc Rat says:

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. Old Guy says:

“the actual patterns of heads and tails will look completely different than a random sequence.”

What does a random sequence look like?

1. Chris Maple says:

In this context, there should be no correlation between one trial and the next. For thoroughness, several spacings should also be tested.

1. Chris Maple says:

That’s within 1 standard deviation, if I recall correctly.

3. Old Guy says:

“Statistically would the black ink dot on one side not bias the experiment.”
A real coin is already biased.

1. Ren says:

Because most of them feature old white men?
B^)

1. Nick says:

The ones in commonwealth countries often have a female senior citizen!

5. X says:

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.

6. Soc Rat says:

“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.

7. Khordas says:

Considering that a lot of the heads/tails determination is from light levels, could probably just have used a light meter rather than a camera.

8. Truth says:

Looking at the result at the end of the video:
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.

1. Doc says:

Not really. The coin planchets all weigh the same before being stamped.

9. Chico Jablonski says:

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.

10. Doug Leppard says:

Excellent work all around.

11. John M Wettroth says:

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?

12. Andrew Consroe says:

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!

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.