Maker Pro
Maker Pro

Pinball machine - switch closure timing problem

K

Ken Taylor

Jan 1, 1970
0
frenchy said:
diode tested good. As I said, looks like the 4.7 cap and 150 ohm
resistor have made the switch register every hit now. But don't ask me
how I came up with the values - I guessed ? : / ? ..Frenchy

I'm sure you experimented and found quantifiable evidence that it was the
appropriate value combination.

Cheers.

Ken
 
R

Rich Grise

Jan 1, 1970
0
diode tested good. As I said, looks like the 4.7 cap and 150 ohm
resistor have made the switch register every hit now. But don't ask me
how I came up with the values - I guessed ? : / ? ..Frenchy

That is called "Empirical Design". Don't be ashamed of it - that's the
way most people do it, and the rest lie about it, kinda like wanking. ;-)

Cheers!
Rich
 
R

Rich Grise

Jan 1, 1970
0
I'm sure you experimented and found quantifiable evidence that it was the
appropriate value combination.

I think he slapped it in and played the game, and tested different
values until the game worked. To me, 4.7 sounds a little high, but hey,
whatever works!

Cheers!
Rich
 
F

frenchy

Jan 1, 1970
0
..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
 
R

Rich Grise

Jan 1, 1970
0
.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
 
M

Michael A. Terrell

Jan 1, 1970
0
Rich said:
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.
 
K

keith

Jan 1, 1970
0
As I said: Empirical Design. :)


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?
 
T

Terry Given

Jan 1, 1970
0
James said:
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
 
F

frenchy

Jan 1, 1970
0
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
 
R

Rich Grise

Jan 1, 1970
0
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
 
T

Terry Given

Jan 1, 1970
0
frenchy said:
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
 
T

Terry Given

Jan 1, 1970
0
frenchy said:
.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
 
F

frenchy

Jan 1, 1970
0
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
 
T

Terry Given

Jan 1, 1970
0
frenchy said:
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
 
Top