Monthly Archives: January 2014

Initial Python Mockup done

So traveling over to the repository, the latest version has a python mockup for a pinball machine.   The idea is that there is a translite mounted in front of a monitor.  The translite has cutout areas so that the player’s scores, ball count, credits and current player is displayed.  All of these are in static locations so the translite is just a typical translite.  The simulation automatically scales between a mockup size and the full screen size so testing can be done more easily without having the simulation take the whole screen.

When coding it up, I decided that the monitor also needed to include general illumination fake lights to mock up general illumination behind the translite.  To make it clear, I made the general illumination lights appear like circles so they appear just as if they were 44 or 47 bulbs.  If doing it for real, the general illumination lights could be any shape that would make the most sense behind the translite.  The general illumination lights are turned on and off as a group.

Well if you have general illumination, you also need feature lights to highlight whatever needs to be highlighted in the translite.  You need Santa Claus on the backglass to light up when you pick him up in the Taxi.  The feature lights are triggered off simulated inputs.

I threw in a very simple set of rules which essentially contains a way to add credits to the machine, start a game, and drain the current ball.  Up to four players are supported.  When the game is playing, inputs can be simulated to add score to the active player.

It’s not much of a pinball machine if it doesn’t have sound.  When a game is playing, a background song plays continuously.  Inputs can also be simulated to play sounds on top of the background music.

All of the stuff is written using pygame.  I originally was going to use tkinter, but really wanted to support sound.  It has been “optimized” to only redraw (blit) changes in the screen, so it should run very quickly.  I could have cheesed out and redrawn the whole screen, but who knows how fast the Raspberry Pi will be able to draw to the screen.

This should work on a Raspberry Pi, without installing extra modules.  When I get the power supply boards, and the Pi shield in the next couple of weeks, I will try it out, but I’m not in a rush.  My development environment is very simple on a regular PC, so there is no reason to move onto the actual Pi until later.

It is currently only a simulation, so it doesn’t run the serial commands to interface with the input and solenoid cards.  That’s probably going to be the next step.

Here is a quick rundown of how to run the simulation:

Starting it up, you should see the positions of the player scores, and current player and credits/ball num displays.  The following commands (single key presses) are supported.
‘s’ go to sound mode, ‘0’ to ‘9’ will then play a sound (there are only about 5 sounds installed.  Used normally to trigger sound files.
‘i’ simulate input mode, ‘0’ to ‘9’ simulate an input
‘l’ light mode, toggle on/off feature lights, ‘0’ to ‘9’ simulate an change

Starting a game:
‘c’ add a credit
‘g’ start a game
‘d’ drain the ball

Quick walk through:
Start up the program.  Press the ‘s’ key to get into sound mode.  Press a couple number keys to listen to the sounds.  Next press the ‘l’ key.  (That’s an L)  Press a couple number keys and watch feature “lights” toggle on and off.

Now start a game.  ‘c’ gives a credit, and ‘g’ starts the game.  Background music should be playing.  Press ‘i’ to simulate inputs and add score to the player 1.  Press ‘d’ to drain the ball.  Notice the ball num going up.  (it is assume that the translite will have text indicating to the player which window is the ball num/credits and which window is the current player)  Drain enough balls (3) and the game is over.  The background music should stop.  Press ‘esc’ to leave

There is a batch file in the directory that automatically sets the right parameters on a Windows machine.  The command line is:

c:\Python27\python.exe -port=COM1 -simWidth=854 -actualWidth=1366 -debug

Here is a quick screenshot of the simulation.




Rockin In 2014

Welcome to 2014 and it looks like it is going to be a very interesting year.  Many new things will be happening this year at the OPP, and I predict the starting of a serious shake-up in the pinball industry.  This year is definitely going to be fun!

People like to make resolutions at the end of the year, so here they are for the OPP:

  1. Have a Logo created
  2. Visit at least one show (Allentown or York, and maybe hit both) and bring a prototype.  (Best case, it is going to be a working white wood with almost no rules, worst case, it is going to be the EM converted to solid state using the driver/input cards)

Everybody needs a logo, and the OPP is but one of them.  As mentioned so many times before, I have no artistic talent.  ZERO.  I’ve reached out to my one contact, but nothing has come of it.  If you are foolish enough to be reading this, and have some small thread of artistic talent, send me an email.


Enough with the begging.  On to the technical stuff, which is really where all the fun is located.

The power supply board is completed.  The design will be checked into the Google code repository in the next couple of days.  The board manufacturer is on vacation until 1/6/2014 so some extra days can be spent verifying the design.

Since the board is 10 cm x 10 cm, the extra unused space is being used for a respin of the RS232 interface card so that the communication connector matches all the other connectors in the system.

The last piece of the card is a custom Raspberry Pi shield.  That card contains the Raspberry Pi header, voltage translator, a MOSFET so the Pi can turn on and off the power supply, and all of the connectors necessary to interface with a complete system.  I continue to believe that the Raspberry Pi is going to be my best option.  I love the HD streaming video, and hey, I already have one.  My friend is trying to talk me into switching, but I haven’t found any good reason to consider another platform at this moment.  When I get the Pi shield, it will be more difficult to switch to a different card.

The Pi is going to provide the SPI interface (LED drivers), UART (a COM port running at logic levels instead of RS232 levels) and single GPIO bits for stuff such as turning on/off the power supply.  There are standard connectors for the solenoid drivers, input drivers and LED driver boards.  There are also spade terminals to provide the higher current voltages such as powering the LEDs for lighting.

There is a bug in the current version of the LED driver board.  It is rather simple to fix it using a cut and a jumper, but the first hard bug in a design is always disappointing.  That board was done very quickly and is the easiest of all the boards, which seems to make it most likely to have a bug.  I’ve re-thought the strategy of that card, and will change the connector so that a single control line can turn off all the LEDs at once.  It will make “blanking” all the lights that much simpler.

Kicad has been updated to a newer version, so many of the design files are also being updated.  As a stretch goal, generic part numbers will be added to all the designs with a python look up script to make ordering assemblies that much easier.  Doubtful that this will be completed before the check-in of the boards.

I noticed some of the headers have pin 1 on the left side of the connector and other have pin 1 on the right side of the connector.  I’m pretty vigilant in making sure I don’t mess stuff like that up.  I finally went through the documentation between Molex and TE Connectivity and they pin out their connectors in opposite directions.  Super annoying.  It means that when I build up boards, I have to make sure that I use an assembly picture to make sure all the connectors are rotated properly.  I added pictures of populated boards to the interface document, and that is the safest way to make sure they are correct.  Here is a link to  the current version of the interface document.  Wiring diagrams were also added to make wiring solenoids and inputs a little bit easier.

That’s all for right now.