Replies: 4 comments
-
|
The button repeats are probably just switch bounce, as you suspect. Bounce is a physical phenomenon in the switch, so it can vary quite a lot from one switch to the next. Switch quality is definitely a factor - higher-quality switches will probably have less bounce - but bounce times of 5 or 10 ms probably aren't unusual. Many applications seem to set ad hoc debounce times in the 10ms range. For virtual pinball, you'd like it to be as short as possible, especially for flipper buttons, since longer bounce times can manifest as latency in the game responding to button presses. But human latency perception has a floor of somewhere around 20 to 30 ms, so you probably won't experience any perceptible latency as long as you can keep the button debounce time under 10ms or so. (There are other things in the input chain to the game that add more latency on top of the button response time, so you can't use the whole 30 ms of latency budget for the buttons alone, but 5 to 10 ms should be no problem.) However, if you can't find a good sweet spot between bounce suppression (making the debounce time longer) and perceptible lag on the PC (making the bounce time smaller), it could definitely be worth trying different switch hardware to see if you can reduce the debounce time without triggering repeats. Button triggering when solenoids fire is definitely an electrical interference problem. Diodes are the first line of defense, and you already have those in place, so you're good there. The next thing to look at is probably the power supply and grounding. The nature of the electrical interference that causes this is most likely ground voltage variation. In other words, it's not anything like radio waves going through the air, or magnetic coupling between nearby wires - it's not like radio static, so we're not looking for the sorts of "shielding" that would help with that sort of thing. The problem is probably just that the voltage fluctuations are feeding back directly through the wiring between components. Probably the first thing I'd try is to remove the DC/DC converter and replace it with a dedicated 24VDC SMPS, making sure it has enough wattage capacity to handle the contactors you're firing. If you want to try something a little simpler first, you could just add a couple of capacitors in parallel with the 24VDC converter power output - something like a 4700 uF electrolytic, 1000 uF electrolytic, and 0.1 uF disc capacitor. That might or might not help, but it's fairly easy to try if you have some capacitors on hand. The capacitors can help by providing a momentary reserve of power when the contactors turn on, so that the DC/DC converter doesn't get hit with a sudden demand surge, which can send spikes through the ground and 12V rails; they also smooth out the sudden drop in demand when the contactors turn off, which can likewise cause spikes on the rails. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for all this valuable information, it is highly appreciated.
If I understand this correctly, both
I want to avoid a second PSU, because the "Pinball Controller" device is powered externally and this would mean an additional connected external PSU. I will definitely try the capacitors at the output of the DC/DC converter. What also came to my mind is to try it the other way around - use an 24V PSU and an 24V to 12V converter. The 24V PSU would then be directly connected to the contactors and the DC/DC converter would drive the button LEDs which take less current and don't have this kind of inductive load. However, I've also tried the lowPassFilter filters and those help with the second issue related to the ground voltage variation. In fact, setting both Thanks again, your comments are always very helpful. |
Beta Was this translation helpful? Give feedback.
-
|
That's great news about the low-pass filtering. Your description of the latency effect is right: setting the low-pass filter times to 50 will add 50 us of latency at each on/off transition, while the debounceTime settings don't add any direct latency, they'll just prevent repeats within the intervals (10ms for your 10000 settings).
Certainly true, although there still are a couple of "flipper trick" effects that longish debounceTimeOn/debounceTimeOff settings might interfere with. You can do certain ball-passing tricks on a physical pinball machine by using very fast taps on the flipper buttons and very brief releases. It looks to me like these operate on a time scale of a few milliseconds, which is such a short time scale that I think they're mostly about using the momentum of the switch mechanism rather than timing your presses. Traditionally, VP and the other computer pinball simulators weren't able to replicate these tricks, because of the relatively long (and unpredictable) latencies in the Windows and VP input layers. But the newer Windows APIs make it possible for VP to distinguish very short USB events, down to a few milliseconds. So I'd try to keep the debounceTimeXxx settings shorter than 10 ms - preferably in the 2 to 3 ms range = even if it means you have to increase the low-pass filter times a bit to compensate. I think you can increase the low-pass filter times to as much as 1000 us without any ill effects in the game, because even a real pinball machine doesn't go any faster than that. The WPC-era machines had about 1 ms of built-in latency in their flipper input, and everyone considers those the gold standard, so I think 1 ms in a simulation is no problem. So experiment a bit and see what works for you.
That's a great idea. I suspect that the DC/DC converter is probably slower to respond to rapid demand changes than the SMPS, so putting the inductive loads directly on the SMPS could definitely help. LEDs can actually be a bit noisy, too, since they have super fast on/off switching transitions, but the individual LED current loads are probably a lot smaller than that of contactors, so each switching event with the LEDs is probably less of a demand spike. |
Beta Was this translation helpful? Give feedback.
-
|
🤦♀️ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I've finally assembled my "Pinball Controller." It is driven by the Pinscape Pico DIY-friendly main board and features seven buttons with micro switches, four buttons with leaf switches, four contactors, a plunger with a linear potentiometer, and a small shaker motor. During testing, I noticed that the buttons are sometimes triggered unintentionally. I tested this by assigning a key press to each button and monitoring the key presses in a text editor. These unintentional triggers seem to be mainly due to two issues.
First issue: When a button was pressed once, I randomly received one to three triggers of the assigned action. I fixed this by increasing both debounceTimeOff and debounceTimeOn to 4,000 μs each.
However, the reference mentions that 1000 µs and 1500 µs, respectively, are good values for typical micro switches. I wonder if my micro switches are of low quality or if there is something else I can do to improve the situation.
Second issue, which concerns me a bit more: When I activate any of the contactors with a PWM value other than 0 or 255, some of the buttons are triggered randomly and continuously, probably due to electromagnetic noise. I usually wouldn't use a PWM value other than 0 or 255 for a contactor. However, for testing, I used the slider in the Config Tool, which doesn't allow you to go directly from 0 to 255. The result was that the slider got stuck in the middle, causing the Config Tool and also Windows to freeze due to all the triggered key presses.
I fixed this by creating "digital" outputs for the contactors with
source: "if(self > 127, 255, 0)". However, I wonder if there are physical or electrical measures that could improve the situation. Here is some related information:Beta Was this translation helpful? Give feedback.
All reactions