Coin Tossing Machine

Introduction: Coin Tossing Machine

About: I love making and flying RC planes.

Any class of probability starts with the example of coin tossing. If we toss a coin result will be either head or tell. And Ideally, after infinite number of tosses, we should be getting 50-50 percentage of distribution. But typically coin are somewhat biased (Not identical on both sides) due to differences in weight distribution, imperfections in the edge or complete bend.

To check how biased a typical coin is I prepared the machine that I will try to explain in this instructable. I also tried to make the whole process completely automated such that any number of experiments can be carried out. The set takes around half-second for a complete cycle of tossing and measurement. Which seemed to be fast enough for a few lakhs of cycles.

Step 1: Concept and Required Material

To toss a coin, a solenoid actuator was used. when activated it will push and flip the coin. Such type of actuator takes a few Ampere of the current at 12V so a dedicated power supply is a must.

To check which side coin landed, black and white color is applied on the respective side. while coin comes at rest a LASER diode throw light on it, while reflected light is capture by the LDR sensor (it is recommended to use Photodiode as it has linear output). If while the colored side is facing upward, the intensity of reflected if higher than the black side upward.

Required material:

  • Solenoid Actuator: similar to attached image [higher spec is better: mine was with 10mm stroke and 5N of force which was on the lower limit of requirement]
  • Motor driver: [depending on selected actuator suitable motor driver can be used]
  • 12V power supply
  • Laser diode: [typical 5-10 mW should work]
  • Light sensor [Photo resistor or photodiode]
  • Water or soda bottle,
  • Arduino

Step 2: Working : Hardware

In this machine, Arduino is controlling all sensors and actuators.The solenoid actuator is connected via a motor driver. An actuation signal is provided by Arduino to the motor driver. A laser is also directly connected to Arduino. Depending on which pin diode is connect and the type of diode, the extra resistor may or may not be required.

To capture the intensity of the light LDR sensor is used. however, if you are planning to build a similar experiment I will highly recommend you make use of Photodiode or phototransistor as a photosensor. LDR giver non-linear output which makes it very sensitive towards ambient light (this sensitivity also varies at various light intensity levels) and denoising is also difficult. To take intensity value from LDR, a voltage divider circuit is prepared and Arduino reads the analog value.

As mentioned, it is difficult to denoise the data from the LDR sensor. so to eliminate the effect of ambient light, it kept inside a box. This box also helps to dampen the noise from the setup.

The container we are using is also having a conical shape. The coil always lands on an operational area of the piston.

Step 3: Working of Code

At the time of turning ON the setup, Arduino captures the light brightness value from LDR sensor. This value will be used as a seed for random number generation in working steps,

Steps:

  1. A random number generated between 35 to 80,
  2. Pulse with the width equivalent to the random number generated in step 1 is applied to the solenoid actuator,
  3. delay of around 400 seconds to let coin settle,
  4. LASER is turned ON and value captured by LDR,
  5. LASER is turned OFF and value captured by LDR,
  6. The difference of value from step 4 and 5 will give denoised value, (this method is well suited for photodiode)
  7. all the required data transmitted to the computer via serial communication,

The code for the same can be found below.

Attachments

Step 4: Getting the Data

Initially, the head side is painted black and tell with white. after making any modification/repaint setup was run for around 10,000 numbers of the flip of which data was not considered.

  • After completing 3,00,000 of flip data was not converged to 50 but at 48.8,

To verify if the above concern is due to the bias of the original coin or due to added paint, the color scheme was flipped (called color scheme 2) where the head side is white and the tell side is black.

After making the modification repeating the same experiment for 2,00,000 times and data was captured.

The Excel file of complete data for both schemes is available for download at the below link.

Step 5: Summery

  • As can be shown in the figure, the paint application was adding bias to the coin. Here black paint was made using a permanent marker which is a thin layer of color. while white color is applied by whiner pen which generally makes a thin layer of coating. this may have added the weight difference on both sides.
  • After combining both schemes results in distribution of 49.2-50.8 %.
  • The improper landing of the coin can also lead to errors in measurement. if coin somehow settled such a way that laser does not fall over it results in an error.
Trash to Treasure Contest

Participated in the
Trash to Treasure Contest

Be the First to Share

    Recommendations

    • Robots Contest

      Robots Contest
    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest
    • Retro Tech Challenge

      Retro Tech Challenge

    Comments