optical obstruction timer? ... for measuring diameter of coin

Hi there, I'm not sure if what I'm trying is possible, but I've rigged up an LED and a Photoresistor, which face each other and when the LED is blocked from the Photoresistor it starts to count, so when a coin falls past it, it should give me a rough diameter of this coin, allowing me to add all the coins that pass, together. The reason for this is to count up to 10p for my arcade machine at home, but rather than separating the coins with physical materials, i thought it would be possible to do it with an arduino. :smiley:

my first problem is i cant get an accurate reading of the coin, and the other being a way to calibrate it

I have got it to Serial.print(); when something passes the between the photoresistor and led, and it counts it, but i seem to be getting the same results for different coin sizes.

here's the code I wrote to manually display the results and my (beginner) failed attempt at using ascii input to calibrate two separate coins(commented out)

int M[2];


int IB = 0;

int LP = 0;
int LED = 11;
int LR;
int Time = 0;

void setup()
{
  Serial.begin(9600);
  analogWrite(LED, 10);
}


void loop()
{
  LR = analogRead(LP);
  if(LR < 250)
  {
    Time ++;
    Serial.println(Time);
    analogWrite(10, 20);
  }else
  {
    Time = 0;
    analogWrite(10, 0);
  }
  delay(.005);
}

/*
void loop()
{
  LR = analogRead(LP);
  if(Serial.available() == 49)
  {
    if(LR < 255)
    {
      analogWrite(10,20);
      Time ++;
      Serial.print(Time);
    }else
    {
      M[1] = Time;
      analogWrite(10,0);
      Time = 0;
      Serial.println(M[1], M[2]);
    }
  }
    else if(Serial.available() == 50)
    {
      if(LR < 255)
    {
      analogWrite(10,20);
      Time ++;
      Serial.print(Time);
    }else
    {
      M[2] = Time;
      analogWrite(10,0);
      Time = 0;
      Serial.println(M[1], M[2]);
    }
  }
}
*/

Any Ideas, thanks in advance, Morgan.

I'm guessing that this is going to be very unreliable. A slow moving 5p will likely appear larger than a quick moving 10p. The difference between slow moving and fast moving will be more pronounced than the difference in diameter.

I know the commercial coin counters rely on various properties. Physical size is usually just a matter of a mechanical means to separate the cons but weight and magnetic properties are more important.

Some kind of coil and hall effect transistor might give some interesting results.

Using the concept utilized in casinos, use tokens... They are identical. Each token = 10p, so you only need to count 1 pulse per credit. Game machine brass tokens are purchased online.

Ray

As KenF said, that's very unreliable, as you don't know the speed of the coin which is, in part, due to friction between it and the slot. I suggest you use light beams at various heights to detect the size of the coin. Detect the biggest coin (£2) first, going down to the smallest (5p) last. The value of the coin can be determined by which beam is broken first.

Thanks for the quick replies.

do you think that a better plan of action could be a potentiometer that measures the diameter? this was my fall back idea, but what do you think, has anyone ever made a coin counter type thing before?

also what do you mean by light beam?

mogness:
Thanks for the quick replies.

do you think that a better plan of action could be a potentiometer that measures the diameter? this was my fall back idea, but what do you think, has anyone ever made a coin counter type thing before?

How would you do that?

mogness:
also what do you mean by light beam?

A slot in one side of the coin chute with a light (LED) behind it. A corresponding slot in the other side of the chute with an LDR or Photo-transistor behind it, to detect when the beam is broken.

BTW Currently there's a problem faced by many vending companies due to the change in material that they're using for the low value silver coins. So if you use my magnetism idea, you may get some inconsistent results.

Problems with newer silver coins UK

KenF:
BTW Currently there's a problem faced by many vending companies due to the change in material that they're using for the low value silver coins. So if you use my magnetism idea, you may get some inconsistent results.

Problems with newer silver coins UK

Some pennies are magnetic and some aren't.
At least magnetic coins will be easier to retrieve from down the back of the sofa. :slight_smile:

i was thinking of having a coin rail for the coin to roll along, and have it roll under an arm which is lifted by the coin, and after some gearing, to stop coins from jamming, turn a potentiometer.

A slot in one side of the coin chute with a light (LED) behind it. A corresponding slot in the other side of the chute with an LDR or Photo-transistor behind it, to detect when the beam is broken.

that was my original idea, but i had to separate the coins mechanically. which is the reason i was trying to value the coins digitally :slight_smile:

I think you need two light sensors. One at the bottom of the track to sense the arrival of the coin at the right position and another higher up, to sense the amount of light passing through a slot at THAT PRECISE moment.

mogness:
i was thinking of having a coin rail for the coin to roll along, and have it roll under an arm which is lifted by the coin, and after some gearing, to stop coins from jamming, turn a potentiometer.

The difference in diameter is very small, less than 1mm in some instances. I doubt you'd get enough accuracy with a pot to do that.

that was my original idea, but i had to separate the coins mechanically. which is the reason i was trying to value the coins digitally :slight_smile:

You will need a light beam for each different size (value) of coin.

Henry_Best:
At least magnetic coins will be easier to retrieve from down the back of the sofa. :slight_smile:

If you pop down B & Q You'll find that their larger washers are more expensive than currency. I can see a day when people are drilling holes in the coins and trying to pass them off on ebay as real washers.

Hi, interesting coin sorter, heathrobinson.

Tom.... :slight_smile:

has anyone ever made a coin counter type thing before?

Me back in 1994 for the old BBC computer. You might have trouble getting the linear CCD sensor now but this is how I did it.

Coin Counting.zip (40.6 KB)

You could always use something like this:-

KenF:
trying to pass them off on ebay as real washers.

What do you mean?

Why wouldn't they be real washers ?

They are not worth passing off (undamaged) as money.

...R

PS suspect it may be illegal to "deface coinage"
And too expensive to drill the holes.

Hi, how many different diameters and what are they in mm?

Thanks..Tom......... :slight_smile:

Robin2:
PS suspect it may be illegal to "deface coinage"

This is why you'd have to sell them surreptitiously. If the buyer realised that they're just money, cunningly disguised. They could post negative feedback :slight_smile: