What's new
Pinball info

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Complete Mishmash self build - let’s make a pinball machine

You'll wish you had sooner or later :D
I’d love to learn, but……
as far as i can see if you adopted the OO approach to this, I’d have tons of functions and classes and structures and it would have taken a month of sundays to get it all designed and coded up, and it would be hard to maintain???

i am prepared to be proved wrong, I want to be proven wrong and I want to learn- someone is welcome to take my code and redo it in an OO way (once i’ve finished).

It will be interesting to see how easy i find my code to maintain; and also, how easy it is to adapt to a second game. (i have another populated playfield in waiting!!!)

Tomorrow i’ve got a ton of game rules testing to do, then some light shows to code in, plus i am now going to add in a config file that holds game settings, high scores, etc. i’ve also got to wire in the two lamps in the 2 pop bumpers (i can’t get an addressable led in there - bit would like to!) ……
 
I’d love to learn, but……
as far as i can see if you adopted the OO approach to this, I’d have tons of functions and classes and structures and it would have taken a month of sundays to get it all designed and coded up, and it would be hard to maintain???
It would have taken longer to set it up and yes you would have a number of classes. But it would be easier to maintain not harder. Thats the point of OO. makes that easier.

i am prepared to be proved wrong, I want to be proven wrong and I want to learn- someone is welcome to take my code and redo it in an OO way (once i’ve finished).
i did actually start creating an oo version of it - but I got sidetracked. (i also havent got the hardware - thats a lot of breadboard wiring. Although I could of course set it up with a couple of switches, lamps and virtual solenoids - be easy to expand I guess). Id be happy to share what I have - but its currently incomplete.
That said, to a point the reading of switches, and triggering of lamps/solenoids is sort of incidental. The functions that do that can be plugged in afterwards. You have a function that reads all the switches then the logic does its thing, sets up the lamp/solednoid states and other functions turn on the lamps/switches. At least in theory. Generally isnt as simple as that of course because programming.

It will be interesting to see how easy i find my code to maintain; and also, how easy it is to adapt to a second game. (i have another populated playfield in waiting!!!)
:eek:
Tomorrow i’ve got a ton of game rules testing to do, then some light shows to code in, plus i am now going to add in a config file that holds game settings, high scores, etc. i’ve also got to wire in the two lamps in the 2 pop bumpers (i can’t get an addressable led in there - bit would like to!) ……
If the OO was done correctly you would in theory be able to change the rules without touching the underlying code for the most part.
 
Last edited:
Cool - maybe when I've got the game going, I can share the code and also the hardware - the board I have built is pretty simple, it has an ESP32s processor and then some input and some output shift registers (and some resistors), that's all you
need to code a game, but would be handy to mock up the switch matrix, add some addressable leds to mimic the playfield leds and also add some ordinary leds to the outputs instead of solenoids. (I was going to add leds to the outputs on the board, but then I didnt because the MOSFET driver boards have a led on them anyway, but actually it would be handy to have a led on each output, for developing, testing, debugging the board itself.
 
Cool - maybe when I've got the game going, I can share the code and also the hardware - the board I have built is pretty simple, it has an ESP32s processor and then some input and some output shift registers (and some resistors), that's all you
need to code a game, but would be handy to mock up the switch matrix, add some addressable leds to mimic the playfield leds and also add some ordinary leds to the outputs instead of solenoids. (I was going to add leds to the outputs on the board, but then I didnt because the MOSFET driver boards have a led on them anyway, but actually it would be handy to have a led on each output, for developing, testing, debugging the board itself.
I'd be up for that on the electronics and programming side, a bit short on space to have a spare cab and playfield. I suppose the way to accelerate this is to have a virtual interface to test the logic on, or at least a gui to be able to hook up to in the code.
 
I was tempted to ask if you wanted to part with one of your CPU boards so I could dabble. But then I would feel compelled to poke at it more. So many irons in the fire.
I still haven't finished fiddling with the mod I was planning for my Cosmic Gunfight - though I did get it working sorta. I was going to look on the internets to see if there's an off the shelf PCB that will let me multiplex teh outputs lamps rather than creating a circuit board myself. (I have no knowledge of this - im sure I could learn, but theres that irons in the fire thing again :) )
 
I was tempted to ask if you wanted to part with one of your CPU boards so I could dabble. But then I would feel compelled to poke at it more. So many irons in the fire.
I still haven't finished fiddling with the mod I was planning for my Cosmic Gunfight - though I did get it working sorta. I was going to look on the internets to see if there's an off the shelf PCB that will let me multiplex teh outputs lamps rather than creating a circuit board myself. (I have no knowledge of this - im sure I could learn, but theres that irons in the fire thing again :) )
you mean one of these:
2051EF5B-61BA-4485-98A3-2370A37967E9.jpeg
You are welcome to one if you want one.
 
Ok so i’ve got as far as getting a game going, it plays and all the rules are in there, Ive tested them all and all debugged and working, got end of ball bonus routine going too. Got the score displays working and showing scores with commas in eg "1,234,560" not 1234560. Couldn't find an easy way to do this so created a function to do it.

Currently left on my Software to-do list:
  • Hook up the pop bumper lights to 5v – test they work. (not s/w but needs doing before I forget)
  • Sound - find a hardware solution, get sound samples, program in the sounds to the game, test
  • Lighting animations - attract mode and in-game
  • Add read and write to a json config file to hold game settings, balls per game, score thresholds for extra ball/replay, easy and hard game settings, eg. when does extra ball light and when do specials light, etc HSTD, HSTD names, scores etc.
  • Setup mode – to configure the above, clear HSTD etc.
  • Attract mode to show more than 1 HSTD
  • doGameOver() – If HSTD beaten, allow entry of player(s) names.
 
Ok so i’ve got as far as getting a game going, it plays and all the rules are in there, Ive tested them all and all debugged and working, got end of ball bonus routine going too. Got the score displays working and showing scores with commas in eg "1,234,560" not 1234560. Couldn't find an easy way to do this so created a function to do it.

Currently left on my Software to-do list:
  • Hook up the pop bumper lights to 5v – test they work. (not s/w but needs doing before I forget)
  • Sound - find a hardware solution, get sound samples, program in the sounds to the game, test
  • Lighting animations - attract mode and in-game
  • Add read and write to a json config file to hold game settings, balls per game, score thresholds for extra ball/replay, easy and hard game settings, eg. when does extra ball light and when do specials light, etc HSTD, HSTD names, scores etc.
  • Setup mode – to configure the above, clear HSTD etc.
  • Attract mode to show more than 1 HSTD
  • doGameOver() – If HSTD beaten, allow entry of player(s) names.
I had envisaged some kind of json file to dictate the game rules with my OO system :)
 
something else I meant to say -you might want to consider using GIT to put your code and such. (Simple to use source control stuff.)
 
i’ve got a github account but never used it for my source. i control it easily enough on my laptop. i suppose if you’re making stuff for others to use then it’s essential.
 
had another go with the sound card and a faster micro sd card. these boards are amazing:
BBEE99AB-C7D5-4F36-893C-66998C432788.jpeg
it’s tiny as you can see compared to my thumb. it’s got a built in 5w amp which is pretty good. i’ll post a video in a bit.

I’ve got sound in the game now. the hard bit is choosing suitable sounds.
 
The costs for the electronics so far is not bad:

Controller PCB (5 made) £6.65
ESP32s chip £2.91
595 and 165 chips £3.00
Pin headers, dil and in line sockets, etc £2.00
Chunky Transformer - ebay £11.00
Bridge rectifier £0.50
5v Regulator £1.50
Terminal connector & jumpers £2.30
Line EMF filter £5.00
Mains cable and plug - free off old device £0.00
6 X Max7219 8 X 32 dot matrix displays £23.95
RTC clock module £1.45
4 X 4-way irf540 Mosfet power driver boards £16.00
5v 10A PSU £9.41
SD card and sound board £7.00
ws2812B Led Strings £18.36

TOTAL £111.03

Not bad for a pinball controller with lights, sounds, solenoid control and score displays.
 
The costs for the electronics so far is not bad:

Controller PCB (5 made) £6.65
ESP32s chip £2.91
595 and 165 chips £3.00
Pin headers, dil and in line sockets, etc £2.00
Chunky Transformer - ebay £11.00
Bridge rectifier £0.50
5v Regulator £1.50
Terminal connector & jumpers £2.30
Line EMF filter £5.00
Mains cable and plug - free off old device £0.00
6 X Max7219 8 X 32 dot matrix displays £23.95
RTC clock module £1.45
4 X 4-way irf540 Mosfet power driver boards £16.00
5v 10A PSU £9.41
SD card and sound board £7.00
ws2812B Led Strings £18.36

TOTAL £111.03

Not bad for a pinball controller with lights, sounds, solenoid control and score displays.
Not bad, thats amazing!
 
I implemented the sound card's, busy signal line output this morning. It more or less works, i.e. it puts the line low when the card is busy playing a track and sends it high when it is not busy. However, in testing, it seems the "busy" flag can sometime stay low, even when the song file has been played until the end. I've had to code around this, to get a reliable working solution.

I've created some better sounds, still not perfect for all actions, but getting there. Fixed a few bugs in my code, e.g. play game 1, then when start game 2, some of the players achievements from game 1 were carrying over - easy fix.

After 4 really solid days on this project, I'm going to take a bit of time off the coding and do something else........maybe time to cook a curry.....
 
Does that little sound card support multiple channels? or just one track at a time? Will you want a background track + samples on top etc...
 
had another go with the sound card and a faster micro sd card. these boards are amazing:
View attachment 150602
it’s tiny as you can see compared to my thumb. it’s got a built in 5w amp which is pretty good. i’ll post a video in a bit.

I’ve got sound in the game now. the hard bit is choosing suitable sounds.
I do love these pre-built modules that can be picked up from China... Small power converters, Amps, Players. Certainly take the pain out ot cobbling something together!
 
Does that little sound card support multiple channels? or just one track at a time? Will you want a background track + samples on top etc...
it’s mono and only single file play at once. i could use two of them to get a background track as well as other sounds. but in this project, i’m just doing one sound at a time.

there are stereo cards available.
 
I’ve been thinking about a backbox for this pin. As i’ve used a non std size score display, I can’t use the original 8 ball champ backglass/translite, so i’m thinking there is no point in building a full size backbox. i’ve mocked up a smaller height backbox using an old wine crate. it’s probably not high enough, so i’ll need to make one a bit taller. then again, a full size one will look better in a lineup??? hmm
6F1D4339-2425-49C5-86B3-6B1026F9C5D1.jpeg
9233193B-3ADE-4D0D-8FA8-F276E7B358E0.jpeg
70012214-0218-4036-BCA4-A01605FBA943.jpeg
 
Too cold to woodwork in my garage, so back to the coding. I've now managed to get the soft settings, coded into a parameter file and can read and write to it. The ESP32s is amazing, you can create a file system on its inbuilt memory then use all the usual file open, close, find delete etc. commands. Ive created a simple config file, JSON, encoded to hold all my parameters, so far ive got: No of balls per game, Play attract mode music (and which track to play), allow extra balls, Y/N, then extra ball feature difficulty - easy, med, hard. Then I've got 10 High Scores and 10 associated player names. Because it is JSON, I can easily add to this in future.

Ive started to implement each of these settings in the game code. Got the attract mode showing the top 10 HSTD and the end game routine will allocate and save away any new High Score achieved. Ive yet to implement the Hstd players names,,, will do that once I get my flippers wired in as I need those to choose each letter. The extra ball stuff still to be done too.
 
Managed to get the HSTD entry routine going, so now i can enter a name against a high score. a bit tricky coding the stuff like the flashing current digit and ability to delete the last character, but got it going in the end.
 
Looking good mate, well done. I think we have another contender for the pin chat streaming thing?
 
On with the woodworking today l, first job to make a frame for the backbox to sit on
5EB13D18-1A78-4E20-94EA-0A8601E2D755.jpeg
79360225-9E5F-43CF-9372-CC55BE0E1FC7.jpeg
Then some hardwood platforms that will hold the bolts to connect the head on
ED10D399-ECB7-47A7-AF52-E23EC982A394.jpeg
and into place
67FC04F0-FFA0-4966-9729-64A2CAC4F893.jpeg

Ive decide to do a full height cab:
F82CFD1C-AB04-42DC-960E-6E5F745AF72D.jpeg
first side glued and nailed up. i’ve only got one long sash cramp, so will do the other side tomorrow.
760DC367-904E-445A-9959-A0BF97D07041.jpeg
 
This is absolutely fascinating to me, the whole thing. I wish I had one hundredth of the skills and talent you have undertaking this project @AlanJ Hats off to you sir
 
Back
Top Bottom