Searching \ for 'Coin count!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/timers.htm?key=count
Search entire site for: 'Coin count!'.

Truncated match.
PICList Thread
'Coin count!'
1998\09\03@213208 by g. Jorge Raul Casalini+

flavicon
face
Hello Piclisters!

       I'm working in a proyect in that i must count the number of coins(each coin activate a switch) inserted in the video game machines( 30 to 100 machines)and then sent count to a PC via RS232, so i'm using for that a 16f84 each 10 machines ( i connect switches to Portb/a).
    The cuestion is how is the best way to minimice the noise and debounce effect of switch, so i can't count extra coins.
Please, al advice are welcome!
The machine are at +-40 mts.
Best regards,  

________________________
(Ing.Jorge Raul Casalini+)
(   2729, Necochea St.   )
(     2000 Rosario       )
(       Argentina        )
(    T.E: 041-821409     )
(c-2532@fceia.unr.edu.ar )
(    jbochi@usa.net      )
(  FidoNet 4:904/24.32   )
========================

1998\09\03@225330 by Mike Keitz

picon face
On Thu, 3 Sep 1998 22:19:45 -0300 "Ing. Jorge Raul Casalini+"
<spam_OUTc-2532TakeThisOuTspamFCEIA.UNR.EDU.AR> writes:
=
>I'm
>working in a proyect in that i must count the number of coins(each
>coin
>activate a switch) inserted in the video game machines( 30 to 100
>machines)and then sent count to a PC via RS232, so i'm using for that
>a
>16f84 each 10 machines ( i connect switches to Portb/a)

I think you should use a PIC in each machine, this will simplify wiring
the site since only the serial bus needs to be brought out of each
machine.  Also, if you were going to connect directly in parallel with
the switch, the wires to the counter would be connected right to the game
logic as well.  It would be a good idea not to lead them out of the
machine to reduce the chance of the logic being damaged by a surge or
miswiring.

Since each machine will be taking coins at random, the serial protocol
needs to be well thought out to avoid collisions.  It may be a good idea
to have each PIC maintain a local count (maybe in EEPROM, then even if
the PC loses count an absolute number of coins would still be available)
and report it to the PC only when polled.


>The cuestion is how is the
>best way to minimice the noise and debounce effect of switch, so i
>can't
>count extra coins.

There are lots of approches to this.  This situation isn't too critical
since a rapid response isn't needed.  But, even with a real coin the
switch would be closed fairly briefly compared to say a manual button.
What would work well in this situation would be to sample the switch
input fairly rapidly (maybe 1 KHz).  First, require the switch to be
closed constantly for a period of time (number of samples) before
registering a count.  That would prevent false counts due to spikes or
noise on the switch line.  Second, don't register another count until
after the switch has been open constantly for a period of time.  That
prevents any bouncing after a coin passes from registering as another
count.  I would think all machines would use about the same coin
mechanism and switch, you could study with an oscilloscope a little to
see what time values are needed.




_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

1998\09\03@231643 by David VanHorn

flavicon
face
part 0 2118 bytes
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content='"MSHTML 4.72.3110.7"' name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 solid 2px; MARGIN-LEFT: 5px; PADDING-LEFT: 5px"><BR>
   <DIV><X-TAB>&nbsp;&nbsp;&nbsp; </X-TAB><X-TAB>&nbsp;&nbsp; </X-TAB>I'm
   working in a proyect in that i must count the number of coins(each coin
   activate a switch) inserted in the video game machines( 30 to 100
   machines)and then sent count to a PC via RS232, so i'm using for that a
   16f84 each 10 machines ( i connect switches to Portb/a).</DIV>
   <DIV><X-TAB>&nbsp;&nbsp;&nbsp;&nbsp;</X-TAB>The cuestion is how is the best
   way to minimice the noise and debounce effect of switch, so i can't count
   extra coins.</DIV>
   <DIV>Please, al advice are welcome!</DIV>
   <DIV>The machine are at +-40 mts.</DIV>
   <DIV>Best regards,&nbsp;&nbsp; </DIV></BLOCKQUOTE>
<DIV><FONT color=#000000 size=2>I'm an old video machine mechanic from the pong
days.. </FONT></DIV>
<DIV><FONT color=#000000 size=2>Look with a scope at the time each coin takes to
pass the switch. I think you will find that their velocity is very well
controlled by the coin rejector mechanism. You should expect during a period of
around 100mS to find the switch closed most of the time. From my experience,
most of the machines used switches by MicroSwitch, which have a lot of
hysteresis, and almost no bounce. </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>Just use some sanity checking, like it is
impossible to get more than 1 coin through in less than X time. and you should
be ok.</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV></BODY></HTML>

</x-html>

1998\09\04@020359 by Quentin

flavicon
face
Think about this:
Find out what is the shortest time between one coin insertion and the next.
Find out what is the longest time of the "noise" of the coin.
Now on first detection of coin, BSF a bit, then call delay longer than
noise, but shorter than delay between coins. Send data, then BCF the bit.
The only problem I see here is that as you are using the PIC to read 10
machines, the delay routines can cause some problems.
Maybe you should use one PIC per machine, or you can make a time delay with
a mono stable (74121) in each machine.

Question: How does the machine know to give only one credit per coin as it
is now? Maybe you can break into the circuit of the machine.

Quentin

1998\09\04@023905 by Dennis Plunkett

flavicon
face
4/9/'98


This is all quite interesting and I have been watching the messages that
have pop up. So far they all have been looking into the debouncing issues,
and sticking many PICS into your machines. But this is only scratching the
surface of the problem.

So you want to count coins, but I must ask why? Modern machines count the
number and type of coins, some are even able to make phone calls to indicate
when they are full or being tampered with.

Anyway, a coin contact closure may be a simple micro switch, the time
between coins is long (On some machines not all, it depends on if they take
multiple denominations or not, see latter for more information), a simple CR
network will surfice. There are also some safety issues that need to be
resolved with connecting the internals to the outside world i.e. The cable
that the PIC will communicate over.

As for any debouncing (Timer C/R network etc). Yes you can, but the coin
detect network MUST check for a return to no coin state, as you will find
there are many devious people out there that will use all sorts of things to
see if they can "Beat the system" by this I also indicate that you must be
connected to a good quality coin detector, one that only allows one way
coinage, measures the form factor and weight of the coin. You will also need
to ensure that your electronics is not effected by ESD, and is basically
fail safe in operation.

Not all coin detectors are fitted with a micro switch either, such devices
are not used often ,as many coin mechanisms are multiple denomination types
with many smarts involved detect foul play, and are software driven for
acceptance / rejection.

This is only a very basic introduction into coin detection, many other
issues exist, that must be addressed before you even attempt to count coins.


Dennis

1998\09\04@085616 by John Kirk

flavicon
face
Hi!   There are probably better debounce routines out there, but here's the
one I used for debouncing push buttons:

1. When  button is pushed call debounce routine and record which button
pushed.  Lock out interrupts.
2.  Wait some time period.  I think I used 20 msec for my push buttons based
on what my oscilliscope showed.  You need to figure out the minimum period
of bouncing and use a period that is at least 10% to 50% larger.
3. Check to see if the input has gone away; in other words button released
or coin gone.  If not then jump back to step 2 and repeat.   If it has then
proceed to step 4.
4.  Then restore interrupts and set up for next coin.  Return from debounce
routine.

The routine removes multiple bounces by demanding both a contact closed,
followed by a time period, and then a contact open.  I used this on a four
button key pad and had no difficulty punching in numbers as quickly as I
could hit the buttons.  Good luck: John Kirk

> {Original Message removed}

1998\09\04@091240 by Harrison Cooper

flavicon
face
               If it is only one coin, and the machine rejects all
other coins of the wrong size (in the states, like putting a penny into
a quarter slot, or anything other than what is desired), use an optical
sensor.  This way, there is no debounce.  If you must determine the TYPE
of coin, then it gets harder.

               I agree, use one PIC per machine.  Maybe just one of the
8 pin devices, a Maxim chip for RS232.

1998\09\04@114041 by Reginald Neale

flavicon
face
>
>                I agree, use one PIC per machine.  Maybe just one of the
>8 pin devices, a Maxim chip for RS232.

 Or if you're stuck with one PIC at a central location servicing several
 coin detectors, there are hardware debouncers. I know it's a retro
 solution, but Moto makes a MC14490 which is a hex debouncer, with the
 timing controlled by a single external cap.

Reg Neale

1998\09\16@142157 by Ken Adamson

flavicon
face
Couldn't you use a "dead-man" switch - one that is closed normally, and you
open it to "press" it?  There should be no bounce on the opening of the
switch, and you could easily detect resistance jump/voltage drop as your
switch "on" position.

I don't know if you could program an interrupt routine to only handle what
are essentially "off" states on the pins, but I guess you could set up a
polling loop to do the same thing.

I'm nuts, I know, but I like being unorthodox :)

Ken

-----Original Message-----
From: John Kirk <.....JKirkKILLspamspam@spam@MASCO-RD.COM>
To: PICLISTspamKILLspamMITVMA.MIT.EDU <.....PICLISTKILLspamspam.....MITVMA.MIT.EDU>
Date: Friday, September 04, 1998 08:00
Subject: Re: Coin count!


Hi!   There are probably better debounce routines out there, but here's the
one I used for debouncing push buttons:

1998\09\17@064803 by Martin McCormick

flavicon
face
Electro mechanical switches bounce on break as well as make so that a
deadman type switch won't cure the problem.

1998\09\19@220607 by g. Jorge Raul Casalini+

flavicon
face
Hello Piclisters!

Thanks to all for respond, i make a polling routine to test the switch when it is pressing and then wait about 30 ms before test it again to minimize the bounce noise.
The switch has got two position, normally Closed (N.C.) and normally Open(N.O.) but all the video games use N.O. switch and sense when it is closed because (i discover it!) the vibration of the machine make that the closed (N.C.) switch will open for a few moment ( unbelieve! ) and will Pic Count extra coins, so i use the NO position, but now i have an electrical problem with common ground for all Machines...

it is the switch:
-----------------
[               ]= NC
[               ]               
[               ]= NO
-----------------
        = common(GND)


So i conect common pin to groung of PIC and to ground of machine.

Best Regards,



________________________
(Ing.Jorge Raul Casalini+)
(   2729, Necochea St.   )
(     2000 Rosario       )
(       Argentina        )
(    T.E: 041-821409     )
(c-2532@fceia.unr.edu.ar )
(    jbochi@usa.net      )
(  FidoNet 4:904/24.32   )
========================

1998\09\20@000606 by paulb

flavicon
face
Ing. Jorge Raul Casalini+ wrote:

> The switch has got two position, normally Closed (N.C.) and normally
> Open(N.O.) but all the video games use N.O. switch and sense when it
> is closed because (i discover it!) the vibration of the machine make
> that the closed (N.C.) switch will open for a few moment

 Where you have both NO and NC contacts available, the preferred
debounce technique is to implement a R-S latch (which is just as easy
using two PIC inputs) so that a "make" is detected when the NO closes
for a certain minimum period, and a "break" (coin has passed) detected
only when the NC closes for the same period.

 If you have *both* contacts available therefore, (and the common
grounded) *use* both.  Don't forget a 1k (or less) resistor to bias the
contacts to 5V and a 33k in series from this to the PIC input with a
small interference suppression capacitor (47nF?) to ground at that
point, on *each* of the *two* inputs.
--
 Cheers,
       Paul B.

1998\09\20@015344 by Dwayne Reid

flavicon
face
>  Where you have both NO and NC contacts available, the preferred
>debounce technique is to implement a R-S latch (which is just as easy
>using two PIC inputs) so that a "make" is detected when the NO closes
>for a certain minimum period, and a "break" (coin has passed) detected
>only when the NC closes for the same period.
>
>  If you have *both* contacts available therefore, (and the common
>grounded) *use* both.  Don't forget a 1k (or less) resistor to bias the
>contacts to 5V and a 33k in series from this to the PIC input with a
>small interference suppression capacitor (47nF?) to ground at that
>point, on *each* of the *two* inputs.

If you have *BOTH* contacts available, there is a simpler solution - use a
single capacitor!  Wire 1 contact to VCC, wire the other to GND.  Connect a
small capacitor from the armature (the 'swing' contact) to GND (or VCC - it
doesn't matter!) and through a 10K resistor (for ESD protection) to the PIC
input.  Note: the input MUST be Hi-Z - no pullups or pulldowns.  Contact
bounce just dissapears - the 1st connection to either contact charges or
discharges the capacitor which then holds that charge while the contact is
settling down.  This works because the armature is bouncing only on 1
contact at any instant in time - not both.  You don't need a schmitt trigger
inpur because the change from 1 to 0 or vice versa occurs quickly and the
PIC input does not spend any appreciable time in the linear region.

Putting a resistor in series with the armature of the switch and increasing
the capacitor size will also allow mechanical debounce (where you don't want
to recognize switch operations that are too short) but the PIC input really
should be a schmitt trigger input (RA4).

dwayne


Dwayne Reid   <EraseMEdwaynerspam_OUTspamTakeThisOuTplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(403) 489-3199 voice     (403) 487-6397 fax

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...