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.

Very clever design.

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.

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

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

Does that mean this is the statistical version of a … freudian slip?

(Thank you, I’ll show myself out)

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

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.

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

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.

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

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

But you change the outcome by measuring it

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.

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

What does a random sequence look like?

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

Someone asked him to post his results on the youtube video:

https://aconz2-public.s3.amazonaws.com/fa7a32c7-aa16-4069-bb92-d305802736e6/10k-coin-flips.csv.gz

Looks like out of 10040 flips it was tails about 50.697% of the time.

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

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

A real coin is already biased.

Because most of them feature old white men?

B^)

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

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.

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

+1, had the same thought

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.

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.

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

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.

Excellent work all around.

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?

Tim Hunkin did this a while ago, though his contraption has his usual… flair

https://youtu.be/iSLmzjE_woQ?t=842

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!