• Assembly and painting, painting, painting.....

    Cees Meijer05/31/2023 at 20:03 0 comments

    Using standard wood-glue and some clamps, assembly was relatively easy. And as I noticed before: glueing unpainted MDF works great and makes really strong bonds.
    Next comes the painting, and that is a different story. The MDF does a great job in absorbing your paint, and after the first layer of primer, at least two more layers of paint are required to get a decent finish.

    And I thought it would be good idea to re-use some parts of my former Arcade cabinet. Since this already is painted I assumed it would be easier to cover it in an extra layer without the primer. That was incorrect. The new layers actually did not stick at all, probably caused by using a different type of paint (?). I tlooked good, but as soon as I touched it it would simply fall off. So I had to sand it all the way down to the original primer layer, and do it all over again.

    Which extended the originally planned 2 days to a full 4 days for the painting alone. But in the end the result is quite satisfactory.

  • Design and Build the Cabinet

    Cees Meijer05/19/2023 at 16:03 0 comments

    Started by making a design ( in Designspark Mechanical ):

    Since I found some pieces of 8 and 12mm MDF in my shed, these are the only ones I use.

    Now I don't own a sophisticated workshop, and I don't have one of these fancy table-saws that woodworking YouTubers always seem to have. But last year I renovated our stairs and decided to buy a 'track saw', which actually works very nice and allows for some really nice straight cuts.

    Next will be the assembly.

  • The Controller

    Cees Meijer05/18/2023 at 20:50 0 comments

    Adding the buttons. I've done this before. First when I built my Arcade cabinet back in 2013, and later when building a RetroPie Handheld.

    The keys that need to be pressed for Virtual Pinball:

    I'll just focus on the Visual Pinball keys, where the essential ones are :

    Left Shift, Right Shift, Enter, 1, 5 and Q

    This is quite similar to what I used on my Arcade cabinet, so lets start from that. But when I looked at the code ( which was written now almost 10 years ago) it looked almost alien to me. Fortunately the text in the blog indicated that it was based it on someone elses code. So I did not really figure this out all by myself, and thats probably the reason I forgot all about it. As it was written for an original Arduin UNO it was necessary to generate all keyboard codes manually. Something that is no longer required for a Arduino Pro Micro as this supports the 'Keyboard' commands which make sending key codes much easier.

    The nudge and tilt buttons are trickier. It would be great if I could just trigger these from the actual movement of the cabinet, using an accelerometer. Now there's only a Polulu AltIMU 9 DOF Sensor module in my box, which contains (among other things) a LSM303D Accelerometer. Reading its values is easy using the standard library, but it is a bit trickier to actually convert the movement to a key-press. That is to say: a single key press for either a left or right nudge when moving the sensor. The issue with acceleration measurements is that any acceleration in any direction is always immediately followed by one in the opposite direction (if not, your pinball machine would quickly be launched into space..) So simple threshold detection for a left or right push will not work. Therefore I added a counter that starts counting down after the event, and ignores all other measurements during a certain short period. Next problem will be to filter out the static acceleration, caused by gravity. Just tilting the sensor will immediately change the base-value. So I added a high-pass filter which only passes sudden changes and then quickly returns to a value around 0.
    This is the Arduino code (for now) . I will probably have to fine-tune the threshold values once the sensor is mounted in the housing, but thats for later.

    /*
    Virtual Pinball interface
    Read the buttons  and send as keypress.
    Read the LSM303D Accelerometer and use it as a 'nudge 'sensor
    Emulate keyboard presses using an Arduino Micro
    */ 
    // This code is in the public domain.
    // ****************************************************************************
    #include <Wire.h>
    #include <LSM303.h>
    #include "Keyboard.h"
    
    #define ENT            176
    #define UP            218
    #define DWN            217
    #define LFT            216
    #define RGT            215
    #define LSH            129
    #define RSH            133
    
    
    /*
    Keyboard key         Function               Code
    --------------------------------------------------------
    5                    Insert coin            53
    1, 2                 Start (players 1, 2)   49,50
    Arrow keys (U,D,L,R) Move Joystick          218,217,216,215
    Enter                Button 1/Launch Ball   176
    Left Shift           Button 2/Left Flipper  129
    Right Shift          Button 3/Right Flipper 133
    Q                    Button 4/Quit          113  
    Z                    Nudge from Left
    /                    Nudge from Right
    Space                Nudge Forward
    */
    
    const int NR_BUTTONS = 6;
    const int ACCELERATION_THRESHOLD = 10000;
    
    int B = 0;
    int btn_val =0;
    long X_Acc,Y_Acc, Z_Acc;
    long X_Filt;
    long Y_Filt;
    int X_State,Y_State,_Z_State;
    int button_pin[6]=   {10 ,16 ,14 ,15 ,18 ,19 }; // All the Arduino Pin numbers that are used for the buttons
    char button_key[6] = {'5','1','Q',ENT,LSH,RSH}; // The keys they should press
    int buttonState[6]=  {0,0,0,0,0,0};
    int solenoidPin = 20;
    char acc_key[3] = {'Z','/',' '};
    int accState[3]= {0,0,0};
    int accKeyPressed[3] ={0,0,0};
    int WaitTimer=0;
    int i=0;
    float gain = 0.2;
    bool TEST = false;
    
    float xfilt_state=0;float yfilt_state=0;
    
    LSM303 compass;
    
    char report[80];
    
    void setup()
    {
      Serial.begin(9600);
    
       for ( B = 0;B<NR_BUTTONS;B++)
      {
        pinMode( button_pin[B], INPUT_PULLUP );
      }
      pinMode(solenoidPin,OUTPUT);
      Wire.begin();
      if ( compass.init(LSM303::device_D,LSM303::sa0_high) )
    ...
    Read more »

  • First steps: Proof Of Concept

    Cees Meijer05/18/2023 at 18:25 0 comments

    An important part of the project: first try if it actually works. So I hooked up a 24" monitor, a 15" laptopscreen (with an LCD interface board) and a leftover computer to see if I could get it to run as a pinball machine.

    And that was a little harder that expected. There are many, many guides on the internet, but most are incomplete or they refer to old software versions. Also there is a lot to install and configure.

    Finally I found the excellent video from 'Way of the Wrench' where he explains how to use the 'Baller Installer' to get everything up and running. Now I'm not a great fan of YouTube videos as a guide ( I'd rather read the desceription at my own pace) but this seemed the best way to get started. And yes, every time I skipped a section because I was impatient, I failed. So you should really follow every step very carefully.

    It's also a good idea to join the 'Virtual Pinball Forum'. You'll have to create an account, the forum layout looks like it was designed in the 90s, but the info and downloads are very useful.


    And yes, in the end it really works ! The image shows the 'Leprachaun King' table which is included in the install. Which is even decently playable using the keyboard.
    Now it's time to build the actual cabinet.