(Topic ID: 175109)

Close Encounters (Arduino Conversion)

By legtod2

5 years ago


Topic Heartbeat

Topic Stats

  • 132 posts
  • 21 Pinsiders participating
  • Latest reply 76 days ago by legtod2
  • Topic is favorited by 31 Pinsiders

You

Linked Games

Topic Gallery

View topic image gallery

image (resized).jpg
48385500_2291332590910935_6779409008320053248_n (resized).jpg
20170712_234417 (resized).jpg
20170712_234508 (resized).jpg
11146100_943613355695764_657397842255861824_o (resized).jpg
IMG_0151 (resized).JPG
20161217_165301 (resized).jpg
20161217_155632 (resized).jpg
20161217_155617 (resized).jpg

There are 132 posts in this topic. You are on page 1 of 3.
#1 5 years ago

After completing the Williams Phoenix (Arduino Conversion) project I have moved onto my next project a Gottlieb System 1 Close Encounters Solid State machine.

This machine arrived with just the cab, playfield, and backbox.
The back box had no displays, mpu, driver board, power board.
The secondard transformer was melted sludge.
Of course it also looked like it had been sitting for a couple of decades with a seized rotor spinner and equal proportion of crime and dirt on playfield.

A perfect candidate for my Arduino conversion project !

Plan for this machine is as follows:
Clean up playfield
Utilize a arduino mega to read switch matrix, control playfield lamps, control solenoid driver board.
Utilize a raspberry pi 3 to control TV backglass display replacement (no pin score devices or lamps behind a glass here)

experiment with using traditional 3 chimes solenoid for sound or pi generated/ controlled sounds (maybe both)

Yes this machine will be out of this world. A hybrid of old and new parts.

Pictures and youtube vids will follow.

#2 5 years ago

I own a encoutters and am very curious on what your up to ?

#3 5 years ago

Is there a reason you're integrating the arduino vs having the pi run everything thru the gpio?

#4 5 years ago

Using mega because of its multiple io ports. Its talking to my driver board too.

During proto typing its less expensive to fry an arduino board then a pi,
Haven't done that but I am aware it could happen.

Also I started using the pi 2 then upgraded to pi 3 (just because of speed for python frontend graphics for backglass).

#5 5 years ago

One other great thing about this design is I can swap in many different backglass and special effects that I want.
The pi receives the score display and backglass light switches and I can direct them to my custom displays.
Do I want chimes or use customs sounds, 3 ball or 5 ball, custom high score, add shaker motor, custom under table lights, topper displays, cree lights, etc.

A great hybrid system that I control.

#6 5 years ago

Todays battle with the machine consisted mapping matrix switch
Issues with strobe ds1 and ds3, switches 8 and 24, 9 and 26, 10 and 27 which may be a diode or ground issue.
Left flipper not working at all. Problem looks like and end of stroke switch is the cause.
Changed the coil with new one but problem still there. Got 26 volts to the coil.
Found one of the screws holding eos switch in place was gounding switch. Removed the screw and flipper working fine.

Played first game on machine with my crude rules and temp scoring display in place.
No play field lighting logic in place yet.
My solenoid drive is built and will wire into my rules and scoring this weekend.

Playfield has slight indents where plastic score covers are. Going to research level of effort to correct them so they are flush again.

#7 5 years ago

Phew, when you said "rotor spinner" I thought you meant the score motor on the rarer EM version, then remembered the playfield spinner.

Best of luck with it!

#8 5 years ago

Anyone have access to a playfield schematic on the system 1.
I am trying to find the out hole switch wires. Found the white and black which goes to A3-J5 Connector (Driver board)
The black wire on the outhole switch is what I can not seem to trace.
At first I thought it went to the tilt relay, or maybe direct ground or, cpu 5 volts.

Can somebody point me in the right direction. I realize the outhole switch was not part of the switch matrix.

#9 5 years ago

I think I have it.. IL dig threw and check.

#10 5 years ago

Thanks

#11 5 years ago

More progress...

Short youtube link showing progress

20161217_155617 (resized).jpg

20161217_155632 (resized).jpg

#12 5 years ago

Need some advise about ground plug on PC power supply.

Should the ground plug be cut off see picture.

20161217_165301 (resized).jpg

#13 5 years ago

You should join the #pindev slack channel. Tons of custom game makers there to answer technical questions.

#14 5 years ago

I don't see a reason to cut that ground. If you have a hv fault in the power supply, you risk sending 120 through the pic board. Are you having an issue that you think is being caused by a ground loop?

#15 5 years ago

Just another youtube update with the new backglass and sound effect changes.

#16 5 years ago

The game utilizes the test button found inside the door to perform diagnostics.
The Diagnostic exercises four areas:
1) Backglass displays - [Score Player 1 - Score Player 4], credit, ball, and individual lights
2) Sound effect files
3) CPU controlled playfield lights
4) Solenoids

I have discovered a few flaws in my planning. Number one using the raspberry pi to play sound effect real time can be a problem.
Multiple rapid succession of sound effects can be problematic.

My second flaw is I am still working out timing for the debounce of switches. The Spinner and Bumpers close to walls require a shorter debounce time then other switches. Again this is still a learning experience for me and my python programming skills require much work.

I am contemplating the removal of my 16 x 2 LCD and moving diagnostic messages to standard output or a logging file.

Have a lot of work yet to go, but its coming along.

1 week later
#17 5 years ago

Spent my christmas break working on the machine. Have created a spreadsheet to identify the events, playfield lamps, backglass lamp and so on.

Kids are starting to play the machine and providing good feed back on issues to be corrected.

Worked on the diagnostics to give full view of all switches, sounds, solenoids and event processing.

The diagnostics exercises the 43 CPU Playfield lights, 18 Sound events, 17 Pinball events, and exercises the backglass score displays and cpu controlled backglass lights.

Full list is here:
Type Prefix id Description
Lamp L 11 Playfield light 1,000 points
Lamp L 12 Playfield light 2,000 points
Lamp L 13 Playfield light 3,000 points
Lamp L 14 Playfield light 4,000 points
Lamp L 15 Playfield light 5,000 points
Lamp L 16 Playfield light 6,000 points
Lamp L 17 Playfield light 7,000 points
Lamp L 18 Playfield light 8,000 points
Lamp L 19 Playfield light 9,000 points
Lamp L 20 Playfield light 10,000 points
Lamp L 21 Playfield light 20,000 points
Lamp L 22 Playfield 2X Multiplyer
Lamp L 23 Playfield 3X Multiplyer
Lamp L 24 Playfield 4X Multiplyer
Lamp L 25 Playfield 5X Multiplyer
Lamp L 26 Playfield Same Play shoot again
Lamp L 27 Playfield Spinner 1000 when lite
Lamp L 28 Playfield A Lamp
Lamp L 29 Playfield B Lamp
Lamp L 30 Playfield C Lamp
Lamp L 31 Playfield BullsEye1 2000 when lite
Lamp L 32 Playfield BullsEye2 2000 when lite
Lamp L 33 Playfield Drop target1 5000 when lite
Lamp L 34 Playfield Drop target2 5000 when lite
Lamp L 35 Playfield Drop target3 5000 when lite
Lamp L 36 Playfield Roto target1 hit
Lamp L 37 Playfield Roto target2 hit
Lamp L 38 Playfield Roto target3 hit
Lamp L 39 Playfield Roto target1 10X
Lamp L 40 Playfield Roto target2 10X
Lamp L 41 Playfield Roto target3 10X
Lamp L 42 Playfield Roto Extra ball when lite
Lamp L 43 Playfield Roto Special when lite

Type Prefix Id Sound File
Sound Z 1 Insert coins nomoney
Sound Z 2 In Attract Mode Play Insert coins attract
Sound Z 3 Increase Multiplyer X better
Sound Z 4 New High Score! holey
Sound Z 5 Match award free game holey
Sound Z 6 Reset high score todate = 10 blow
Sound Z 7 Shutdown pi requested cu
Sound Z 8 Award Credit Score > 280,000 Pts pt280
Sound Z 9 Award Credit Score > 480,000 Pts pt480
Sound J 1 Play 10pts sound pts_10
Sound J 2 Play 100pts sound pts_100
Sound J 3 Play 1000pts sound pts_1000
Sound J 4 Play end of game sound endofgame
Sound J 5 Play game idle sound idlegame
Sound J 6 Play Start btn sound startsnd
Sound J 7 Play coin btn sound coinsnd
Sound J 8 Play test btn sound diagsnd
Sound J 9 Lost ball sound lostball

Type Prefix Value
Event 1 # of Coins Backglass - Updating coin display
Event 2 0/1 Start New Game... Start button pushed
Event 3 0/1 Tilt light on Mode = 9
Event 4 # of Balls Update ball display
Event 5 Score Value Backglass - Player 1 Score update Mode = 1
Event 6 Score Value Backglass - Player 2 Score update Mode = 2
Event 7 Score Value Backglass - Player 3 Score update Mode = 3
Event 8 Score Value Backglass - Player 4 Score update Mode = 4
Event a 0/1 Backglass - Game over light on Mode = 0
Event b 0/1 Backglass - Shoot Again light on Mode = 5
Event c 0/1 Backglass - Ball in play light on Mode = 6
Event d 0/1 Backglass - High score on Mode = 7
Event e 0/1 Backglass - Match on Mode = 8
Event f 0/1 Backglass – Player 1 Lamp Mode = 1
Event g 0/1 Backglass – Player 2 Lamp Mode = 2
Event h 0/1 Backglass – Player 3 Lamp Mode = 3
Event i 0/1 Backglass – Player 4 Lamp Mode = 4

Type Prefix Value
Diag K 1 Diagnostics Count to 100 Player 1
Diag K 2 Diagnostics Count to 100 Player 2
Diag K 3 Diagnostics Count to 100 Player 3
Diag K 4 Diagnostics Count to 100 Player 4
Diag K 5 Diagnostics Count to 10 Balls
Diag K 6 Diagnostics Count to 10 Credits
Diag K 7 Diagnostics Fire Solenoid Standup Targets
Diag K 8 Diagnostics Fire Solenoid Knocker
Diag K 9 Diagnostics Fire Solenoid Outhole
Diag K 0 Diagnostics Fire Solenoid RotoTarget
Diag K a Diagnostics Test Match Rtn 20 times
Diag K b Diagnostics Backglass – Player 1 Lamp
Diag K c Diagnostics Backglass – Player 2 Lamp
Diag K d Diagnostics Backglass – Player 3 Lamp
Diag K e Diagnostics Backglass – Player 4 Lamp
Diag K f Diagnostics Backglass – Game over Lamp
Diag K g Diagnostics Backglass – Shoot again Lamp
Diag K h Diagnostics Backglass – High Score Lamp
Diag K i Diagnostics Backglass – Match Lamp

Prefix Id Description
Switch S 0 Spinner
Switch S 47 Outhole
Switch S 16 Roll over A
Switch S 24 Roll over B
Switch S 32 Roll over C
Switch S 12 Top Bulls Eye 1
Switch S 13 Top Bulls Eye 2
Switch S 8 Lower Bulls Eye
Switch S 9 Bumper (x 2)
Switch S 10 10 Point Switch (x 6)
Switch S 11 Spin Roto & Add Bonus (x3)
Switch S 14 Right Inside rollover
Switch S 15 Right Outside rollover
Switch S 22 Left Inside rollover
Switch S 23 Left Outside rollover
Switch S 1 Drop target 1
Switch S 2 Drop target 2
Switch S 3 Drop target 3
Switch S 4 Drop target 4
Switch S 5 Drop target 5

#18 5 years ago

Here is an updated youtube of the test game running

#19 5 years ago

I find it so cool to see one of my boards going into an actual machine....

What a cool project.

2 weeks later
#20 4 years ago

More youtube vids to come. The last month has been mostly work on the coding for the arduino and coding on the pi.
The backglass display is largely working the way I want with sound effects, virtual lamps, score displays, match, high score, game over, and multiple players.
Messaging between the arduino to the pi drives all the backglass displays. So the true master and brains is the arduino not the pi.

The arduino talks to the zeb boaster board to power the solenoids. This works perfectly with my 36 volt transformer powering them. I also have a pc power supply powering my 12 volt and 5 volt dc needs.

The playfield lamps are my next challenge, not sure if I will use a dedicated lamp driver board for the 33 lamps or hook them up to a separate arduino mega and talk serially to it to control playfield lamps.

I have an unused pacled64 lying arround but not sure if I can program it using the arduino interface. Presently I am runing the arduino interface on the pi. I make my arduino code there, down load the code from the pi into the arduino and it works.
So if this can work and the arduino can send commands to the pac64led I'm in business. Otherwise I can use the arduino mega or something else to drive the play field lamps.

Another big step for me is to control power up and power down of pi, arduino and pinball hardware.
When shutting down, the pc hardware needs to power off first then the arduino and pi. The reason is if the pi and arduino are powered off first, all the solenoid fire at once, blowing fuses for too much current draw.

I need a relay controlling power to pinball hardware to power it off first then pi and arduino second.
My thought is to use a momentary button that arduino reads. When detected it messages pi to cut power to pinball cab then shutdown pi.

My other big milestone is cleaning up cables and mounting inside cabinet.

Yup lots left to do. Gotta reach out to zeb and get his input for controlling lamps via arduino on pac64led or something else.

#21 4 years ago

My list of things to do is growing not shrinking. I keep learning more and more and discover the limitations of the original gottlieb system one games. These are not limitations for me, I simply will overcome them with my own answer.

I never realized what happens when the player reaches 39,000 bonus points. Should the machine stop counting the points or should it just keep cycling the 1,000 to 9,000 bonus points lights forever. For my system, after you reach 39,000 bonus points thats exactly what I do. It works for me, alternatively I may use a dip switch to artifically limit max bonus points to 39,000 points.

Going to keep the top 4 high scores and store them on arduinos eeprom memory. Right now I just store the highest score to date.

I have decided to improve on the switch matrix logic to detect stuck on switches. This will help save me from frying solenoids from stuck on switches (outhole kickers, stand up targets, roto spinners, thumpers). The debounce logic will include the sense that a switch is stuck on. After a solenoid switch is detected as stuck on I will trigger a game over and disable all cpu controlled solenoids. This in turn will cause a pop up window on my backglass screen with a diagnostic message. If the switch matrix detects a regular switch as stuckon like a spinner or rollover switch, the game can continue, but a flashing text message will appear on the backglass.

Adding advanced diagnostics to exercise solenoids, and playfield lights. This will appear as a dialogue box and menu screen.

Adding a 4 pin dip switch. Pin1 = on 3 player, off 5 player, Pin2 = Match give extra credit, Pin3 = High score give 3 credit, give 1 credit, Pin4 = 380,000 gives credit

Adding new rules for random skill shoot on a timer. Before ball launch window popup and timer countdown of required target. Window disappear when time expired.

#22 4 years ago

Adding animation to the backglass screen is also on my list of to do's. The concept of imitating turning on and off virtual light bulbs behind the backglass image is something I am having problems with.
The rendering is causing a performance hit on the raspberry pi, causing it to lag behind the real time events forwarded from the arduino. This is largely due to my beginner status in coding in python. creating optimized coding and using better methods to imitate light bulbs behind a picture will come in time.

Have three mechanical issues to deal with.
Roto spinner has some bent target springs. Need to drill rivets holding target in place, straighten spring, refasten target withnew rivet.
Corroded spinner becomes stuck on and stops spinning.
Issues with two columns of switch matrix for roto targets.

My last big rock is the lamp playfield driver block. Build or buy something.

Other tiny details is to button up the backbox, mount tv and speakers. Will add decorative backglass.
And did I mention the rats nest of wires arround the arduino.

Yup, just a few things to do. But you know what, the game is working as is, with multi players.

Stay tuned as I knock each of these to do's out of the way.

Of course once I get this all done, I'm going to apply much of it to my Phoenix hybrid pinball machine.

#23 4 years ago

Playfield surface has two issues that I will likely address last.

The plastic inserts have become cuped.

Top of playfield has slight grove.

I am seriously considering sanding artwork to the wood and applying reprinted art to the playfield.

For this one I seriously need the help and advice from the community.

Since this is a hybrid machine already, there is no need to hang onto any puristic practices of keeping the machine original.
Lets face it, its already a frankenstein of sorts.

A new printed playfield may work in this case. But I will not attempt anything without some good advice first.

Please, please your input will be very helpful in this case!!!!!

1 week later
#24 4 years ago

Short update on the backglass development.

The use of simple graphics so I can emulate virtual lamps behind the backglass are coming along.
Thus far the lamp is a yellow filled circle with some text if needed. Later on it will be a transparency that emulated a lit bulb.

#25 4 years ago

Lamp driver board progress...
I have decided to build my own lamp driver board. Spoke to my trusted Canadian friend at Zebs Boards.

The board will be populated with 74hc595 shift registers and darlington array unl2803a.

I ordered the parts from digikey.ca.
The idea of being able to use roughly 3 pins to control 32 lamps is kinda cool.
Now just need to brush up on my shifting bits and let the good times roll.

Can hardley wait to build some attract mode sequences with the lamps with some background music.

#26 4 years ago

Cool project Is the Phoenix conversion documented anywhere?

#27 4 years ago

Sys6,

I have some of it documented at vpforums, had two projects on the go, one was a virtual pinball, the second was the phoenix.

I experimented using a rottendog board, tried just a pi to do everything, tried arduino by itself.
It was definately a frankenstien experiment.

So far I have jukebox projects, radio projects, hybrid pinball projects on the go.
The jukebox is an msm city II that I am adding my own touches, like mp3 and 45 rpm record playing with ipad remote control.
The radio is a 1945 golden eye. This will be completely refinished and have my own internal touches. See my avatar picture for one of the other radios I have done so far.
Finally the hybrid pinball machines that will be posted here.

#28 4 years ago
Quoted from legtod2:

The plastic inserts have become cuped.

Top of playfield has slight grove.

That looks like a good condition playfield, there are a few option for the cupped inserts. i've seen posts where some are filled and leveled with a resin, others remove from the playfield and sand flat.

Maybe consider first trying a playfield protector, it may level over those inserts, provide protection, overal, and be reusable should you explore other options.

https://pinside.com/pinball/forum/topic/lexan-playfield-protector-install-and-review

#29 4 years ago

VacFink,

Thats the ticket! Perfect, looks like they have one for my table too!

Won't break the piggy bank either.

Thanks, alot!!!

Now to see what shipping gonna cost to my neck of the woods.

doing my happy dance

#30 4 years ago
Quoted from fattdirk:

Is there a reason you're integrating the arduino vs having the pi run everything thru the gpio?

Cool Project.

I am planning a similar project and I would use the Arduino or another microcontroller to off load the I/O as well. That RPi uses 3.3V I/O directly to the CPU chip. A lot less tolerant than the Arduino I/O pins. Plus I find that the Arduino and other microcontrollers handle the low level I/O easier.

#31 4 years ago

Robotworkshop,

The next hybrid for me will be entirely made up of arduinos and a dmd display or a series of 7segment displays with a wav trigger board for sound.

The use of the pi for this project simplified the backglass and sound solutions. Today I feel much more confident is drafting a more traditional solution

#32 4 years ago

My chips arrived from digikey.ca (wow that was fast). Created an 8 channel sample and led lamps so I can test.

Wrote a small script to test it. Low and behold a couple hours to prototype and scripting I got it working to drive 8 lamps.

The best part is it only takes three pins on my arduino to drive my lamps.

My next step is to prototype the 5 74hc595 and darlingtons together to drive all the lamps.
After that to write some cool scripts to create some creative scripts that showcases the bling with sounds

Oh yah

#33 4 years ago
Quoted from legtod2:

Robotworkshop,
The next hybrid for me will be entirely made up of arduinos and a dmd display or a series of 7segment displays with a wav trigger board for sound.
The use of the pi for this project simplified the backglass and sound solutions. Today I feel much more confident is drafting a more traditional solution

Do you happen to have any examples of the Arduino code used? I was wondering how how long you would have it turn on a coil if it were controlling a kicker, slingslot, or bumpers? Also, what driver board are you using for controlling the heavy current devices? Did you roll your own board?

#34 4 years ago
Quoted from legtod2:

My next step is to prototype the 5 74hc595 and darlingtons together to drive all the lamps.
After that to write some cool scripts to create some creative scripts that showcases the bling with sounds
Oh yah

Those 595's are great for controlling lamps, LED's, and lots of outputs. Daisy chain four and you've got 32 outputs with three pins.

#35 4 years ago

Robotworkshop,

I have a solenoid driver board that I got from zebs boards and I wrote a simple subroutine to fire my stuff with.

The arduino subroutine can be seen below
void FireSolenoid(int pin) {
pinMode(pin, OUTPUT); // Switch from Positive 5volts to 0volts
digitalWrite(pin, LOW); // Turn on Ground for this pin (Turns on switch)
delay(50); // Turn Pin on for half second, This will vary for flippers and bumpers and kickers for now same for all
digitalWrite(pin, HIGH);
}

#36 4 years ago

Not sure how deep you are in, however there are great little boards available from the OPP (Open Pinball Project) and can be used with the Mission Framework code, or their own, and would work with your Arduino as controler.

https://pinside.com/pinball/forum/topic/open-pinball-project#post-3304393. You can buy the boards, or open source and have your own printed.

#37 4 years ago

I'm a bit envious. I have yet to find a good-priced fun populated playfield to do what you are doing, but definitely want to for the challenge. I've got a couple of Arduinos, Raspberry Pis & even some IPAC boards(even the super fancy one). Getting them all to play together to make a low-cost pinball machine is quite awesome.

Keep up with the updates.

#38 4 years ago

My son did and RPi controler for my Joker Poker 3 years ago when he was in Grade 9 I needed an MPU for the game and he needed a school project so it was a good match (I'm cheap, he's smart). He wrote all the code in Python and I just helped in with rules and interfacing hardware to a Gottlieb System 1 driver board I had. Unfortunately he never did get the sound going.

Because of time constraints and to make the coding simpler, I wired the switches into an i-pac board - pretty easy on a System 1 as all the switches are wired individually to the diode boards.

Here's a video: Note the game was legless hence the floaty play

I am now planning on doing my own all in one board (just because it is something I have been wanting to do since the 80's lol) using an Arduino. I plan on using a Mega R3 to drive the original displays as well as going back to the original switch matrix as well.

I'll be following this thread closely for any tips/tricks

#39 4 years ago
Quoted from legtod2:

Robotworkshop,
I have a solenoid driver board that I got from zebs boards and I wrote a simple subroutine to fire my stuff with.
The arduino subroutine can be seen below
void FireSolenoid(int pin) {
pinMode(pin, OUTPUT); // Switch from Positive 5volts to 0volts
digitalWrite(pin, LOW); // Turn on Ground for this pin (Turns on switch)
delay(50); // Turn Pin on for half second, This will vary for flippers and bumpers and kickers for now same for all
digitalWrite(pin, HIGH);
}

There's lot's of ways to skin cats in software, but you might find you get into strife with this approach as delay() is a blocking function - this means processing of your code stops whilst in the call to the delay function - it literally just waits and counts down the delay value. With many solenoids firing about the same time or flippers held then unless you use an individual Arduino for each solenoid (and then have much more comms to worry about) I think you may have problems.

You could try time stamping the call to fire the solenoid and then use something like;

if (millis() - start_timestamp <= desired_ pulse_time) { .... // fire solenoid and any other stuff

another approach might be to use interrupts.

#40 4 years ago

Vacfink,

I have exchanged emails with Hugh at OPP. His blog is amazing and it inspired me after a few months of lurking his blogs to try something. I dont know how many different hybrid machines I will be building but each will be unique and some sort of abomination of standard thinking practices.

In my opinion OPP rocks!

since I'm a coder I like to craft my own code. I am considering using using some aspect of opp for solenoid and lamps then frankenstein them into my own basterdized creation.

#41 4 years ago

S1500,

Thanks for your comments.

#42 4 years ago

Woz,

Thanks for your comments. The use of the gottlieb driver board was a great idea. My machine was completely robbed of all its boards, sort of a parts or donar machine.

The system one machine really only uses 3 to 5 sounds. Integrating thoes sounds into his current setup should not be to difficult.

He has all the key ingrediants now. He has the pi that could have a pc speaker plugged in, and the pc monitor for a backglass.

I will add a diagram to show what I have.

Smart kid you have there.

#43 4 years ago

Sys6,

An interesting suggestion on your part. The delay of 50 to give enough kick to the solenoid is pretty short in my eyes but I see what your saying.

For example I use delay again in my reading of the 8x5 switch matrix routine (see below). I also use a debounce component to.

Will this cause me some issues, I will try some performance testing to see if it trues does cause issues or not.

My challenge is from a switch matrix perspective there are 40 switches and potentially 40 timers to start and stop for debounce intervals. Plus my timer intervals for bumpers, spinners, and rest varies for optimal settings. I guess I could use an array for the debounce intervals.

"void readMatrix() {
// Using Pull up resistors so swState = 0 is Button pushed, and 1 = Button not pushed
// Positive side to the White wires Pins 27 - 34
// Negative Side to the Green wires Pins 22 - 26
k = 0;
for (i = 0; i < 5; i++) { // Pins 28 - 32 (Negative Terminal)
for (j = 0; j < 8; j++) { // Pins 33 - 40 (Positive Terminal approx 5volts)
k = (i*8) + j;
swPrev[k] = swNow[k]; // rotate variable
pinMode(i + 22, OUTPUT); // Switch from Positive 5volts to 0volts
digitalWrite(i + 22, LOW); // Turn on Ground for this pin
swState = digitalRead(j + 27); // pins 33 - 40

pinMode(i + 22, INPUT_PULLUP); // Switch back to pullup resistor
swNow[k] = swState;

//if (flagSwitchOn == 1)
{
if (swNow[k] == 0)
{
if (k == SW_SPINNER or SW_BUMPER) {
delay(SW_DEBOUNCE_SPINNER);
} else {
delay(SW_DEBOUNCE_DURATION);
}
#if swdebug
Serial.print("Switch now ON = ");
Serial.print(k); // TODO check this formatting later
Serial.print("\r\n");
#endif
}
flagSwitchOn = 0;
inputString = "";
}

// check for a "new" state
if ( swNow[k] == swPrev[k]) {
swNew[k] = 1; // Ok Switch already on so reset to off
}

else // must be new if not old and new equals one
{
if (swNow[k] == 0)
{
swNew[k] = 0; // Set switch state On

}
} // end else
} // end for i
} // end for j

delay(10) ; // 10ms loop time

// end read switches

} // End void readMatrix()"

Sorry about format and indentation gets changed after submission

#44 4 years ago

Any recommendations on arduino solenoid firing or switch matrix checking ?

#45 4 years ago

Hi legtod2, some thoughts for you, not in any way as criticisms but more the back corners of my mind as I've played around and written small fragments of code to test ideas with the possible thought that one day I could put it all together as a pin. Like you I figured a good first real project would be to take an existing play field and just re-code it. As I said in my post above there are so many ways to achieve the same outcome with software, so feel free to ignore or discuss my thoughts

I really don't have a feel for how delays, timers and so on would impact overall code and hence the play ablilty of the eventual game. It just seems good practice to avoid blocking functions where possible. I think I'd just have to just test it and see.

With Arduinos being so cheap I've pondered if a switch matrix is the best way to go? It's certainly traditional and more efficient in the use of pins and wiring which is good for manufacturing and cost but at the expense of programming effort, complexity and clarity.

I've thought about a distributed processing model with an Arduino taking control of a fragment of play field area. For example one to control slings and flippers, one for ball drain, ball serve, coin up. This would mean you could use discrete switches rather than a matrix - you still need to debounce and so on but the whole problem becomes more manageable and modular. The wire library is pretty easy to use and would handle comms between modules. Most of the comms need not be "that" fast - game enable, scoring, modes and so on.

Take a Nano for example - I play mainly with them. They have 22 I/O, so;
- 6 solenoid output drives
- 6 inputs switches to fire solenoids (could also do a hardware direct drive if wanted)
- 2 pins for I2C wire coms
- 2 pins for lamps (easy to do 16 leds)
- 8 for scoring style switches

For lamp control I think I'd use WS2812 leds (again distributed by play field area) - very clever little rgb leds that take 5V and a single serial line. They are chained together so only use one Arduino pin and can individually be any colour or intensity you desire. The first led in the chain strips the data for its' use and passes the remainder through to the next led in the chain and so on. I use the adafruit neopixel library for them.

Thanks for posting what you're doing, good luck and I follow with interest.

#46 4 years ago

Sys6,

The switch matrix allows me to utilize much of the original wiring without having to do too much plumbing on the playfield side. It did not occure to me to multi modularlize and go without the matrix.

I continued with the switch matrix cuz thats what I used for the phoenix hybrid project.

Eliminating the matrix and using the multiple mods would simplify coding...

Maybe my next hybrid will be a complete opp and mission pinball framework.

#47 4 years ago
Quoted from SYS6:

Take a Nano for example - I play mainly with them. They have 22 I/O, so;
- 6 solenoid output drives
- 6 inputs switches to fire solenoids (could also do a hardware direct drive if wanted)
- 2 pins for I2C wire coms
- 2 pins for lamps (easy to do 16 leds)
- 8 for scoring style switches

Not to derail the thread, but unless you're doing a project like this to specifically learn embedded programming and circuit design, the existing board sets have already been developed and have extensive testing and real world installs done. There's even fully open sourced alternatives like Open Pinball Project:

http://pinballmakers.com/wiki/index.php/OPP

I often see people struggle to solve problems that have already been solved, or try to re-invent stuff that's already been invented and often is more robust or capable than what they're working on. If cost is an issue, OPP certainly solves that as you can wire up a game for about $100.

For this specific project, the current OPP firmware doesn't have switch matrix support, although it does have lamp matrix support. But I just wanted to illustrate that instead of re-inventing the wheel, there's several options out there for the pinball makers.

#48 4 years ago

I must admit that I am learning by making mistakes and correcting or improving as I go.

Stupid me, my first pinball project was an electromechanical Grand Prix.
Boy was I ever out of my league to try that. But I stuck with it and got it working and running well.

The biggest help to me has been to read forums like this and ask questions, then get your hands dirty and try it.

For me its all about learning. This web site has been a great help, in short its the encyclopiedia britanic of pinball knowledge.

Here it is for the curious in running order

#49 4 years ago
Quoted from jwilson:

Not to derail the thread, but unless you're doing a project like this to specifically learn embedded programming and circuit design, the existing board sets have already been developed and have extensive testing and real world installs done. There's even fully open sourced alternatives like Open Pinball Project:
http://pinballmakers.com/wiki/index.php/OPP
I often see people struggle to solve problems that have already been solved, or try to re-invent stuff that's already been invented and often is more robust or capable than what they're working on. If cost is an issue, OPP certainly solves that as you can wire up a game for about $100.
For this specific project, the current OPP firmware doesn't have switch matrix support, although it does have lamp matrix support. But I just wanted to illustrate that instead of re-inventing the wheel, there's several options out there for the pinball makers.

Yep, I agree we should not be derailing the thread and I posted some Arduino comments based on legtod2 already saying he was using them.

For jwilson, I don't think we're really doing an apples v apples comparison here. OPP compared to Arduino (or other self contained embedded) is fairly different. The end target might be a pinball machine but there are big differences in the road you travel.

To use OPP you need a host computer to do scoring and control routines. In my view using a pc is not the best approach to a pinball machine - quite happy for other to disagree if they wish. The host computer needed for OPP should be added to any cost comparison.

You still need to learn / use a programming language for either, in reality any, system for a diy pin.

The hardware side of a pinball for an Arduino approach is pretty trivial. It is done for you in OPP (and very nicely too) but as you say no support for switch matrix. Arduino can make use of other cool bits and pieces too eg the rgb leds I mentioned, oled displays etc

For a diy pin the biggest "cost" is probably in time invested to do it all, but that's part of the fun for someone who embarks on such a project.

You might say it's reinventing the wheel, but it's a sufficiently different wheel to me. Anyway it's good to have different approaches available and to understand the pros and cons of each of them.

#50 4 years ago

Switch matrix update:
My logic does cause issues with rapid succession of on/off performance testing.
Specifically with drop targets. When a drop target drops, debouncing the switch just adds unnecessary delays which can in turn cause missed sequential switch operations.
No problem guess its time to switch from delay() to millis() debounce style logic.

Lamp matrix update:
Building a couple of 16 pin modules instead of a single 32 pin board. Only becuase my prototype boards on hand are small.
The board will have the 16 pin header for output control of 16 individual lamps and the neccessary input pins for the arduino. In reality all the board will do is turn on and off the ground to the individual 16 output pins. Which is also what my solenoid driver board does.

Backglass update:
I have been trolling/lurking/ posting on the raspberry pi forums in the pygame section for input on the backglass. The emulation of a lamp to appear behind the back glass has not yet gotten any bites for that group. So far I continue using a circle that is filled in with yellow colour and some. In other words no progress.

Fun factor update:
The machine was played during superbowl weekend. New high scores were acheived, fun was had.
No beer was spilled, shock and awe from the final quarter outcome... Brady pulled a rabit out of the hat, and no deflatted footbal was found.

There are 132 posts in this topic. You are on page 1 of 3.

Hey there! Got a moment?

Great to see you're enjoying Pinside! Did you know Pinside is able to run thanks to donations from our visitors? Please donate to Pinside, support the site and get anext to your username to show for it! Donate to Pinside