Last updated on August 14, 2020
This guide will walk you through building a USB gear stick / shifter that will work with any PC racing game. I have deliberately stuck to building the simplest possible version of the device in the hope that those out there wanting to build one can do so in the shortest time possible.
(a YouTube video of the finished product in action is at the bottom of this post)
What you will need
- A wooden chopping board of reasonable thickness (€1.20)
- MDF of the same size as the chopping board (€0.50)
- An Arduino Leonardo compatible board (€4 on AliExpress)
- An arcade style 4-direction joystick (about €7 on AliExpress)
- 140cm M8 threaded rod (€0.80)
- 30cm M5* threaded rod (€0.50)
- M8 nuts and washers (€1)
- M5* nuts and washers (€1)
- 4 (or more) M8 cap nuts (€1)
- 10 male to male ‘du-pont cables’ (€0.20)
- A collection of magnets (€7)
- 2 x tripod size conversion blocks (€3)
- 6 ‘L’ shaped brackets (€3)
- A small breadboard (optional)
- Long USB lead (€2)
(* size of rod depends on your joystick mounting holes)
Total cost: Around $30/€30/£30
Time to build: 2-6 hours
The basic concept
We’re going to be using an arcade style joystick as the basis for our gear stick. Now you’re probably thinking, how can we make a 7 position shifter (N-1-2-3-4-5-R) with a device that can only go in 4 directions? The joystick is not analog and works by directional switches being pushed or not.
The answer is that the joystick will let us push it diagonally, which involves more than one joystick switch being selected. So for example when pushing it to the top-left, both the left and the up switches are set.
We can then implement a lookup table to decide what gear we are in based on how the 4 switches are set.
Writing the software
A very useful feature of our Leonardo board is that it can be programmed to work as a keyboard, mouse or joystick. That is we can program the device’s memory so that when the device is plugged into a computer, the computer ‘sees’ either a mouse, keyboard or joystick, rather than a microcontroller development board.
The software we need to write is actually extremely simple. We will be reading whether the 4 switches on the joystick are pressed or not, and then depending on which are pressed, we can calculate what gear we are in. We can then pass that message on to the computer, which will pass it on to our game.
This guide won’t cover how to get the software onto the Leonardo device. There are plenty of tutorials covering that on the Internet. Compile then upload the software. When the DEBUG define is enabled the software will output messages to the serial monitor rather than behave as a joystick. You can use this mode to easily test whether the wiring of your gear stick / H-shifter is working correctly
Building the gear stick will probably take an entire afternoon or longer, depending on what access you have to power tools. As you can see I purchased the bottom part of the gear stick very cheaply from a local home supplies store. The other items were mostly purchased from a local DIY store. The only items that you will need to order online are the Leonardo board and joystick module. You can opt to purchase them very cheaply directly from China via AliExpress or a similar website, or if the 3-4 week delivery timescale is too long for you, both items are also available on Amazon.
Firstly – you need to mount your joystick to your chopping board. Getting it straight vertically is very important, depending on your particular joystick module your mounting holes might be in different locations. I marked out the two mounting holes and then used threaded rod that I had of the correct size, with nuts and washers to mount the joystick. You want to ensure the joystick stands above the chopping board and can perform a full range of motion. Don’t worry about the nuts on the underneath of the board, we will have our four larger corner mounts sticking out further and they will have cap nuts on them.
Next – you should cut out a section of MDF to the size of your chopping board. Then measure four points, one in each corner, that are 1.5cm from the edge. Do the same on your chopping board. We will use threaded rod to connect the chopping board/base to the top platform on which your H pattern will be cut.
Then use a size 8 drill to cut the holes in both pieces of wood. Be careful to ensure you get the holes accurately drilled. It is worth double checking and taking time to do this well.
On the piece of MDF you now need to mark out the H pattern for your gear selection. Exactly what size of H pattern you’ll need depends on how high you want your gear shifter. This will depend on whether you are sitting low down on a Playseat Challenge style setup like me, or if you are sat at a chair. I suggest you take the time to work out where your gear stick is to go, and what height it would ideally be. You can then manipulate the height of the joystick and the top part of the construction, to best fit your situation.
To easily cut out your H-pattern drill large holes then use a jigsaw to carefully carve out the pattern. A rotary tool here would be useful to smoothen out the edges. For this build I was up against the clock and did not attempt to make it look good!
Once completed your MDF should now look something like this. Ready to be mounted to the rest of your gearstick.
As it comes the joystick height is just a few cm. To look like a gear stick this needs to be much longer. I unscrewed the red handle and used a tripod size conversion module to be able to connect M8 sized threaded rod to the smaller rod that comes connected to the joystick. The length of this extension rod will depend on the desired height of your overall construction. We use the much thicker rod to give the gear stick the feeling of some weight, and it also works very well with the magnets. Finally, I used another tripod rod size conversion module with a few CM of smaller threaded rod to connect the red joystick head again.
Gears that stick
When driving an actual car, changing from neutral into first gear, leaves the gear stick placed in the first gear position. You may have questioned how our joystick will work as a gear stick, seeing as when left to its own devices it returns to the central position. That is a good question, and is the principal obstacle to overcome when building a DIY gear shifter.
For my design, I chose to use magnets to hold the joystick in position. We mount L brackets at the end of each part of the H shifter pattern on the underside of the top board. We then place magnets, two for each gear in my case, at each gear. You could experiment with using more or less magnets. Personally I mounted the L brackets a little far from the gear stick, it still works correctly, but I could have placed them nearer and increased the grip the magnets would have on the stick.
Putting it all together
When you are satisfied that the height of your top board is correct and the gear stick is moving to each position and correctly being gripped by the magnets you should use nuts and washers underneath and above the top board to fix it in place. The great thing about constructions like this that use threaded rods is that adjusting the height is very easy.
I calculated the best height for my situation and here is how the final build looks. As you can see the stick is holding itself nicely in 3rd gear, thanks to the magnets underneath the top platform.
I am using ‘jamma leads’ to connect the joystick module to my Leonardo board via some ‘du-pont’ breadboard wires.You could just as easily use any type of wire that could be connected properly. I noticed that some joystick modules available on AliExpress now have several smaller pin connectors rather than the jamma connectors.
Please do not judge my wiring in the photos! This was a prototype was I have not made any effort to organise the wiring.
Testing your gear shifter
With everything plugged in Windows should recognise your USB H-shifter as a joystick. Use the Windows ‘Setup USB game controllers’ dialog to test your device. If all is well then moving from gear to gear should highlight a different button. As you can see Windows lists my gear stick as ‘Arduino Leonardo’.
Here is a short video demonstrating how the finished build works. I will shortly upload a video showing the gear stick in action.
Please do let me know if this tutorial has been useful. I deliberately tried to make this the simplest possible version. There are so many improvements that could be made. I intend to do another build and add the following features.
- A larger unit to give room for several buttons – in fact – as buttons are cheap and there are always actions to bind to buttons in games, I might add 8 or 10. These could be used in driving simulations to control lights, the engine, the horn, the radio etc.
- I also plan to add some DIP switches to the build, so that I can change how the device behaves without needing to reupload the software. It would be useful to have the option to set whether neutral ‘as a pressed button’ was enabled or not.
- I might also add a socket to plug in a clutch pedal. I could then pass on the data for the clutch pedal to the computer, while using the clutch pedal position to determine if a gear change should be successful or not. Perhaps playing a rough sound if the clutch wasn’t pressed correctly when the gear stick was moved, and stopping the gear change by throwing you into neutral.
- An LCD screen could be hooked up to show the current gear, and with a small program running on the host computer there is the potential to send back data such as speed/race position/revs etc where the game makes that information available.
If you decide to build this, good luck! As I said during the tutorial, the most important thing is getting the joystick mounted level, everything else can be tweaked easily.
Here is a video demonstrating the gear stick in use. Watch in full screen so that you can see the in-game gear graphic easily.
Aug 14 2020 – One month update
So a month later the gear stick is still working fine. The only issue is that at times it isn’t “clicking” properly into first gear. I figured out that this is because the rod connecting to the joystick isn’t perfectly straight, so the gear stick goes up at an angle slightly. The result of this is that occasionally pushing into first gear doesn’t quite work. Resolving this will simply be a case of connecting the rod to the joystick better. A slight rotation of the gear stick solves it and so I haven’t yet made that alteration.