An I/O controller for virtual pinball machines: accelerometer nudge sensing, analog plunger input, button input encoding, LedWiz compatible output controls, and more.

Dependencies:   mbed FastIO FastPWM USBDevice

Fork of Pinscape_Controller by Mike R

You are viewing an older revision! See the latest version

Homepage

/media/uploads/mjr/pinscape_no_background_small_L7Miwr6.jpg

This is Version 2 of the Pinscape Controller, an I/O controller for virtual pinball machines. (You can find the original version here.)

In case you haven't heard of the concept before, a "virtual pinball machine" is basically a video pinball game that's built into a real pinball machine body. A TV monitor goes in place of the pinball playfield, and another TV goes in the backbox to serve as the "backglass" display. A computer is hidden inside the cabinet, running pinball emulation software that displays a life-sized playfield on the playfield TV. The cabinet has all of the usual buttons, too, so it not only looks like the real thing, but plays like it too. That's a picture of my own machine to the right. On the outside, it's built exactly like a real arcade pinball machine, with the same overall dimensions and all of the standard pinball cabinet hardware.

There are a few small companies selling pre-built virtual pinball machines, but it also makes a great DIY project. If you have some basic wood-working skills and know your way around PCs, you can build one from scratch. The computer inside is just an ordinary PC running Windows, and all of the pinball emulation can be built out of free, open-source software. In that spirit, the Pinscape Controller is an open-source software/hardware project that offers a no-compromises, all-in-one control center for all of the unique input/output needs of a virtual pinball cabinet. If you've been thinking about building one of these, but you're not sure how to connect a plunger, flipper buttons, lights, nudge sensor, and whatever else you can think of, this project might be what you're looking for.

If you want to know more about DIY cabinet building in general, check out the Cabinet Builders' Forum on vpforums.org.

Downloads

  • Config tool for Windows: Use this tool to set up and configure the controller. Unzip this file into a folder on your PC, then run the PinscapeConfigTool program. It will lead you through the process of setting up a new KL25Z, downloading the firmware, installing the firmware, setting configuration options, and setting up and adjusting your plunger sensor.

Main Features

Plunger: The Pinscape Controller started out as a "digital plunger" controller: a device for attaching a real pinball plunger to the video game software so that you could launch the ball the natural way. This is still, of course, a central feature of the project. The software supports two main types of sensors that provide precise, realistic control for tricky skill shots. One option is a high-resolution optical sensor that works by essentially taking pictures of the plunger as it moves. The other is a potentiometer that works by measuring electrical resistance that varies with the plunger position.

Nudge: The KL25Z (the little microcontroller that the software runs on) has a built-in accelerometer. The Pinscape software uses it to sense when you nudge the cabinet, and feeds the acceleration data to the pinball software on the PC. This turns physical nudges into virtual English on the ball. The accelerometer is quite sensitive and accurate, so we can measure the difference between little bumps and hard shoves, and everything in between. The result is natural and immersive.

Button input: You can wire real pinball buttons to the KL25Z, and the software will translate the buttons into PC input. You have the option to map each button to a keyboard key or joystick button. You can wire up your flipper buttons, Magna Save buttons, Start button, coin slots, operator buttons, and whatever else you need.

Feedback device output: You can also attach "feedback devices" to the KL25Z. Feedback devices are things that create tactile, sound, and lighting effects in sync with the game action. The most popular PC pinball emulators know how to address a wide variety of these devices, so you just need an I/O controller that translates commands from the PC into electrical signals that turn the devices on and off. The Pinscape Controller can fill that role for you.

Expansion Boards

There are two main ways to run the Pinscape Controller: standalone, or using the "expansion boards".

In the basic standalone setup, you just need the KL25Z, plus whatever buttons and plunger sensor you want to attach to it. This mode lets you take advantage of everything the software can do, but you'll need to build your own custom, ad hoc circuits and wiring for certain functions. In particular, if you want to control any feedback devices, you'll need to build some "booster" circuits that amplify the KL25Z logic signals enough to control higher-power devices. The Build Guide has detailed plans for exactly what you need.

The other option is the Pinscape Expansion Boards. This is a companion project, also totally free and open-source, that provides you with Printed Circuit Board (PCB) layouts that are designed specifically to work with the Pinscape software. The PCB designs are fully turn-key - you can send them to a PCB manufacturer and they'll turn them into physical boards for you that can build out with components. The expansion boards organize all of the external connections more neatly than on the standalone KL25Z, but the big thing they bring to the table is lots of high-power outputs. If you opt for the basic expansion board setup, you'll get enough outputs for all of the toys in a really well-equipped cabinet. The expansion board system is extensible, too, so if your ambitions go beyond merely "well" equipped and run to the ridiculously extravagant, the boards can probably handle it.

Expansion Board project page

Documentation

I'm embarrassed to have to say that I haven't yet written the shiny new V2 Build Guide that covers all of the new software features and, especially, the expansion boards. Most of the standalone hardware setup remains the same as in V1, though, so for the time being you can consult the V1 Build Guide, here:

V1 Hardware Build Guide (PDF)

Now that the V2 software is finally ready (May 2016), my next task will be updating the Build Guide. Please check back here (or on the vpforums.net Cabinet Builder forums) from time to time for updates.

Update notes

If you have a Pinscape V1 setup already installed, you should be able to switch to the new version pretty seamlessly. There are just a couple of things to be aware of.

First, the "configuration" procedure is completely different in the new version. Way better and way easier, but it's not what you're used to from V1. In V1, you had to edit the project source code and compile your own custom version of the program. No more! With V2, you simply install the standard, pre-compiled .bin file, and select options using the Pinscape Config Tool on Windows.

Second, if you're using the TSL1410R optical sensor for your plunger, there's a chance you'll need to boost your light source's brightness a little bit. The "shutter speed" is faster in this version, which means that it doesn't spend as much time collecting light per frame as before. The software actually does "auto exposure" adaptation on every frame, so the increased shutter speed really shouldn't bother it, but it does require a certain minimum level of contrast, which requires a certain minimal level of lighting. Check the plunger viewer in the setup tool if you have any problems; if the image looks totally dark, try increasing the light level to see if that helps.

New Features

V2 has numerous new features. Here are some of the highlights...

Dynamic configuration: as explained above, configuration is now handled through the Config Tool on Windows. It's no longer necessary to edit the source code or compile your own modified binary.

Improved plunger sensing: the software now reads the TSL1410R optical sensor about 15x faster than it did before. This allows reading the sensor at full resolution (400dpi), about 400 times per second. The faster frame rate makes a big difference in how accurately we can read the plunger position during the fast motion of a release, which allows for more precise position sensing and faster response. The differences are subtle - the plunger was already pretty precise and responsive - but it should make for more natural action and more precise skill shots.

Keyboard keys: button inputs can now be mapped to keyboard keys. The joystick button option is still available as well, of course. Keyboard keys have the advantage of being closer to universal for PC pinball software: some pinball software can be set up to take joystick input, but nearly all PC pinball emulators can take keyboard input, and nearly all of them use the same key mappings.

Night mode: the output controller has a new "night mode" option, which lets you turn off all of your noisy devices with a single button, switch, or PC command. You can designate individual ports as noisy or not. Night mode only disables the noisemakers, so you still get the benefit of your flashers, button lights, and other quiet devices. This lets you play late into the night without disturbing your housemates or neighbors.

Gamma correction: you can designate individual output ports for gamma correction. This adjusts the intensity level of an output to make it match the way the human eye perceives brightness, so that fades and color mixes look more natural in lighting devices. You can apply this to individual ports, so that it only affects ports that actually have lights of some kind attached.

Yet more USB fixes: I've been gradually finding and fixing USB bugs in the mbed library for months now. This version has all of the fixes of the last couple of releases, of course, plus some new ones. It also has a new "last resort" feature, since there always seems to be "one more" USB bug. The last resort is that you can tell the device to automatically reboot itself if it loses the USB connection and can't restore it within a given time limit.

More Downloads

  • Custom VP builds: I created modified versions of Visual Pinball 9.9 and Physmod5 that you might want to use in combination with this controller. The modified versions have special handling for plunger calibration specific to the Pinscape Controller, as well as some enhancements to the nudge physics. If you're not using the plunger, you might still want it for the nudge improvements. The modified version also works with any other input controller, so you can get the enhanced nudging effects even if you're using a different plunger/nudge kit. The big change in the modified versions is a "filter" for accelerometer input that's designed to make the response to cabinet nudges more realistic. It also makes the response more subdued than in the standard VP, so it's not to everyone's taste. The downloads include both the updated executables and the source code changes, in case you want to merge the changes into your own custom version(s).

    Note! These features are now standard in the official VP 9.9.1 and VP 10 releases, so you don't need my custom builds if you're using 9.9.1 or 10 or later. I don't think there's any reason to use my 9.9 instead of the official 9.9.1, but I'm leaving it here just in case. In the official VP releases, look for the checkbox "Enable Nudge Filter" in the Keys preferences dialog. (There's no checkbox in my custom builds, though; the filter is simply always on in those.)
  • Output circuit shopping list: This is a saved shopping cart at mouser.com with the parts needed for each output driver, if you want to use the LedWiz emulator feature. Note that quantities in the cart are for one output channel, so multiply everything by the number of channels you plan to use, except that you only need one of the ULN2803 transistor array chips for each eight output circuits.
  • Lemming77's potentiometer mounting bracket and shooter rod connecter: Sketchup designs for 3D-printable parts for mounting a slide potentiometer as the plunger sensor. These were designed for a particular slide potentiometer that used to be available from an Aliexpress.com seller but is no longer listed. You can probably use this design as a starting point for other similar devices; just check the dimensions before committing the design to plastic.

Warning: This is not replacement software for the VirtuaPin plunger kit.

If you bought the VirtuaPin kit, please don't install this software. The VP kit happens to use the same microcontroller board, but the rest of its hardware is incompatible. The VP kit uses a different type of sensor for its plunger and has completely different button wiring, so the Pinscape software won't work properly with it.


All wikipages