Jump to content



Photo
- - - - -

Using DOFLinx to get Xbox Controller Rumble with VPX

DOFLinx Xbox Rumble

  • Please log in to reply
16 replies to this topic

#1 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,601 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 12 May 2019 - 06:58 AM

This guide will explain how to get VPX, perhaps in VR mode, to deliver Xbox rumble through something like the Teensy as a PInSim emulating an Xbox controller for less than $50 (Aussie money). https://www.tested.c...inball-machine/

 

The design of this solution is to use as much as we can in the standard way that VPX, DOF, etc works but achieve the desired outcome of getting standard VPX tables to make the rumble motors on the Teensy PinSim run. The only addition items required will be a PInscape controller and some minor electronics.

 

In normal operation VPX runs a table that via PinMAME, B2SServer and DOF drives toys on an output controller (LEDWiz, Pinscape, PinControl, PacLED64, etc) such as solenoids for slingshots, bumpers, etc.  In a VR cabinet there is usually no output controller as there are no toys.

 

What we will do here is add an output controller and setup the toys that you want to drive the rumble motors but not actually install the physical toys.  Instead we’ll feed the output signal for those toys back to the Pinscape controller as joystick inputs, and use those inputs to trigger DOFLinx, which will in turn run the rumble motors in any connected Xbox controller.  Given that the PinSim Teensy device emulates and Xbox controller, then we can run the rumble motors when any standard output toy on a standard VPX table is triggered.

Different toys can be fed back into different inputs and hence run different either the left or right rumble motor for different times and intensities, all chosen by you.  With a Pinscape we can easily “loop back” the standard 10 solenoid setupinpact given a standard KL25X board with no additions (Pinscape hardware), we can easily “loop back” over 30 toys.

 

There is no reason that you must use a Pinscape.  If you already have an output controller and an input, either all in one such as a Pincontrol2 or separately such as a LEDWiz and iPac, then with some slightly different electronics this will all work with DOFLinx.  I’m happy to assist with circuit design required to achieve this.  Also, you can have actual toys, again it may just make a minor difference to the electronics, but it can be done – I’ve done it.

 

The logic of the solution is shown diagrammatically below.

 

rumbleforpinsim_t.png

 

This guide will setup five different rumble triggers and effects.  These will cover 3 x bumpers plus the left and right slingshot.  You will need to adjust for your ports and configuration to reflect your setup.  The setup is;

 

rumbleguidetable_t.png

 

Prerequisites

  • VPX installed and running with at least one table
  • DOF R3++
  • DOFLinx
  • A Pinscape

 

Setting things up

  1. Configure DOF so that the toys you want to trigger rumble have an output on the Pinscape (see example below)
  2. Install the electronics so that the configured output loops back to the desired input button
  3. Run DOFLinx with DEBUG=1
  4. Use the “Test Output -> Input Loopback” option to ensure that your toy output device / port “presses” the required joystick button
  5. Edit your DOFLinx.INI file to add the necessary KEY_TO_XBOX_RUMBLE= parameters (see below)

 

KEY_TO_XBOX_RUMBLE=J0101,1,L,60000,1000,J0102,1,R,60000,1000,J0103,1,L,25000,800,J0104,1,L,25000,800,J0105,1,L,25000,800

 

My setup in the config tool

 

mypinscapesetup_t.png

 

My setup of the relevant Pinscape outputs

 

mypinscapeoutputsforrumble_t.jpg

 

My setup of the relevant Pinscape inputs

 

mypinscapeinputsforrumble_t.jpg

 

The electronics

 

The Pinscape outputs are low (0v) when off and high (3V3) then on.  Pinscape buttons are high (3V3) when unpressed and low (0V) when pressed.  Given that we want to “press” a key when the output is high we need a low output when we have a high input, and also a high output when we have a low input.  Fortunately, this is very common and there are super cheap options to achieve this.

To get those inverted input / outputs we will use an integrated circuit called an inverter.  Given an inverter has one input and one output they are usually packaged as multiple inverters in one integrated circuit.  In this case we’ll use a common one being a 4049, this has six inverters and comes in low power varieties so we can power it directly from the Pinscape.  The 4049 is known therefore as a hex inverter.  So. with one 4049 integrated circuit we could setup 6 toy outputs to button inputs.  I you wanted to tun all 10 standard solenoid toys as different Xbox controllers / motors / speeds. Then just get 2 x 4049 integrated circuits – easy!

 

rumblepinscapeand4049_t.png

 

Thanks mjr for the Pinscape, a super cheap and easy way the achieve this outcome without developing a new software stack, architecture. Etc.  Just using the defacto community standards we have and keeping VPX tables standard and pure.

 


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#2 otro5

otro5

    Enthusiast

  • Members
  • PipPipPip
  • 65 posts

  • Flag: ---------

  • Favorite Pinball: Lady Luck (1976)

Posted 25 August 2019 - 11:06 AM

Dear,

 

I have the Jeremy´s Teensy as a PInSim, working with VPX VR. I was reading your tutorial to try to works rumbles. I have a doubt, Teensy goes to PC with USB and Pinscape?

 

Thanks a lot



#3 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,601 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 25 August 2019 - 12:18 PM

Dear,

 

I have the Jeremy´s Teensy as a PInSim, working with VPX VR. I was reading your tutorial to try to works rumbles. I have a doubt, Teensy goes to PC with USB and Pinscape?

 

Thanks a lot

 

Sorry, I don't quite understand your question.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#4 otro5

otro5

    Enthusiast

  • Members
  • PipPipPip
  • 65 posts

  • Flag: ---------

  • Favorite Pinball: Lady Luck (1976)

Posted 25 August 2019 - 06:17 PM

The Teensy  (Pinsim) that has the control of the buttons (flipper, plunger,rumbles) has conected to my PC with a USB. In your solution is necessary connect this USB to the Pinswcape output side and the Pinscape input side to the PC?.

 

Thanks a lot



#5 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,601 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 25 August 2019 - 10:57 PM

The PinSim still connects as per normal to the PC via USB.  DOFLInx recognises the PinSim as an Xbox controller and can drive the rumble controls.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#6 otro5

otro5

    Enthusiast

  • Members
  • PipPipPip
  • 65 posts

  • Flag: ---------

  • Favorite Pinball: Lady Luck (1976)

Posted 26 August 2019 - 06:27 AM

Sorry,

 

Additionally I need to conect to my PC (USB) the electronics ( Pinscape+inverter)?



#7 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,601 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 26 August 2019 - 08:38 AM

Sorry,

 

Additionally I need to conect to my PC (USB) the electronics ( Pinscape+inverter)?

 

Yes, the Pinscape connects to your PC via USB as a Pinscape normally does.  You would also require the DOF R3++ framework and DOFLinx.  The 4049 inverter chip is wired up to the Pinscape inputs and outputs.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#8 xavior38

xavior38

    Hobbyist

  • Members
  • PipPip
  • 31 posts

  • Flag: United States of America

  • Favorite Pinball: Star Trek

Posted 19 November 2020 - 04:47 PM

Sorry to resurrect an old thread, but I have been playing a lot with the Xbox rumble feature via DOFLinx and I was wondering if I can do this workaround using just my KL25Z without any wiring to get this to work on VPX?

 

Could x360ce catch the output from the pinscape and essentially reroute it like this?


Edited by xavior38, 19 November 2020 - 04:54 PM.


#9 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,601 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 19 November 2020 - 09:28 PM

Sorry to resurrect an old thread, but I have been playing a lot with the Xbox rumble feature via DOFLinx and I was wondering if I can do this workaround using just my KL25Z without any wiring to get this to work on VPX?

 

Could x360ce catch the output from the pinscape and essentially reroute it like this?

 

I don't believe so, but feel free to experiment.  I'm happy to add what I know.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#10 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,859 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 20 November 2020 - 07:02 AM

X360ce can only see output from a game or some program that is sending either Xinput or Direct Input feedback data, not a piece of hardware


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#11 xavior38

xavior38

    Hobbyist

  • Members
  • PipPip
  • 31 posts

  • Flag: United States of America

  • Favorite Pinball: Star Trek

Posted 23 November 2020 - 03:10 PM

 

Sorry to resurrect an old thread, but I have been playing a lot with the Xbox rumble feature via DOFLinx and I was wondering if I can do this workaround using just my KL25Z without any wiring to get this to work on VPX?

 

Could x360ce catch the output from the pinscape and essentially reroute it like this?

 

I don't believe so, but feel free to experiment.  I'm happy to add what I know.

 

 

Shucks. 

 

Any chance I can add script code to VPX manually to trigger Doflinx?

 

Great work btw, I love using the xbox controller feedback on FX3 and FP for my makeshift "cab". This is a way more affordable/easy way to add feedback and is much appreciated!



#12 DDH69

DDH69

    Pinball Wizard

  • Platinum Supporter
  • 3,601 posts
  • Location:DOFLinx HQ, Adelaide

  • Flag: Australia

  • Favorite Pinball: Monster Bash

Posted 23 November 2020 - 10:33 PM

 

Any chance I can add script code to VPX manually to trigger Doflinx?

 

 

There is nothing currently in place to allow this.  In theory DOFLinx could accept external messages to run Xbox rumble but currently does not.


DOFLinx
Contributions for equipment to help with ongoing DOFLinx development can be made here

#13 xavior38

xavior38

    Hobbyist

  • Members
  • PipPip
  • 31 posts

  • Flag: United States of America

  • Favorite Pinball: Star Trek

Posted 25 November 2020 - 03:40 PM

 

 

Any chance I can add script code to VPX manually to trigger Doflinx?

 

 

There is nothing currently in place to allow this.  In theory DOFLinx could accept external messages to run Xbox rumble but currently does not.

 

 

Gotcha. If you ever add such a functionality, I'd love to test it out for ya ^^



#14 xavior38

xavior38

    Hobbyist

  • Members
  • PipPip
  • 31 posts

  • Flag: United States of America

  • Favorite Pinball: Star Trek

Posted 23 March 2021 - 03:36 PM

Looks like there might be some movement from VPX development regarding XBOX controller rumbling: Controller feedback! - Visual Pinball VR Discussion - VPForums.org

 

Can DOFLinx take advantage of whatever the devs are using to add rumble to VPX?



#15 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,859 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 23 March 2021 - 06:16 PM

Looks like there might be some movement from VPX development regarding XBOX controller rumbling: Controller feedback! - Visual Pinball VR Discussion - VPForums.org

 

Can DOFLinx take advantage of whatever the devs are using to add rumble to VPX?

 

I could be wrong, but i think VR is just directly using Dinput or Xinput, at least that was the impression i got

and that would not need doflinx at all.

 

If you could make a vbs with functions like below, you could have controller feedback on any table

you would have to edit the table of course unless you get fancier and detect what is bumper slingshot kicker flipper etc

import ctypes

# Define necessary structures
 class XINPUT_VIBRATION(ctypes.Structure):
    _fields_ = [("wLeftMotorSpeed", ctypes.c_ushort),
                ("wRightMotorSpeed", ctypes.c_ushort)]

xinput = ctypes.windll.xinput1_1  # Load Xinput.dll

# Set up function argument types and return type
XInputSetState = xinput.XInputSetState
XInputSetState.argtypes = [ctypes.c_uint, ctypes.POINTER(XINPUT_VIBRATION)]
XInputSetState.restype = ctypes.c_uint

# Now we're ready to call it.  Set left motor to 100%, right motor to 50%
# for controller 0
vibration = XINPUT_VIBRATION(65535, 32768)
XInputSetState(0, ctypes.byref(vibration))

# You can also create a helper function like this:
def set_vibration(controller, left_motor, right_motor):
    vibration = XINPUT_VIBRATION(int(left_motor * 65535), int(right_motor * 65535))
    XInputSetState(controller, ctypes.byref(vibration))

# ... and use it like so
import time
set_vibration(0, 0.5, 0.5)
time.sleep(5)
set_vibration(0, 0, 0)

If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#16 mrhector

mrhector

    Hobbyist

  • Members
  • PipPip
  • 11 posts
  • Location:Canada

  • Flag: El Salvador

  • Favorite Pinball: Tron, Theatre of Magic, Funhouse

Posted 05 April 2021 - 04:17 AM

On the VR version of VPX they added blanket controller rumble support that can be toggled on or off. The initial implementation just added some code to trigger rumble when the bumpers are hit. So far it hasn't been added for flippers, slingshot etc. The nice thing is nothing needs to be done to the tables, it's at the vpx level.

#17 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,859 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 05 April 2021 - 06:21 AM

On the VR version of VPX they added blanket controller rumble support that can be toggled on or off. The initial implementation just added some code to trigger rumble when the bumpers are hit. So far it hasn't been added for flippers, slingshot etc. The nice thing is nothing needs to be done to the tables, it's at the vpx level.

 

Be kind of nice to adapt that to be used in the script

 

vibrate motor, frequency, duration


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow






Also tagged with one or more of these keywords: DOFLinx, Xbox, Rumble