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.