Pinball machine - switch closure timing problem

On Fri, 25 Mar 2005 21:13:26 -0800, frenchy wrote:

.05 nonpolarized cap worked a little better than nothing, .1 a little
better than that but still some hits still not registering. Since one
pinball company once used 22 uf polarized and 100 ohm across some
non-matrixed switches, I decided to try a much smaller cap 4.7
polarized by itself and seemed 100% and no problems, then added a
bigger resistor as a safety factor as per current, and to stretch the
charge out, and still is registering 100%.
As I said: Empirical Design. :)

A little better guesswork
than grabbing two parts with my eyes closed but alas, precise it was
not. I could probably keep experimenting with lower cap and bigger
resistor till it starts to fail again. If anybody thinks my combo here
could cause damage in a 5 volt system lemme know please, the 22uf setup
was a 12 volt switch matrix....Frenchy
Nah. You've not only done your homework, but you've reported it! This
is WAY more than most do!

I might be a wacko, and annoying, and politically incorrect, but when
something works, it works, so what else is there?

Do you put on both of your socks before you put on your shoes, or do
you put on one sock, one shoe, then the other sock and the other shoe?

Cheers!
Rich
 
Rich Grise wrote:
Nah. You've not only done your homework, but you've reported it! This
is WAY more than most do!

I might be a wacko, and annoying, and politically incorrect, but when
something works, it works, so what else is there?

Do you put on both of your socks before you put on your shoes, or do
you put on one sock, one shoe, then the other sock and the other shoe?

Cheers!
Rich

I have no choice. I have to wear surgical support hose all the time
because of swelling in my legs so its both, then pants, and finally
shoes, if they'll go on my feet that day.

--
?

Michael A. Terrell
Central Florida
 
On Sat, 26 Mar 2005 21:37:32 +0000, Rich Grise wrote:

On Fri, 25 Mar 2005 21:13:26 -0800, frenchy wrote:

.05 nonpolarized cap worked a little better than nothing, .1 a little
better than that but still some hits still not registering. Since one
pinball company once used 22 uf polarized and 100 ohm across some
non-matrixed switches, I decided to try a much smaller cap 4.7
polarized by itself and seemed 100% and no problems, then added a
bigger resistor as a safety factor as per current, and to stretch the
charge out, and still is registering 100%.

As I said: Empirical Design. :)

A little better guesswork
than grabbing two parts with my eyes closed but alas, precise it was
not. I could probably keep experimenting with lower cap and bigger
resistor till it starts to fail again. If anybody thinks my combo here
could cause damage in a 5 volt system lemme know please, the 22uf setup
was a 12 volt switch matrix....Frenchy

Nah. You've not only done your homework, but you've reported it! This
is WAY more than most do!

I might be a wacko, and annoying, and politically incorrect, but when
something works, it works, so what else is there?

Do you put on both of your socks before you put on your shoes, or do
you put on one sock, one shoe, then the other sock and the other shoe?
Good grief! The socks get put on in the bedroom, while dressing. Shoes
stay in the forier (or mud room) and never get close to the bedroom. What
kind of a barn did you grow up in?

--
Keith
 
James Beck wrote:
In article <gem0e.12297$1S4.1274812@news.xtra.co.nz>, my_name@ieee.org
says...

frenchy wrote:

Ok I will keep this in mind, there is nothing that will piss a pinball
player off more than something that is supposed to score when you hit
it, and it doesn't. Bugs in the software can be tolerated to a point,
but when it comes down to a target acting like you never even hit it in
the first place, that's another story. (Electromechanical games did
this routinely since they could only do one thing at a time but that
was expected by players...not so with electronic games.) Right now I
have a 4.7 uf cap and a 150 ohm in series across the switch and seems
to be working flawlessly (so far anyway). If this ends up not being
foolproof I may get back to you on how complicated this opto thing
would be. thanks!....Frenchy


Hi Frenchy,

I think you are on the right track. Its been 15 years since I had to
repair a pinball.....

The switch matrix gets scanned frequently - guess every 64ms (numbers to
make maths easy). If there are 64 switches, then each switch gets
scanned every 1ms. Just like ADC sampling, the worst-case is a switch
gets hit the instant after the micro looks at it. If such a switch
closure lasts less than the entire scan duration (ie how long it takes
to have another look) it will be missed.

Conversely if a switch closure lasts longer than the scan duration it
will be read twice - if it is an intermittent contact, this may register
as two hits, perhaps this is what is meant by "ghosted" - hard to say
really, without knowing exactly what the software does.

If you place a cap across the switch, then switch closure will discharge
it with a time constant (Rswitch + Rseries + ESR)*Ccap. The peak current
flowing through the switch is Vopen/(Rswitch + Rseries + ESR). Rswitch
ought to be extremely low, but increases as the switch craps out. ESR
may be low, depending on cap type, but it may also be many tens of Ohms.

The switch then opens, and the cap starts to charge up through the
matrix pullup transistors/resistors. These are usually current limited
in some way, giving a not-too-high charging current to the cap.

You want a nice, fast discharge and a slow charge. For fastest
discharge, set Rseries = 0. Beware the peak current through the switch
though, especially for large C. Many electrolytics have high enough ESR
that this alone will protect the switch. Note that smps electrolytics
are (or bloody well ought to be :) selected for extremely low ESR....

To ensure a slow charge, put a series R between the switch/cap assembly
and the matrix, thusly:


The only thing you guys are forgetting is that with a matrixed switch
the strobe or ground isn't always there. If the switch gets closed when
the strobe is providing ground for another column of switches the
capacitor is going to do squat. The cap MAY stretch a closure because
of the speed of the strobing, but it is not going to act like a switch
on a "normal" switch.

Jim
?!

If the [cap + Rdischarge] is across the switch, and the switch gets
closed, the cap discharges thru Rdischarge. Next time the matrix gets
around to the switch-in-parallel-with-RC the cap will begin to charge
up, and the micro will read the switch as closed (even though its not).
In practice you dont really need the charge resistor, re-drawn circuit
becomes:


|
----------|-------+-- [Row = switch to V+]
| |
| |
| |
| o--[+Cap]--+
| / |
| [switch] |
| / |
+---o----[Rdis]----+
|
|
[Column = switch to 0V]


Cheers
Terry
 
frenchy wrote:
.05 nonpolarized cap worked a little better than nothing, .1 a little
better than that but still some hits still not registering. Since one
pinball company once used 22 uf polarized and 100 ohm across some
non-matrixed switches, I decided to try a much smaller cap 4.7
polarized by itself and seemed 100% and no problems, then added a
bigger resistor as a safety factor as per current, and to stretch the
charge out, and still is registering 100%. A little better guesswork
than grabbing two parts with my eyes closed but alas, precise it was
not. I could probably keep experimenting with lower cap and bigger
resistor till it starts to fail again. If anybody thinks my combo here
could cause damage in a 5 volt system lemme know please, the 22uf setup
was a 12 volt switch matrix....Frenchy
your empirical work is excellent. The highest voltage your cap can
charge to is the supply voltage - 12V. The peak current flowing through
the switch when it closes is the sum of the matrix current and the
current coming from the cap as it discharges through Rdischarge. The
discharge current is simply

Idis_max = Vcap_max = 12V = 80mA peak
---------- --------
Rdischarge 150 Ohms

The actual discharge current will be a decaying exponential spike:

Idis(t) = Idis_max*exp(-t/(Rdis*C))

See how the cap value doesnt affect the peak - only the series resistor
does.

the area of this exponential decay curve (ie its integral) is exactly
the same as the area of a rectangular pulse of the same (peak)
amplitude, and width Tau_dis = Rdis*C (seconds).

Tau_dis = 4.7uF*150R = 705us

charge Q = C*V = I*t = 80mA*705us = 56.4uC

double check: C*V = Q = 56.4uC so 56.4uC/12V = 4.7uF. as it should.

Energy in cap E = 0.5*Q*V = 0.5*C*V^2 = 0.5*56.4uC*12V = 338.4uJ

But see that the cap *does* control the charge and hence energy, which
does not depend on the resistor.

It takes 3 time constants to discharge to 5% of applied voltage.

3*Tau_dis = 2.115ms, nice and short

if we knew the pullup resistance we could look at the charge time
constant. Guess 4.7k:

Tau_chg = (4.7k + 150R)*4.7uF = 4.85k*4.7uF = 22.795ms

3*Tau_chg = 68ms

If you want to know the power dissipated in the discharge resistor, it
depends on the frequency the switch is toggled at, in Hertz. In the case
of a videogame, human reaction times are around 200ms/400ms for olympic
athletes & normal people respectively, so 100ms is a pretty fast switch
closure time. If we assume a period of 100ms (ie on + off) then

fswitch = 1/0.1s = 10Hz (ie ten switch closures per second)

and

Pdischarge = E*fswitch = 338.4uJ*10Hz = 3.4mW ie bugger all.

In a real machine, the average frequency would be tiny, and the power
dissipation would likewise be negligible.


the power dissipated in the charge circuitry is given by

Pcharge = E*fswitch = 338.4uJ*10Hz = 3.4mW

and this power is shared between Rdischarge and the charge circuitry
resistance, which is usually a lot higher then Rdischarge and so
dissipates the bulk of the power.

I think the numbers stack up pretty well for 4.7uF and 150R. In a 5V
system the numbers are:

Idis_max = 5V/150R = 33.33mA

Tau_dis = 150R*4.7uF = 705us

Tau_chg = 4.85k*4.7uF = 22.795ms

Q = 5V*4.7uF = 23.5uC

E = 0.5*23.5uC*5V = 58.75uJ

Pdis = 58.75uJ*10Hz = 0.5875mW

Pchg = 58.75uJ*10Hz = 0.5875mW


So the time constants stayed the same, but the power dissipation dropped
- not that it mattered in the first place. assuming Rchg = 4k7 of course...

Cheers
Terry
 
frenchy wrote:
Hmmm about 99.7% of that is over my head but.... am I to understand
then that basically, the size of the cap NOT that important as to
potential damage or over-current to say, a transistor that the charge
would eventually be going to when the cap discharges, and that it's the
RESISTOR that is the key in limiting this potential damage, regardless
of the cap size? I am also deducing this from what another dude said
about sometimes using caps up to 100 uf in this kind of application in
pins and videogame switches and buttons. Thanks for going into all
this detail (even if I will never understand it!).....Frenchy
exactly correct.

when a cap is fully discharged, it "looks" like a short-circuit. So at
the instant you apply (dc) voltage to an R-C series circuit (cap
discharged) then it "looks" like the R alone.

Ohms law applied to series RC circuit:

At any instant in time, (Vin - Vcap) = I*R

at time t=0, Vcap = 0 so I = (Vin-0)/R = Vin/R = Imax

this I charges up the cap a little bit, so at some other time t>0, Vcap
0 so (Vin-Vcap) < Vin therefore I < Imax.
Ultimately the cap charges up to Vin, at which point the current into
the RC circuit becomes (Vin-Vin)/R = 0 amps.


Likewise a fully charged cap "looks" like a constant voltage source (if
we look over a small enough slice of time). If we take our fully charged
RC circuit, and switch the R to 0V with a npn transistor, then at the
instant the transistor turns on, the cap looks like a voltage source of
V volts, and the current thru the resistor (and hence switch) is
(Vcap-Vswitch)/R and if the switch is any good, Vswitch is very small
(hey, 300mV out of 12V is bugger all) and can be ignored.


if you are really keen, you can turn this hand-wavey argument into a
derivation of the cap charge & discharge equations. Or just remember
them....


All caps have some internal resistance (often called ESR, Equivalent
Series Resistance). This is what makes caps get hot when you bang
current through them. In the case of a smps cap, the ripple current is
quite high and so ESR is designed to be very low - 20mOhms is not
unusual. If we get say a 1000uF cap with ESR=0.02 Ohms, charge it to 12V
then discharge it with a screwdriver, the peak current will be
12V/0.02Ohms = 600A. A large spark will result, and quite possibly will
blow a bit off the side of the screwdriver. If you short this cap with a
switch, expect the switch contacts to wear out very quickly (hell, they
might even weld straight away).

OTOH if we get a crappy DSE 1000uF 16V cap, the ESR is more like 1-2
Ohms, so the peak current will be 6-12A, a *huge* difference.

If we bung say 10R in series with the good cap, it reduces the current
from 600A to 1.2A. If we stuck the 10R in series with the shitty cap, it
reduces the peak current from 6-12A down to 1-1.1A.


The second part of the damage issue relates to how much energy is stored
in the cap, which is directly proportional to the cap size.

E = 0.5*C*V^2

A cap with a large series R lets this energy out slowly, a cap with a
small series R lets it out very quickly. A 100nF cap at 12V has 7.2uJ of
energy, a 1000uF cap at 12V has 72mJ, ie 10,000 times more energy.

While the 100nF cap has a very low ESR (so peak discharge current is
very high) there is not much energy, so it cant heat up the switch
contacts (or transistor) very much. This is why you often see 100nF caps
placed directly across switches etc.

I just recently designed a circuit with a motion sensor that is a little
ball-bearing sitting in a concave seat, making contact between a couple
of points. Move it and the switch opens & closes. *BUT* the switch has
an absolute maximum current rating of 25mA - this is to prevent welding
the ball bearing onto the contacts. In my case, I slapped a 510R
resistor in series with it, then a 100nF cap across the whole lot, with
a 1Meg pullup to +3.3V. max cap discharge current is thus 3.3V/510R =
6.5mA. The contact resistance is 5R, so without the series resistor the
switch current would have been 3.3V/5R = 660mA, about 26 times greater
than its rated value.


Another example of cap charging is the "thunk" a big audio amp makes at
turn on - it has a transformer/rectifier/cap filter, with a *LOT* of
capacitance - >= 10mF is not uncommon. When you first turn it on, the
cap behaves like a short-circuit, and a *very* large current is drawn
from the supply to charge it - the current is limited basically by the
transformer resistance. Good amp's have a delayed turn-on circuit and a
large series R (say 100R 10W) that gets shunted by a relay after the cap
has charged up - often called a "soft-charge" circuit.

Back when I was a videogame tech (great background for an engineer) I
used to repair a *lot* of cheap korean smps. One of the most common
failures was a blown-up input rectifier, and its the bus cap charge
current that destroys the rectifier. A lot of these smps had 1 Ohm 5W
series resistors in the AC line, supposedly to soft-charge the bus cap.

Does it help? not really.....at 230Vac input, Vpeak = 230*sqrt(2) =
325Vpeak. If you *happen* to turn the switch on at the peak of ac line
voltage, then the peak current flowing into the power supply is (325V -
1.4V)/1R = 324A peak (assuming a bridge rectifier). If the Ifsm rating
(single shot current thump) of the diode is < 325A, it will go *bang* -
if not sooner then later. Simply replacing the rectifier bridges with
gruntier ones (having Ifsm > 400A) completely solved the problem.

Cheers
Terry
 
Uhm... Have you cleaned the contacts? Pinball contacts need to be
periodically cleaned with a small file intended for the purpose. Its been a
decade or two since I repaired pinball machines for a living, but surface
wax cleaner and a point cleaning file and tension adjuster were my stock in
trade.

Dana

"frenchy" <mf101723@msn.com> wrote in message
news:1111454517.017086.226600@l41g2000cwc.googlegroups.com...
I'm posting this to a few electronics newsgroups poking around for a
possible answer...

For years the pinball companies used a small .047 uf capacitor across
some switch terminals for switches that could be closed and reopened
very quickly like a target getting slammed particularly hard. The
capacitor would increase the 'closure time' that the CPU would read the
switch as closed, long enough to help it pick up the switch closure.
These switches are just simple two blades and contacts, with one wire
to the cpu, the other wire thru a diode to isolate it within the matrix
of switches in the game, and the capacitor may or may not be across the
terminals also.


I'm having a problem with a particular swtich that the cap fix is
working, but not completely. Some hardhits will still not register.
Tried putting bigger cap on it with improved results but I've read that
too big of a cap can cause 'ghosting' where it might start causing
false closure reading on other switches in the matrix. So my question
is....


Is there a simple formula where one could increase the size of the .047
cap or .1 cap or whatever is being used, but put in in series with a
resistor, to lengthen the time that it is doing it's thing of
lengthening of the closure to the cpu? I.e if I wanted to use a cap
10x bigger, what resistor could I put in series with it to be sort of
like the smaller cap without the resistor, but length of discharge
would be stretched out? Or is this possible? Maybe a diferent more
complicated approach is necessary to get this one switch to be sensed
as 'closed' longer. I am pretty good at fixing pinballs, but
electronics theory is not my calling. thanks for any assistance
anybody can give me. Thanks!
 
frenchy wrote:
I was told by somebody in the pinball newsgroup that an engineer
indicated to them that a 4.7 cap sounded somewhat high for the
particular circuit, I have changed it to a 1.0 with the same resistor
and still seems to be working perfectly (crossing fingers). The
engineer didn't really want to suggest any values, just that 4.7
sounded high. Oh well.
Ok so I think I get it now, the cap being charged causes the matrix
read to still 'see' a closed switch even thought the actual switch is
now open. Thanks....Frenchy
Hi Frenchy,

Its been about 15 years since I last worked on videogames (since I
graduated and got work as a power supply design engineer), but I
regularly saw (and used) 4.7uF caps on switch inputs for videogames
(including pinballs). I fiddled with values as high as 100uF (too big,
they start missing short switch *releases* for large cap values, rather
than missing closures for small cap values) and as low as 100nF. IME
1uF-10uF was fine, whatever was available.

Yep, you've got it exactly right. The cap charge time is long compared
to its discharge time, and regardless of what circuitry is reading the
switch, it is comparing the switch voltage to a threshold. As long as
the cap voltage is below the threshold, the "switch" reads as closed.

Cheers
Terry
 
On Sun, 27 Mar 2005 00:01:06 +0000, Michael A. Terrell wrote:

Rich Grise wrote:

Nah. You've not only done your homework, but you've reported it! This
is WAY more than most do!

I might be a wacko, and annoying, and politically incorrect, but when
something works, it works, so what else is there?

Do you put on both of your socks before you put on your shoes, or do
you put on one sock, one shoe, then the other sock and the other shoe?

I have no choice. I have to wear surgical support hose all the time
because of swelling in my legs so its both, then pants, and finally
shoes, if they'll go on my feet that day.
Sorry to hear about your condition. I hope you have ample opportunities
to put them up, and relieve the pressure.

Get Better! :)
Rich
 
Rich Grise wrote:
Sorry to hear about your condition. I hope you have ample opportunities
to put them up, and relieve the pressure.

Not always, but I try.

Get Better! :)
Rich
Thanks. :)

--
Former professional electron wrangler.

Michael A. Terrell
Central Florida
 

Welcome to EDABoard.com

Sponsor

Back
Top