Maths problem anyone ?...


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2004
    Location
    Scarborough UK
    Posts
    77

    Talking Maths problem anyone ?...

    I have a vending machine that takes 6 diferent types of coin.

    I can set my coin acceptor to give 1 to 50 pulses to my pic for any coin.

    lets say I asign coin1 to give 1 pulse, coin2 gives 2 pulses, coin3 gives 3 pulses... and so on to coin 6.

    thats fine, i can count the pulses to determine which coin was inserted and give the apropriate credit :-).

    BUT, if someone enters coins fast the pulses have no gap between coins, so, if I insert coin 1 & coin 3 fast I get 3 pulses with no gap between.

    So, how do I set the pulses so that I can decide which 2 coins were inserted from the 6 available coins ?
    Reading the datasheet & understanding it are two different things.

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: Maths problem anyone ?...

    Assign only odd numbers to the six different coins, so if two coins have no gap then they will produce an even number and you can detect it and work out as it has been generated.

    Cheers

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: Maths problem anyone ?...

    The answer depends on how many coins a person could possibly have to insert. I assume that a user could insert multiples of the same type of coin. The number of
    combinations gets larger if you buy something for $1, and you are allowed to enter 100 pennies or 20 nickels or any number of other combinations. Now there tree gets larger. So is there a maximum number of coins a user could use?
    Charles Linquist

  4. #4
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Re: Maths problem anyone ?...

    Why cant you assign a number of pulses for each coin depending of their value? Then you can just add all pulses together and get the credit and it would not matter if the person spent all day using 1 cent coins we would still around lunch reach 1 USD :-)

    What are the coin values?

  5. #5
    Join Date
    Dec 2004
    Location
    Scarborough UK
    Posts
    77


    Did you find this post helpful? Yes | No

    Default Re: Maths problem anyone ?...

    Hi Guys

    aratti
    I tried giving them odd numbers but with 6 coins if you write down all the possible coin combinations (which i did) you get diffrent coin combinations that add up to the same value.

    Charles
    I guess its a case of how many coins a person could phisicaly insert one after another at great speed, i would guess it wouldnt be more than 10 at the extreme.
    Yes you would have multiples of the same coin.

    Jumper
    I can asign diferent pulses for diferent coins, but if they are inserted fast there is no space between pulses so we cant count them to decide which coin.
    Reading the datasheet & understanding it are two different things.

  6. #6
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Re: Maths problem anyone ?...

    5 cent coin = 1 pulse
    10 cent coin = 2 pulses
    25 cent coin = 5 pulses
    50 cent coin = 10 pulses
    1 dollar = 20 pulses

    Then it is just to count all pulses.. when you get to 20 pulses you have a dollar.. no matter if the person have used small coins quickly after each other or just one and one. Count the pulses and eventually the pulses will stop and then they will make a purshase.

    To get this to work with a coin machine that can only give out 1-50 pulses per coin you can not have a too big difference in value between the smallest coin and the biggest one.

    And for every pulse you pic detect you increase the LCD with 0.05 USD. When the pulses stop you have the total value. Of course you still dont know what coins that was inserted but you do know how much in value they have inserted which would be enough to know before releasing the item.

    Last time I went to the small store on the corner where I live, they did not count coins.. they counted the value of the coins until I had enough for the icecream and cookies.

    Or?

    Join the dark side - we have cookies!!
    Last edited by Jumper; - 12th September 2011 at 14:51.

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: Maths problem anyone ?...

    Can you change the width of the pulses for each coin? This might help you ID the coins.

    Also do you have access to the inner parts of the coin acceptor?
    There must be a coin detect device that triggers the coin recognition and pulse generating sequence.

    Depending on the mechanics can you add a “Coin insert enable” system driven by your PIC?
    This will let the user insert a new coin only after the pulses from the device are received so you will create your own gap between coins.

    Can you elaborate a little more on this part of your machine (coin acceptor) on both aspects mechanical and electronics?
    Does the machine separate and store the coins by type?
    Do you have access to any other information from the coin acceptor that can be used in conjunction with the pulses?

    Nick

  8. #8
    Join Date
    Dec 2004
    Location
    Scarborough UK
    Posts
    77


    Did you find this post helpful? Yes | No

    Default Re: Maths problem anyone ?...

    Nicmus
    No I cant change the pulse widths and the lockout option is unavalable as well, so..
    I think Im going to abandon the idea of counting pulses and try the totalizing method (as Jumper said), i think this just gives me another math problem (floating point) but I remember a post I read a while ago that said you just multiply the sum by 10 (eg %0.3 x 10 = 3) and then divide by 10 again when output is needed, or something like that anyway.
    So, I think the counting pulse idea is dead and I will give the percentage totalizer method a go (prepair for a new message when I fail lol)
    Reading the datasheet & understanding it are two different things.

Members who have read this thread : 2

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts