Pinball Machine Bumper Design

Hi Bob,

Thanks for the advice. Yes I am pretty sure you are right. Sending 5V through the resistor to the transistor when the switch is closed by the ball.

The solenoid would only need to pull down for about 0.2 of a second longer than it currently is. The ball would move away pretty quickly.

If I were to try a capacitor, where would it go in the circuit? Across the solenoid? Can I damage the circuit if I put it in the wrong way? What value / type of capacitor would be the most likely suspect?

Thanks,
Mark

Hi Mark

A capacitor will not do this. It can work to do things like delay the release of a relay or solenoid but is usually got to be quite large due to the relatively low coil resistance in these devices. For this to work a cap has to be charged fully then will discharge slowly through the coil until the device releases. In your case a capacitor of any size will not have time to charge.

I have an idea that might work which I will post later today as I just don’t have time right now.
I don’t suppose you know just how long the ON pulse you get from the ball contact do you ??? It would be pretty useful. My idea depends on it being long enough to turn on a Mosfet. Mosfets have a sneaky little property that we might be able to use here.

Talk soon. Cheers Bob

1 Like

Hi Bob,

Thanks for your reply. I can see where your head is at and from your description of how a capacitor works, it may work if I can get the ball to stay in contact for longer before the solenoid fires.

I may be able to change the design of the bumper so that the bumper ‘catches’ the ball and makes it stay there for longer, charging the capacitor and lengthening the time the solenoid is pulled down for. From it’s behaviour in testing, I think I just need another 1/10th of a second or something like that to ensure the solenoid pulls all the way. There can’t possibly be much more time needed than that.

At the moment, I have no real way of determining the time that the ball is in contact with the bumper but it fires upon contact and so it would be very fast. I would think the ball is only there for 1/10th of a second.

Keen to try any solutions you can think of :slight_smile:

Thanks,

Mark

Hi Mark
In electronics 1/10th of a second is a very long time, 100milliseconds (mSec). To put it into perspective 240V mains frequency is 50Hz, that is a period of 20mSec and is considered to be veeerrrrrrryyy slow.

Cheers Bob

Hi Mark
More info pls.

Is this 5V or 12V. A more complete circuit would be good.
Also need to know the value of R7 and the DC resistance of the solenoid coil.

Where did this transistor come from, likewise the 15KEXX. The transistor is a 50Mhz power amplifier and the 15KE is a transient voltage suppressor (sort of a zener diode), the XX part I think is the breakdown voltage. Neither device really designed for this job.
Did you build this bit up or purchase a module. If you built it this could do with some changes. Like replace the transistor with a Mosfet and the 15KE thing with a schottky diode. Would make extending the ON time a bit easier and less messy too.
Cheers Bob
Edit.
Also need to know the current capability of the 5V supply if the ball actually switches 5V

Hi Bob,

The solenoids are 12V. I have a voltage regulator bringing it down to 5V to supply a bit smoother power to power the arduino.

R7 is 1K. Don’t know the resistance of the solenoid. The transistor is a Tip 120. Nevemind the labels on the diagram. I just used whatever looked right in the Fusion 360 library. The diode is not a schottly diode but all of these things can be switched out. I got 10 boards made on PCB way. We have made one prototype where everything works, except this problem of the solenoid not staying on for long enough and that’s where we’re at.

It may be very simplistic of me but the timer James suggested if it works on being ‘grounded’, isn’t that what is happening with the transistor? Could we tap into that somehow?

The supply we are using is a 12V 1 amp but in relation to the switches, that power runs through the voltage regulator which is the standard LM7805.

I have done my best to get a good schematic diagram of the system. It has 4 bumpers, 2 lights, LCD screen and an MP3 module all running through an Arduino Mega. I understand that it is not technically correct and has lots of flaws but as long as it works while the markers are marking it, I don’t really care.

Ta
Mark

Hi Mark.
I am not going to conduct a course on 555 timers.

That is exactly what it says. A momentary ground gas to be applied to the trigger input (pin2) to start the timing sequence.

Sort of, there is a fair voltage drop between emitter and collector of that transistor. This drop in a Mosfet is only millivolts which makes them more suitable for that application.

Don’t quite see how and the output current of a 555 is somewhat limited.

I am going to suggest changing that transistor for a Mosfet. I am sure it is a drop in fit and device elements coincide, G = Base, S = Emitter and D = Collector. The value of R7 might change as we have to have time to charge a capacitor. The R and C to be added. The idea is to delay the gate discharge and give the solenoid more operating time.
image

This is going to be a bit trial and error. Give me a bit and I will come up with some values for R7 and R and R and C. R might be pretty large as we have to charge quick and discharge slowly. As you seem to have another transistor hanging off the same connection (which is quite important and you failed to show earlier) we will probably have to use a diode to prevent discharge of C down that path.

Give me a bit of time and I will see if I can come up with some values to try.

You also say the diode across the solenoid is not as shown. Well what the hell is it. It should be a schottky. Please get out of this habit of presenting a circuit which is not accurate IN ALL RESPECTS this includes devices and values. for instance the terminal blocs are marked 3A/250V. This had me confused a bit as I related this to the solenoid. I now realise it is just the rating of the terminal block itself and has nothing to do with the matter in hand.
I think presenting documents like this is not going to get too many marks from the examiners. Could even get you a fail.
Cheers Bob

Hi Bob,

The parts used are almost all correct. Fusion 360 has libraries of components and when I couldn’t find the correct component, I just substituted one that had the correct hole pattern so the PCBs could be made. This is what leads to the circuit being ‘incorrect’, that and the fact that I don’t actually know what I am doing. I understand this could be misleading but to a novice, this is very complicated and daunting.

I couldn’t get the schottky diodes from our supplier so they gave me an IN4001. They said that they will work for our little solenoids. If I can get the schottky diodes to replace those from somewhere else then I will.

Yes the terminal blocks are just being used to connect the power to the board and the MP3 module. It is designed to be plug and play for Year 7 students.

In terms of getting marks from the examiners, I am a design and technology teacher with over 20 years experience. My students have come 1st, 3rd, 5th, 6th, 7th and 10th in the state over the years and we are generally 10-15% above state average so I am aware of what the markers are looking for. This particular project is one of the most complicated we’ve attempted so if it works and her folio tells the story well, she should get very good marks. Just need these bumpers to be more effective by pulling down for what is, as you pointed out, an eternity in electronics terms.

Thanks,
Mark

Hi Mark

A bit slow but so are solenoids so should be OK for you. I personally would use schottkys to be on the safe side but these should be ok.

The word “almost” is what I am on about. What you have done by substituting to enable a board layout is all good but when you post a circuit the part numbers and values etc can be edited and the correct ones inserted. You can call any part what you like on the printed sheet. Makes no difference to the PCB files. Even some notes on the printed page would be of some help.
Regarding teaching. I really do appreciate what you are trying to do and take my hat off to you and your fellow educators. If I were looking for a profession in today’s climate I would have to think long and hard before I selected teaching. Probably would not have the patience.
BUT, that does not help things at this end if the information provided is not accurate or there is not enough of it. If the person trying to help has to rely on too much guesswork and make many assumptions (it is a sure thing that some will be wrong) getting a meaningful result can take quite a long time with a fair share of frustration.

Getting to your problem. A Mosfet has what can be a very useful trait. There is a small capacitance between source and gate. When a voltage is applied to the gate this cap charges up. When the voltage is removed this charge remains and the input resistance of the Mosfet is so high it will not discharge this cap and the device will stay ON for a very long time. Even if powered OFF then later powered ON again the Mosfet will still be ON. This condition could be there for weeks or longer. This cap is normally discharged with a resistor of about 10k from gate to ground (normally Source).
My idea would be to use this effect in a controlled manner by fitting an external cap and discharging resistor. The idea that the Mosfet would stay conducting enough until the voltage gets down to about gate threshold level, something a bit less than 2V for a “logic level” Mosfet. For a charge of 5V this would be about 1 time constant where the charge would reduce to 36.8% of initial value in this time. This would be R and C on that little circuit. You estimate you want 0.1Sec, That equates to an R/C combination of 1MΩ and 0.1µF. Now we have to have time to charge this cap which will take 5 time constants. Charging is via R7, 1k so 5 time constants would be 0.5mSec so the ball would have to stay in contact for this time which I think would not happen. We can reduce R7 to 100Ω then the 5 time constants would be 0.05mSec which would give C that much more time to charge. The thing to remember here is that the instant of switch on when the ball makes contact this C is a short circuit to ground. R7 being 100Ω will limit this “inrush” current to 50mA which should be safe enough. A diode will be required in series with R7 and I think this SHOULD be a schottky as we don’t want to miss any of that precious plus from the ball contacts.

So my first try would be Mosfet STP36NF06L, C = 0.1µF (100nF), R = 1MΩ and for the series diode 1N5819. R7 = 100Ω. Try this, if C does not charge enough it might have to be reduced to maybe 0.01µF in which case R has to increase to 10MΩ But that is getting large enough to have other funny problems.

If this does not work things might get messy, I am trying to get as simple as possible with minimum components. That Mosfet will go straight in where the transistor is now. Connections are the same.

All you can do is try
Cheers Bob
Edit: C should = 0.1µF. Have changed text above. Bob

Hi Mark
The Mosfet / timing solution I posted above could be a bit hit and miss. The whole thing depends on being able to fully charge C. This is a bit up in he air as the duration of the pulse produced by the ball hitting the target is unknown.

The use of a 555 timer to “stretch” this pulse as James suggested would be more predictable and controllable so I have come up with an alternative circuit.
image

This has a few more bits but only depends on the button pulse being long enough to trigger the 555. This requirement should be easily met as it only requires a pulse in the order of a couple of µSec to trigger.

A bit of a down side is the requirement to have a trigger pulse to ground. This is OK as all that has to be done is connect the common of all the switches to ground instead of +5V. This circuit then simplify interfaces between the actual button and where the button would normally connect. In other words this circuit becomes what is at the moment the button output point.

The timing components can have the same value as the Mosfet circuit. The above timing components are R1 and C1. R1 = 1MΩ and C1 = 0.1µF will give you an output pulse of 0.11Sec. I suggest if you want to shorten this time you lower R1 value and if you want to increase it increase C1 value. The formulas are on the circuit and as you can see this arrangement could be a lot more predictable than the Mosfet circuit (which would be OK if we could guarantee the C charging time was long enough) and easily tailored to suit

Your suggested time of 0.1Sec seems a bit long and you may be able to shorten it a bit. Keep in mind it will take a finite time for the solenoid to operate and release and this could be several mSec. Without the data sheet and not knowing what model solenoid you have used that is unknown.

You have said the whole system works except for the too short pulse from the ball switch (button) so you should not have to change anything except for remove the switch commons from 5V and reconnect to ground. Connect the actual button to the circuit trigger point then the output becomes what would have been the button pulse but now “stretched”.

What value are the “pull down” resistors like R2, R3, R4 etc. They don’t want to be too low or low enough to worry the 555 output. I would think about 10k would be enough . The 555 can source about 150mA but it is advisable to keep it pretty well below that. The 1k base resistors will limit the base current to something like 4.5mA each and there are 2 of those and the pull down is effectively in parallel with these so the 555 output should cope OK. The Arduino input current should be negligible

Something else to think about.
Cheers Bob

Hi Bob,

Thanks for your excellent work on this!

I think this solution is more bulletproof and extending the pulse using a timer is likely to get the job done.

I do have an issue with the button wiring and the way that the system interfaces with the arduino though.

In addition to triggering the solenoids to fire, the buttons also tell the arduino that they’ve been hit and they add points to the LCD scoreboard. Wiring them to ground, to the best of my knowledge, would prevent that part of the system from working. Everything I’ve seen on button wiring for arduino seems to have 5v going to it.

It did, however, make me think of an entirely different solution.

The arduino, once triggered to add points to the scoreboard by the ball closing the switch could also then be told to output 5v at a pin for a certain period of time. If that pin was connected to where the button is sending 5v to the resistor then the transistor, I think the pulse would be extended for the delay time and that would make the solenoid pull down for as long as the delay is set.

I am going to try that out in isolation on a breadboard today. It will rely on the arduino working fast enough but it is definitely worth a test. If that doesn’t work, I will create your circuit on a breadboard and ‘insert’ it into the system. If that works, it is likely to be easiest at this point to create it on a piece of veroboard and attach it to the bumpers themselves. I am trying to avoid having to remake the PCBs but that may be inevitable.

Fortunately her project deadline is still a few months away so we have time to fix it.

Thanks for your work on this project. I and my student really appreciate it. If the arduino method doesn’t work, I’ll order the parts needed asap.

Thanks,
Mark

Arduino inputs can be wired either way. If you wire them so that they are switched to ground then you can use the internal pullups to set them high when the switch is open. If they are switched to high then you need the pull-down resistors to ground so they are held low when the switch is open. So wiring them for a ground connection is actually simpler.

I think this is by far the best solution. There are plenty of pins available on the Mega. It has the advantage that you can very easily adjust the delay to suit the relays.

Timing is unlikely to be a problem unless there is some other activity that consumes a lot of time for the Mega.

Some delay between receiving the signal and firing the solenoid is acceptable - the ball does not have to be still in contact with the bumper for it to be pushed. However too much of a delay will result in a drop in the push force that the solenoid can apply because the ball will have recoiled to a greater distance. Also, the delay should not vary too much, because the direction in which the ball is pushed is affected by its distance from the bumper at the moment of contact. Both issues can be addressed by using interrupts to handle the switch inputs. The code to fire the solenoid is short enough to include in the interrupt service routine. Other processes related to the switch, such as updating the display and sounding the bell, should be controlled by a flag that is set in the ISR and then checked later when the CPU finishes the loop. Minimising the processing at the time of interrupt ensures that the ISR does not affect other processes, such as creating a flicker in a display update that is occurring at the time.

Hi Mark

If you re read and study that 555 circuit carefully you are not taking the Arduino pins to ground. You are simply replacing the existing button 5V with the 555 output which is also 5V or whatever voltage you use on the 555 (which in your case would be 5V). You only have to take the existing button “common” connection from 5V and connect to ground. ALL of what is now connected to the button “output” will now connect to 555 output (pin 3). There should be no need to change anything except for button wiring.

If you get a PCB right first time you would be considered something of a magician.

Cheers Bob

Hi Mark
Another advantage of the 555 approach is button debounce. The trigger input will ignore any more attempts to trigger until the current timing sequence is finished, so no false multiple counts.
Cheers Bob

Hi Jeff,

Yep that approach worked a treat! The solenoid is now pulling down for as long as I tell it to. That makes the ball come away from the bumper at a decent velocity. It is responsive as well. Using interrupt pins is the only way to go.

Don’t know if the code is exactly correct but it definitely works. If anyone has any improvements, I’m all ears. May not be as effective once all components are functioning but I’ll cross that bridge when I come to it.

Thanks very much!
Mark

const byte interruptPin1 = 18;
const byte interruptPin2 = 19;
volatile byte state1 = LOW;
volatile byte state2 = LOW;
int score1 = 0;
int solPin1 = 7;
int solPin2 = 8;

void setup() {

pinMode(interruptPin1, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin1), bumper1Hit, RISING);
pinMode(interruptPin2, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin2), bumper2Hit, RISING);
Serial.begin(9600);
pinMode(solPin1, OUTPUT);
pinMode(solPin2, OUTPUT);
}

void loop() {
Serial.println(score1);

if (state1 == HIGH){
digitalWrite(solPin1, HIGH);
delay(100);
digitalWrite(solPin1, LOW);
score1 = score1 +50;
state1 = LOW;
}

if (state2 == HIGH){
digitalWrite(solPin2, HIGH);
delay(100);
digitalWrite(solPin2, LOW);
score1 = score1 + 20;
state2 = LOW;
}

}

void bumper1Hit() {
state1 = HIGH;
}

void bumper2Hit(){
state2 = HIGH;
}

Hi Bob,

Thanks for this suggestion. If I have problems with the arduino method further down the track, I will test with this method. The fact the arduino method doesn’t require more components is attractive to me. Either way, I will need to remake the PCB. Probably should have tested further on a breadboard before getting the first ones made. Space on the PCB is also at a premium so adding components isn’t ideal. As soon as I got boards larger than 100mm x 100mm, the price went up steeply so making them bigger is not really an option.

Thanks for all your help!

Cheers,
Mark

Hi Mark

Don’t feel too bad about that. I worked for quite a large company during my working life and have yet to see the time when a board was right first go. They used to go close but when the customer only allows 3 modifications and nil components on the back of the board (all through hole those days) remakes were fairly common. The idea was to get this to one re-do as sometimes the boards could have many layers. When in the development stage some of them looked a bit like a dog’s breakfast with little links everywhere.

Good luck with whichever approach you finally go with. When you get all the bumpers working at once the Arduino might struggle a bit with time but maybe not.

Tip. If you are having an issue with time the Arduino (UNO R3 anyway) has a delay of several µSec at every digitalWrite command while it does some housekeeping (so I read). You can try a command digitalWriteFast to recover most of this time. This apparently bypasses the housekeeping and at the end of the day can be quite a bit faster. All this was the result of some experiments with an Arduino UNO R3 and might be different on a Mega. this could help that little bit that could be the difference.
Cheers Bob

Add on. Just had a quick look at your sketch. If you are switching the Arduino pins to high when a ball strikes (as in your circuit) are you sure you should be setting the interrupt pins high with the PULLUP statement. Doing this will set them high and they will expect a low active surely. You already have physical pull down resistors (R2, R3, R4 etc) on these pins or have you changed things since you published that.

Hi Bob,

Thanks for those suggestions.

Never heard of digitalWriteFast before. I’ll give that a go. I’ll get rid of the pullup statement as well. As you pointed out, that’s only needed when you don’t use the resistor in the button wiring setup. I haven’t changed the design since publishing that schematic so the pullup statement is definitely an error.

Thanks again,
Mark

Hi Mark.
You won’t find it easily either.
About 6 months ago I was investigating a significant pulse generation error. The pulses and spaces between were about 4 µSec longer than requested. This produced an error of some 40% in my case. This occurs due to some housekeeping to make sure the pin is not being used for something else etc. There are a couple of ways around this and one of them is the digitalWriteFast command which is found when you dig deep enough.

I started a rather long post re this last December here if you are interested. Complete with oscilloscope screen shots and measurements.
Dec 2022

Dec 2022


Cheers Bob
Well that did not work. If you are interested and want to find it search for

Arduino UNO R3 some limitations

That seemed to work better so try clicking on that link