Sunday, March 6, 2022

Fixing An Ancient Racing Wheel Controller

 I recently built up another Home Theater PC with some retro-gaming apps on it.  One of the games I wanted to play was an old one I think is one of the best racing games of all time called "Breakneck 2" originally from 1998 (I wrote about it on this blog about a decade ago, it's from Germany and was originally released as "N.I.C.E.2 Excessive Speed" in Europe).  This game is the only reason I even own a racing wheel game controller.

Notice the "Windows 98" compatibility!


 

But the wheel is 24 years old and over the years it has been stored in basements and attics and garages, not to mention the actual use (abuse?). So I'm not surprised it broke inside almost immediately after I started using it this time.

The shattered plastic "yoke" from inside wheel


But the part that broke is a textbook case for using a 3D printer: to reproduce a plastic part that is unavailable.  And I happen to have a 3D printer.

Granted the 3D printer is not a good one.  It's garbage.  LITERALLY.  It was intercepted on its way to a dumpster.  It's a "Tiko" delta printer that was part of a Kickstarter campaign.  On the plus side, unlike a lot of crowdfunded tech projects, they actually DID deliver some units.  But they bankrupted themselves in the process and went out of business.

The biggest issue with this printer is that the built-in "slicer" software is terrible.  But if you use some other program to slice your models and feed the printer raw "gcode" files it works a LOT better!  But you are still limited by the actual capabilities of the printer, and if you need precision parts that will fit together?  Not gonna happen.  Not without doing some filing and shaping, and even then the still may not fit together.

Anyway, the tldr; is after a number of false starts and failures I FINALLY got a 3D printed replacement part to work and got the wheel working again.  Below is my frustrating journey to once again drive some windy old virtual roads at insane speeds.

Plan A: Fix The Original Part

 

original part glued back together

My first thought was just to try and fix the broken part.  Using some superglue I was able to reassemble it.  But this is a part that has a lot of torsional pressure and other forces acting on it.  I thought it would probably just break into pieces again, so at this point I took as accurate measurements off of it as I could.  I thought maybe if I just clad it with some 3D printed pieces to strengthen it then it might work.  So I made a model in SketchUp 2017, exported it as an STL file, generated a gcode file, and printed it:

Printing the part

In case you're wondering, this printer doesn't have a heated bed.  After many frustrating attempt to print things I discovered that putting a piece of printer paper over the bed was the perfect thing for PLA plastic adhesion.  My models no longer break away from the bed and get dragged around by the print head.  You have to tear the part off the paper, but you can simply use water to get all the paper off.


So I made flat pieces for both sides of the Yoke and superglued them to it, then filled in the gaps with expanding Gorilla Glue.  There are rollers that are supposed to go on those pegs.  The rollers ride against a piece of bungee cord to create resistance (this is not a force-feedback wheel). The rollers were only held on by a tiny peg, one of which was broken and even if could find the piece it would never hold.  So I drilled out the pegs and held the rollers with screws and washers:

I have no idea if this glued-together part would've worked because I could NOT get it reinstalled.  The steering shaft is knurled and you could see the imprint of the knurling inside the "tower" on the Yoke, but I couldn't actually get the part to go back down over the shaft.  I suspect it may have been pressed into place at the factory or heated and pushed on, gripping itself as it cooled and contracted.  I couldn't hammer it down onto the shaft because I was sure THAT would just break it into a million pieces again.

 

Okay, so on to Plan B!

Plan B: 3D Print A Replacement Part

My first thought was, since the original piece is very dense, heavy plastic, and has a lot of forces acting on it, I should try and print my replacement part with 100% density too.  Which would take forever, but it would be literally solid plastic.  But I had to quickly abandon that plan because at that density the little Tiko printer starts experiencing pronounced layer shifting:

That meant I had to rework my model a bit to create some interior structure so I could hopefully stop the layers shifting on me.

But there was still some layer shifting, especially when it got to printing the "tower" that goes around the knurled shaft.  Also, because of the limitations of the printer's precision (or severe lack of it) I could NOT get the inside diameter of that tower correct.  I ended up printing a whole bunch of revisions:


 And STILL couldn't get it right.  The inside diameter of the tower not only has to fit over the knurled shaft the outside diameter has to fit inside the "resistance arch" with the bungee cord.  So on that last one on the right I tried to slowly, and carefully hone out the interior large enough to install it.  Which resulted in it eventually breaking off entirely:

DOH! 

This project went through MANY revisions on the fly:

The many revisions of the Yoke
 

These were all done in SketchUp 2017 which is the only 3D modeling software I really know how to use.  I've tried to build things in Blender, Cheetah3D, and FreeCad with great difficulty.  At least with SketchUp I know I can slam together something really fast.

So in that last revision I decided to approach this a different way.  Since I absolutely could NOT get that inside diameter right I figured I'd design a multi-part model that could CLAMP around the knurled shaft.  That led to this:

The "tower" is printed separately and superglued to the base parts.

With some screws I found in the kitchen junk drawer. 
No idea what they're from, but they went through the holes and were long enough.

Okay, so another problem you run into with 3D printing (and not just with my literally garbage printer) is prints that curl up on the ends as the part cools.  It's more of a problem with ABS plastic than PLA but can happen with either, especially on a printer without a heated bed.

So, to get the parts to match up and be flat I had to heat up a cup of water in the microwave.  For PLA you need it about 150 degrees.  Dip the part in the hot water for a few seconds until it just become pliable enough to reshape it.  If you leave it in too long or the water is too hot, though, you're part will become TOO pliable and will also shrink.  See how the top piece in that photo is a little narrower than the bottom piece?  It shrank a bit.  See that little dip in the top edge next to the longer screw?  My thumb made that.

Reassembly

Now that I had a part that would actually FIT the time came to put everything back together.

When I was trying to get the other attempted Yokes on I had to cut the wires to the buttons in the middle of the steering wheel.  Ironically with the two-piece clamp Yoke I wouldn't have needed to do that.  But what's done is done.  You may have noticed in that disassembled photo up above that there's a part labeled "Weird Dummy Board."  The wires from the steering wheel buttons went to this board that doesn't seem to DO anything:

The wires just connect to one side and there are circuit traces that just go straight across to wires of the same colors.  Why?  Perhaps there was some other model of this wheel with a different board there for some other features this one doesn't have?  No idea.
 

The stupid "Dummy Board"

 

The advantage of getting rid of this useless board was the wires I'd snipped were long enough to reach the ultimate board connector without my needing to solder pigtails onto them.  So, goodbye Dummy Board!

Once I clamped the Yoke on the knurled shaft I had to reinstall the resistance arch over it.  That was secured with four weak little screws from the front panel.  I drilled everything out a little larger and put in some beefier bolts.  Found these Allen-head ones in a box of junk that dressed it up nicely.

Resistance Arch and Clamp Yoke installed

The Clamp Yoke's bolts sticking out aren't a problem, and give enough extra for some lock-nuts.

Next up is reinstalling the gear-driven potentiometer that actually tracks the position of the wheel.  The trick with this is to make sure the wheel is in the center position and the potentiometer is in the middle position and drop everything into place and screw it down.  If you get this wrong your steering wheel will be off-center when you're driving straight.

With everything back in place it's time to reconnect those steering wheel button wires to the connector (sans the "Dummy Board"):


 




Wires bundled and everything is reconnected to the main circuit board!

I did ultimately have to partially disassemble this again because on my first test with it the steering shaft knurling just ground out the inside of the Clamp Yoke tower.  PLA plastic is pretty soft and the forces acting on it just turned the knurling into a file.  My solution to that problem was to permanently GLUE the clamp onto the shaft with two-part epoxy.  It means I will NEVER be able to get this apart again, but once the epoxy resin hardened that clamp isn't going anywhere.

Another issue was that, after 24 years, all the grease had basically gone away.  The only grease I had on hand was some plumber's faucet grease.  I put that on the outside of the tower and on the steering gears.  The only downside to that is the wheel works VERY easily and smoothly.  Though, I'm not sure if maybe that's what it was like when it was new?  I can't remember.  Maybe I just got used to the way it felt without any grease left in it.  Of course, that probably played a role in why the original yoke broke.

Anyway, everything fixed in place again and reassembled it was time to CALIBRATE it!

Calibrating it on Linux with QJoyPad utility

And last, but not least, taking it for a test run around the Breakneck 2 Corsica track:

If, by chance, you have one of these old Thrustmaster racing wheels that has also broken the Yoke here are the STL files of my final revision:

Thrustmaster_Yoke_Rev9.zip

Of course I make no guarantees for how long it will last.  So far mine hasn't broken again, but I've also been careful not to crank on it too hard.









Sunday, January 23, 2022

XP-PEN Display Tablet Express Keys "fix" for M1 Mac

UPDATE 7 FEBRUARY 2023
A macOS update apparently made the version 2.0 drivers stop working.  I also ran into an issue where, because I'm using custom display profile overrides the tablet settings app cannot find the names of my displays nor could it tell there were two of them (it sees both displays as one ultrawide).  After some playing around with both newer and older drivers I am now recommending you use the version 2.1.6 driver.  It does have a bug that causes it to sometimes lose all your custom settings (like hotkey assignments), which you can mitigate by locking the actual settings file so it's "read only."  (You can find it at ~/Library/Preferences/com.ugee.pentabletsetting.plist and lock it by right+clicking and select "Get Info" then in that dialog tick the "Lock" box)  But don't do that until after you've finished getting everything set up the way you like.  Also, some apps simply won't accept your custom settings from this driver.  For example, even with the default button assignments on my tablet where K1 = increase brush size, K2 = decrease brush size, CSP sees the first one correctly - but inconsistently - and the second one as "eye dropper."  Even if I assign those to "]" and "[" it shows at the bottom of the display that the tablet IS using the configured keyboard character, but CSP ignores it.  In Affinity Photo, though, it all works as intended.  So this comes with a heavy dose of YMMV.  You can still try the version 2.0 drivers and see if they work for you, but otherwise:

DOWNLOAD THE XP-PEN 2.1.6 DRIVERS FOR macOS

The 2.1.6 drivers *should* automatically create entries for the macOS Privacy settings as shown below in the original post, but you'll want to make sure they are checked, and your tablet will not work until you restart your Mac.  On restart you'll likely see a bunch of privacy/security pop-ups and you need to authorize all of them.

------------ original post follows --------------

Both I and one of my friends own the same model XP-PEN Artist 15.6 display tablet and M1 Macs.  It's a nice tablet for the money but the support for Mac users is terrible, especially since the M1 "Apple Silicon" chip was introduced.  The tablet itself is actually made by Ugee and I think XP-PEN is just one of many "brands" the same tablets are sold under (their websites have the same layout, the driver files are the same versions, the interface for their preferences app is the same, they just swap out some images).

So, anyway, the "New UI" version 3.x drivers are garbage.  They absolutely do NOT work.  Version 3.0.5 would at least detect the tablet if you unplugged it and plugged it back in, though you couldn't configure the pen or the Express Keys as none of the sections would appear in the left-hand column of the preferences app.  The versions after that won't detect the tablet at all. 

I'm using the USB-C to USB-A + HDMI cable that came with my tablet because I'm mirroring my primary display to the tablet through an HDMI splitter.  I haven't tried connecting my display tablet with a USB-C cable, but from what I've read on their forums and Reddit, it doesn't sound like that would make any difference.

The (as of this writing) current 2.1.8.2 drivers are listed as the "Official" ones on XP-PEN's website, and if you have an M1 Mac they will get you up and running, but you won't be able to assign your Express Keys.  There's a bug in those drivers that won't let you reassign them properly and I doubt they'll ever fix it because they've moved on to developing their worthless 3.x drivers.

The Express Keys bug was also present in 2.1.7 version of the drivers and a different bug was present in the 2.1.6 drivers.  The 2.1.6 will let you reassign the functions of the keys, but they were inconsistent in actually working.  When yo press one it displays a message across the bottom of the screen confirming not only that the button was pushed by tells you in bright green lettering what it's supposed to do.  Except on a M1 Mac it wouldn't always actually do it (the drivers seem to work fine on my Intel Mac).

XP-PEN frustratingly does not provide an archive of older versions of their drivers.  And, no, you can't get them through the Internet Archive Wayback Machine either.  Thankfully between three computers I had installers for several different older versions.

After installing and testing and uninstalling ALL of them on my M1 Mac I finally found ONE that actually works the way it's supposed to!

The Version 2.0 drivers that ACTUALLY WORK are, ironically, the oldest ones I have.  The ones I downloaded when I bought my tablet.

You can get them from my Google Drive but installing them in Big Sur is not exactly straight forward.

1. UNINSTALL your current XP-PEN drivers!  Use the "Uninstall" app in the same folder as the Settings app.

2. RESTART your computer to make sure it's gone.

3. Download the installer ZIP from that link in the line above.

4. Unzip it and inside there should be one file: XP-Pen Mac(20180425).pkg 

5. Right+Click on that file so the context menu shows up.

6. Press the OPTION key on your keyboard and then select "Open" from the context menu.

7. The macOS Gatekeeper will warn you about opening it, go ahead and do it anyway.

8. Run the installer and wait for it to finish.

9. It will finish saying "Installation Failed!" but it's a liar, the installation worked just fine. Close the installer.

10. Go to Applications --> PenTablet --> PenTabletSetting.app and open it.

11.  Authorize the app in any macOS security and privacy pop-ups you see.

12. Open System Preferences and go to Security & Privacy

13. Click the padlock icon in the lower left and  enter your login password to unlock it.

14. Scroll the left column down to "Accessibility"

15. Click the [+] button under the list on the right and navigate to:
Applications --> PenTablet --> PenTabletSetting.app

16. Click the [+] button again and this time navigate to:
Macintosh HD --> Library --> Application Support --> PenTablet --> PenTabletDriver.app

17. Now scroll the list on the left to "Input Monitoring" (and we're going to do the same...)

18. Click the [+] button under the list on the right and navigate to:
Applications --> PenTablet --> PenTabletSetting.app

19. Click the [+] button again and this time navigate to:
Macintosh HD --> Library --> Application Support --> PenTablet --> PenTabletDriver.app

20. Restart your M1 Mac.

21. Plug in your XP-PEN display tablet.

22. Go to Applications --> PenTablet --> PenTabletSetting.app and you should be able to set your preferences for pen buttons, pressure, display mapping, and Express Key assignment.

23. EXIT the settings app.

Your settings should now be usable with your tablet.  When you press one of the Express Keys on the tablet you should see a gray bar across the bottom of the screen with text telling you what action is assigned to that button.

When you re-open the settings app be aware you may need to select your tablet from the drop-down list at the top before it will actually load your custom settings.  I had made my pen pressure softer but when I reopened the settings app it wasn't showing the curve I'd set for the pen, but after selecting "Artist 15.6" from the list at the top it loaded my settings.  They seem to be persistent after that, but if they revert to showing defaults I'd try selecting the tablet in the drop-down first, just to see if your custom settings load.

This WILL fix your issue assigning the Express Keys custom functions.  Whether using these old drivers ends up causing you other problems I can't say.