Coin Tossing Machine

by abhilash_patel in Workshop > Science

1849 Views, 2 Favorites, 0 Comments

Coin Tossing Machine

Tossing a Coin for Half a Million times

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.

Concept and Required Material

41Guh1pdYkL._SX342_.jpg
1.jpg
2.jpeg

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

Working : Hardware

info.jpg
vlcsnap-2020-04-05-15h46m46s078.png
vlcsnap-2020-04-05-15h46m17s896.png
vlcsnap-2020-04-05-15h46m59s299.png

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.

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.

Downloads

Getting the Data

coin info.PNG

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.

Downloads

Summery

3.jpg
  • 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.