Jump to content



Photo
* * * - - 2 votes

Nudge Setup: Analog and Digital Nudge Setup for Cabs

Tutorials

  • Please log in to reply
23 replies to this topic

#1 uberpinball

uberpinball

    Enthusiast

  • Platinum Supporter
  • 449 posts

  • Flag: United States of America

  • Favorite Pinball: Gorgar, Attack from Mars, MM, MB, Pinbot...

Posted 07 May 2013 - 04:36 PM

I’ve put together a setup guide for adding nudging to your Pinball Cab based on my experience and the various help I’ve received across the forum. I thought instead of copying and pasting it in every new thread, I’d just link back to this one if I find someone asks about nudge setup.

 

I cover both Analog and Digital nudge setup. Feel free to ask any detailed questions as needed.

 

Setup for > Analog Nudge with Accelerometer

1) Position your device in a location that will allow nudges to be sensed properly. Closer to your hands is better.
Example: The Nanotech PBW board can be positioned in the front of the cab under the lockdown bar on a piece of wood, that is attached like a shelf to the front of the cab. The Nanotech board can then be attached to the small 'shelf' board and easily accessed by taking off the lockdown bar.

 

2) To calibrate the board, instead of relying on basic Windows calibration, grab this DXTweak tool, it will allow you to get perfect calibration.For newer OS’s you can use the DiView but DXTweak will work on newer OSs some of the time.

3) Grab this table for testing. Its a zero slope table.

4) Start adjusting the mid values of the X and Y axis, choose the proper tabs on top. You are trying to get the meter as close to center as possible for each X and Y axis. Keep the low and high values in line with your adjustment of mid, move mid up 5, you move low and high up 5. Make sure you don't have the x and y Axis to tight in DXTweak/DiView. By this I mean...make sure you are at least 300-500 from center each way. So if X Axis mid is 2000, the min should be 1500 and max 2500. The same for the Y axis. The closer you get to mid, the tighter and less forgiving the nudge is. If it's too tight, the chip will start to fight itself causing the jitters and ball wandering.

5) Start the zero slope test table in VP and see how the ball reacts. Your goal is to have the ball standing still when the table starts. Go back and forth between the DXTweak/DiView tool and restarting the zero slope table. You need to restart the table after each DXTweak/DiView tweak. You can also test the nudges on the table.

6) If you still find a slight wander in the zero slope table, adjust the deadzone. In VP, go to Preferences>Keys and check your gains and deadzone. I'm at 500% for x and y, and a 3% deadzone. The deadzone will give the ball a buffer before it acts to a nudge.

 

 

Setup for > Digital Nudge with Mercury switches or Plumbob or other tilt sensing device

1) Position your device in a location that will allow nudges to be sensed properly. Closer to your hands is better.

Example: Mercury switches positioned close to the flippers, one on each side, and under the lockdown bar for the center nudge is an example of good placement. Mercury switches are positioned with the wires pointing towards the cabinet walls as a nudge will 'pull' the mercury into the contacts, much like tapping a Ketchup bottle on the top to get the Ketchup to flow toward the cap. Good Mercury switches can be purchased here.

 

2) Wire the device into your keyboard controller(iPac, PBW board, etc) so that it maps to a key.

Example: Mercury switches can have one wire be ground (one wire from each switch wired together and run to ground on the controller), and one wire from each switch would go to it's own input on the keyboard controller.

 

3) Map the key to the proper nudge key in VP (or FP). In VP go to Preferences>Keys and you use the drop down for Z / and Space(the default nudge keys) and select the keyboard controller input you used from the list.

 

4) Test with the zero slope table and adjust the device by moving, bending, or shifting it's location until you get the desired nudge. Example: Mercury switches are normally attached to a bendable metal bracket which once mounted are intended to be bent for fine tuning.

 

5) With these hardware based devices you can experience rebounding where the device contacts or bounces on the switch multiple times. This is a rebound effect. This can be solved with custom nudge script. In the newer core.vbs script, you have the ability to add an external file that holds custom nudge code that overrides core.vbs nudge code. You simply create a file called NudgePlugin.vbs and drop it in the same folder where core.vbs is on your system(Tables folder for some). For some really good nudge code to add to your new file, I point you to Blur's code below:

 

You can set TiempoFiltro = 2000 to eliminate rebound nudges caused by your device.

You can can set sensitivity of the nudges with setting both p and m sensitivity variables.

You can set the force of your nudge and the return nudge chance:

- if you set aForce = 2 : ReturnPercent = 0 you will hardly ever lose the ball

- if you set aForce = 1 : ReturnPercent = 100 you will have a challenge as nudging will be less forceful and will have a return nudge all the time

 

You can see the other variables offered and change them as you like.

'----------------------
' Alternative Nudge v2
'	 by Blur
'----------------------

' For use with core.vbs version 3.41 or greater
' Move into folder with other scripts

Option Explicit

' cvpmNudge2 (Object = vpmNudge)
'   Hopefully we can add a real pendulum simulator in the future
'   (Public)  .TiltSwitch    - set tilt switch
'   (Public)  .Sensitivity   - Set tiltsensitivity (0-10)
'   (Public)  .NudgeSound  - set nudge sound, has to be in table
'   (Public)  .TiltSound  - set tilt sound, has to be in table
'   (Public)  .NudgeMusic  - mp3 file with nudge sound in music dir
'   (Public)  .TiltMusic  - mp3 file with tilt sound in music dir
'   (Public)  .TiltObj	   - Set objects affected by tilt
'   (Public)  .DoNudge dir,power - Nudge table
'   (Public)  .SolGameOn	 - Game On solenoid handler
'   (Private) .Update	    - Handle tilting

class cvpmNudge2
Private mCount, mSensitivity, pSensitivity, mNudgeTimer, mSlingBump, mForce
Private mFilterCount, mReturnCount, mReturnDir, mReturnForce
Public TiltSwitch
Private NudgeInterval, TiempoFiltro, ReturnTime, ReturnPercent
Public NudgeSound, TiltSound, NudgeMusic, TiltMusic

Private Sub Class_Initialize
  ' set defaults for all tables here or change them from your table script
  NudgeInterval = 1000  ' time in ms after which nudge count goes down
  TiempoFiltro = 200  ' nudge filtering time in ms
  ReturnTime = 200  ' time after which return force bumps in
  pSensitivity = 5  ' preferred sensitivity overrides table settings
  mSensitivity = 5  ' default sensitivity used if not defined in table
  NudgeSound = ""   ' sound has to be in table
  TiltSound = ""   ' sound has to be in table
  NudgeMusic = "nudge.mp3"' put this file in music dir
  TiltMusic = "tilt.mp3" ' put this file in music dir
  'StartShake    ' uncomment to enable table shaking
  PlayMusic NudgeMusic ' plays music to avoid stutter on first run
  mFilterCount = 0 : mReturnCount = 0 : mReturnDir = 0 : mReturnForce = 0
  mCount = 0 : TiltSwitch = 0 : vpmTimer.AddResetObj Me
End sub

Private Property Let NeedUpdate(aEnabled) : vpmTimer.EnableUpdate Me, False, aEnabled : End Property

Public Property Let TiltObj(aSlingBump)
  Dim ii
  ReDim mForce(vpmSetArray(mSlingBump, aSlingBump))
  For ii = 0 To UBound(mForce)
   If TypeName(mSlingBump(ii)) = "Bumper" Then mForce(ii) = mSlingBump(ii).Force
   If TypeName(mSlingBump(ii)) = "Wall" Then mForce(ii) = mSlingBump(ii).SlingshotStrength
  Next
End Property

Public Property Let Sensitivity(aSens)
  If pSensitivity = 0 Then mSensitivity = (10-aSens)+1 Else mSensitivity = pSensitivity
End property

Public Sub DoNudge(ByVal aDir, ByVal aForce)
  If mFilterCount > 0 and mFilterCount < TiempoFiltro\conTimerPulse then exit sub
  mFilterCount = 1
  mReturnCount = 1
  ' preferred angles, force and return force are defined in next lines, set them as you like
  If aDir < 5 or aDir > 355 Then aDir = 180 : aForce = 1.25 : ReturnPercent = 100
  If aDir >= 5 and aDir <= 175 Then aDir = 90 : aForce = 1 : ReturnPercent = 100
  If aDir >= 185 and aDir <= 355 Then aDir = 270 : aForce = 1 : ReturnPercent = 100
  aDir = aDir + (Rnd-0.5)*15*aForce : aForce = (0.6+Rnd*0.8)*aForce
  Nudge aDir, aForce
  If NudgeSound <> "" Then PlaySound NudgeSound Else PlayMusic NudgeMusic
  mReturnDir = aDir + 180
  mReturnForce = aForce * ReturnPercent / 100
  If TiltSwitch = 0 Then Exit Sub ' If no switch why care
  mCount = mCount + aForce * 1.2
  If mCount > mSensitivity + 10 Then mCount = mSensitivity + 10
  If mCount >= mSensitivity Then vpmTimer.PulseSw TiltSwitch : If TiltSound <> "" Then PlaySound TiltSound Else PlayMusic TiltMusic
  NeedUpdate = True
End sub

Public Sub Update
  if mFilterCount > 0 then mFilterCount = mFilterCount + 1
  If mFilterCount > TiempoFiltro\conTimerPulse Then mFilterCount = 0
  If mReturnCount > 0 Then mReturnCount = mReturnCount + 1
  If mReturnForce > 0 and mReturnCount > ReturnTime\conTimerPulse Then mReturnCount = 0 : Nudge mReturnDir, mReturnForce
  If mCount > 0 Then
   mNudgeTimer = mNudgeTimer + 1
   If mNudgeTimer > NudgeInterval\conTimerPulse Then
    If mCount > mSensitivity+1 Then mCount = mCount - 1 : vpmTimer.PulseSw TiltSwitch
    mCount = mCount - 1 : mNudgeTimer = 0
   End If
  Else
   mCount = 0
  End If
  If mCount = 0 and mFilterCount = 0 and mReturnCount = 0 Then NeedUpdate = False
  'msgbox mCount & " " & mFilterCount & " " & mReturnCount & " " & mNudgeTimer
End Sub

Public Sub Reset : mCount = 0 : End Sub

Public Sub SolGameOn(aEnabled)
  Dim obj, ii
  If aEnabled Then
   ii = 0
   For Each obj In mSlingBump
    If TypeName(obj) = "Bumper" Then obj.Force = mForce(ii)
    If TypeName(obj) = "Wall" Then obj.SlingshotStrength = mForce(ii)
    ii = ii + 1
   Next
  Else
   For Each obj In mSlingBump
    If TypeName(obj) = "Bumper" Then obj.Force = 0
    If TypeName(obj) = "Wall" Then obj.SlingshotStrength = 0
   Next
  End If
End Sub
End Class

 

Other Tips

If you are setting up digital nudge and have an accelerometer board like the Nanotech PBW board that has both keyboard inputs and nudge, you will want to turn off the analog nudge. To completely turn off the analog nudge go to VP > Preferences>Keys and uncheck the Enable Analog Nudge box. THEN change the x and y gains to 0 and the deadzone to 100%. This completely disables the accelerometer within VP.

 

I will add/cleanup this post as needed.


Edited by uberpinball, 29 July 2013 - 10:45 PM.

Seeds of War, Piles of Skulls

<OO>  Pinball Cab  <OO>  ArcadeX Mame Cab  <OO>


#2 hotdp

hotdp

    Enthusiast

  • Members
  • PipPipPip
  • 434 posts

  • Flag: Denmark

  • Favorite Pinball: T2

Posted 08 May 2013 - 06:24 AM

Thank you for helping.

So the mission for the demo table is that the ball should stay still.

If I nudge the right side of the cabinet, should the ball just "shake" or should it start rolling to the left corner?

 

Currently no matter what side I nudge my cabinet the ball will roll to the right side?

 

I am still dreaming of a video with the perfect scenario :-)



#3 uberpinball

uberpinball

    Enthusiast

  • Platinum Supporter
  • 449 posts

  • Flag: United States of America

  • Favorite Pinball: Gorgar, Attack from Mars, MM, MB, Pinbot...

Posted 08 May 2013 - 03:36 PM

Thank you for helping.
So the mission for the demo table is that the ball should stay still.
If I nudge the right side of the cabinet, should the ball just "shake" or should it start rolling to the left corner?
 
Currently no matter what side I nudge my cabinet the ball will roll to the right side?
 
I am still dreaming of a video with the perfect scenario :-)
 
Not sure a video will help. The ball should be standing perfectly still on table start. If it's not, you will need to check the calibration again.
 
If you could post your min mid max values for X and Y, it may help me see what the issue is. It sounds like you have the values to tight, to close to center.

Edited by uberpinball, 08 May 2013 - 03:46 PM.

Seeds of War, Piles of Skulls

<OO>  Pinball Cab  <OO>  ArcadeX Mame Cab  <OO>


#4 rockyrocket

rockyrocket

    Enthusiast

  • Silver Supporter
  • 145 posts
  • Location:Bristol,UK

  • Flag: United Kingdom

  • Favorite Pinball: xenon

Posted 19 May 2013 - 08:16 PM

Anyone know what the test table is in this old vid of DXTweak?.

Thanks in advance.



#5 uberpinball

uberpinball

    Enthusiast

  • Platinum Supporter
  • 449 posts

  • Flag: United States of America

  • Favorite Pinball: Gorgar, Attack from Mars, MM, MB, Pinbot...

Posted 19 May 2013 - 08:39 PM

Anyone know what the test table is in this old vid of DXTweak?.
Thanks in advance.


Curious, not sure what he's calibrating as this table has a slope. You don't want the ball moving when you have perfect calibration. And with the zero slope table you can perfectly test right, left, and center nudge.

Seeds of War, Piles of Skulls

<OO>  Pinball Cab  <OO>  ArcadeX Mame Cab  <OO>


#6 zeenon

zeenon

    Enthusiast

  • Platinum Supporter
  • 217 posts
  • Location:Somerville, NJ

  • Flag: United States of America

  • Favorite Pinball: Attack from Mars

Posted 04 July 2013 - 02:31 AM

Can someone post a location download the zero slope table, the above link is not valid. Z

#7 uberpinball

uberpinball

    Enthusiast

  • Platinum Supporter
  • 449 posts

  • Flag: United States of America

  • Favorite Pinball: Gorgar, Attack from Mars, MM, MB, Pinbot...

Posted 29 July 2013 - 10:46 PM

Moved all the files to my hosting site. Links should be good now.


Seeds of War, Piles of Skulls

<OO>  Pinball Cab  <OO>  ArcadeX Mame Cab  <OO>


#8 slashbot

slashbot

    Enthusiast

  • Members
  • PipPipPip
  • 337 posts
  • Location:Ghent

  • Flag: Belgium

  • Favorite Pinball: Scared stiff on vp,Highspeed 2,Fish Tales,T2,Circus Voltaire,Congo

  • 360 Gamer Tag: slashbot

Posted 30 November 2013 - 04:53 PM

usefull, thanks for making this guide.


r0sqir-4.pngslashbot.jpgttzReplay.gif

Cabinet Bally Radical - setup 40'' Sony Led for playfield, 32''Led LG for Backglass, LCD screen for DMD, running LEDwiz32 12v setup with DOF and boosterboard to power toys 2x Siemens contactors for flipper feedback -2e audiocard + subwoofer setup to emulate VP flippersounds and vibration in cab (sounds fantastic) 1x red police light flasher.Lots of 5050 RGB Ledstrips bottom,back,top. 1x HUD-G for digital nudge all

Check my Visual Pinball cabinet highscores: HERE

TPA artwork resources gallery here


#9 CdnGamer

CdnGamer

    Neophyte

  • Members
  • Pip
  • 8 posts
  • Location:Vancouver Island

  • Flag: Canada

  • Favorite Pinball: MM

Posted 24 January 2014 - 03:48 AM

Very useful indeed, thanks a heap for posting this! I'm getting ready to start my first build and I need all the info I can gather.



#10 nabby2020

nabby2020

    Hobbyist

  • Members
  • PipPip
  • 13 posts

  • Flag: United States of America

  • Favorite Pinball: Attack from Mars

Posted 24 March 2014 - 02:53 AM

How do you configure the uhid-g to digital nudges? I set the j6 group of pins to their respective axis and then a keystroke and got unlimited keys that wouldn't stop. Analog is just to jittery and unpredictable to calibrate. Is it just worth switching to mercury switches?

#11 mikey284

mikey284

    Hobbyist

  • Members
  • PipPip
  • 22 posts

  • Flag: United States of America

  • Favorite Pinball: homerun

Posted 26 March 2014 - 11:11 PM

Doe's DIView save settings. Or do you have to set it up each time you boot vp or future pinball?

Thanks

#12 schwabinger

schwabinger

    Hobbyist

  • Platinum Supporter
  • 28 posts

  • Flag: Germany

  • Favorite Pinball: Concorde, Barbarella, Full, Yukon, Abra Cadabra, Strange Worlds, Joker Poker, Big Valley, Dipsy Doodle

Posted 19 April 2015 - 07:22 PM

First of all - thanks for that tutorial. It helped me a lot!

 

I implemented a digital nudge mechanism using an Arduino Leonardo microcontroller and an accelerometer. Nugding from the left pushes the table to the right (ball jumps to the left, as the table is not moved actually). The microcontroller acts as a keyboard and sends the key-codes for left, right and front nudge ...

 

That works quite well. The rebounding effect as described above is taken care of by the controller's code: Once a nudge is detected, it as to wait for 400 ms till the next nudge signal can be sent.

 

I implemented Blur's nudge code as given above. As far as I see it those settings should be valid for all tables that I use.

 

But still, they react differently to nudging. Some tilt very fast (like Genie) some almost never like Grid Iron. Some do not tilt at all  (Tables that I run with VP 9.15).

 

So two questions:

 

- Can an individual configuration in a table script override the settings in NudgePlugin.vbs?

- How does the nudge counter work? Is the maximum of allowed nudges really 10?

 

Thanks for your help.

 

Greetings,

Schwabinger


Edited by schwabinger, 19 April 2015 - 07:28 PM.


#13 BigBoss

BigBoss

    Pinball Fan

  • VP Dev Team
  • PipPipPipPip
  • 749 posts

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

  • Favorite Pinball: Attack From Mars, Metallica, Theatre Of Magic, Shadow, Star Trek

Posted 19 April 2015 - 08:25 PM

If you have an arduino with an accelerometer, why not implement an analog nudge?

#14 schwabinger

schwabinger

    Hobbyist

  • Platinum Supporter
  • 28 posts

  • Flag: Germany

  • Favorite Pinball: Concorde, Barbarella, Full, Yukon, Abra Cadabra, Strange Worlds, Joker Poker, Big Valley, Dipsy Doodle

Posted 20 April 2015 - 04:51 PM

I would love to do that but have no idea about what kind of values I would have to transfer from my Arduino Leonardo to my PC.

 

The accelerometer returns numerical values; at the moment I use a threshold for left, right and front nudge. If the reading goes beyond that threshold, I send the character for left, right or front nudge.

 

This is easy to do because a Leonardo can act as a USB keyboard.



#15 PinballShawn

PinballShawn

    Enthusiast

  • Members
  • PipPipPip
  • 343 posts
  • Location:Pittsburgh, Pa.

  • Flag: United States of America

  • Favorite Pinball: Changes Daily

Posted 15 June 2015 - 04:13 AM


 

5) With these hardware based devices you can experience rebounding where the device contacts or bounces on the switch multiple times. This is a rebound effect. This can be solved with custom nudge script. In the newer core.vbs script, you have the ability to add an external file that holds custom nudge code that overrides core.vbs nudge code. You simply create a file called NudgePlugin.vbs and drop it in the same folder where core.vbs is on your system(Tables folder for some). For some really good nudge code to add to your new file, I point you to Blur's code below:

 

You can set TiempoFiltro = 2000 to eliminate rebound nudges caused by your device.

You can can set sensitivity of the nudges with setting both p and m sensitivity variables.

You can set the force of your nudge and the return nudge chance:

- if you set aForce = 2 : ReturnPercent = 0 you will hardly ever lose the ball

- if you set aForce = 1 : ReturnPercent = 100 you will have a challenge as nudging will be less forceful and will have a return nudge all the time

 

 

I get what I'm reading, but how does one 'create the file'? I have a tilt bob setup, which I like, but I do get the double tap when I'm really going at it. I'd like to try this script out and see if it works.



#16 cmiller1

cmiller1

    Hobbyist

  • Members
  • PipPip
  • 22 posts

  • Flag: United States of America

  • Favorite Pinball: Goonies

Posted 01 June 2016 - 12:38 AM

Why do I not have the option to turn nudge on in any version of vp? I go to preferences>keys and there is only a list of keys/buttons that are used and what keyboard button each button is.

#17 PinballFan82

PinballFan82

    Enthusiast

  • Silver Supporter
  • 69 posts

  • Flag: United States of America

  • Favorite Pinball: Space Shuttle

Posted 26 October 2016 - 08:27 PM

I have a used VP that I bought and came with an accelerometer.  For some reason, though, I can't get it to work properly and I just assume it's an issue inside Visual Pinball.

 

How do I get Visual Pinball to recognize that the accelerometer is attached?

 

Any thoughts/suggestions would be helpful.

 

Thanks!



#18 Binkles

Binkles

    Enthusiast

  • Members
  • PipPipPip
  • 69 posts

  • Flag: Australia

  • Favorite Pinball: Funhouse

Posted 18 June 2017 - 03:08 AM

First of all - thanks for that tutorial. It helped me a lot!

 

I implemented a digital nudge mechanism using an Arduino Leonardo microcontroller and an accelerometer. Nugding from the left pushes the table to the right (ball jumps to the left, as the table is not moved actually). The microcontroller acts as a keyboard and sends the key-codes for left, right and front nudge ...

 

That works quite well. The rebounding effect as described above is taken care of by the controller's code: Once a nudge is detected, it as to wait for 400 ms till the next nudge signal can be sent.

 

I implemented Blur's nudge code as given above. As far as I see it those settings should be valid for all tables that I use.

 

But still, they react differently to nudging. Some tilt very fast (like Genie) some almost never like Grid Iron. Some do not tilt at all  (Tables that I run with VP 9.15).

 

So two questions:

 

- Can an individual configuration in a table script override the settings in NudgePlugin.vbs?

- How does the nudge counter work? Is the maximum of allowed nudges really 10?

 

Thanks for your help.

 

Greetings,

Schwabinger

 

Hiya,

 

Did you ever get this sorted - and do you have the sketch that can be shared?



#19 mase

mase

    Hobbyist

  • Silver Supporter
  • 20 posts

  • Flag: Germany

  • Favorite Pinball: no special

Posted 12 July 2018 - 03:18 PM

Can I somehow disable the visual nudging effect in VP? I mean that jittering.



#20 gtxjoe

gtxjoe

    VPF Veteran

  • VIP
  • 5,061 posts

  • Flag: United States of America

  • Favorite Pinball: Medieval Madness, AbraCadabra



Contributor

Posted 12 July 2018 - 11:58 PM

Preferences->Video options







Also tagged with one or more of these keywords: Tutorials