A Sequential Gear Shifter for Simracing

by Carlos_Almeida in Circuits > USB

3931 Views, 15 Favorites, 0 Comments

A Sequential Gear Shifter for Simracing

DSC04062_crop.JPG
DSC04066_crop.JPG

I'm an avid sim racer. which I dont mean that I'm actually good at it, but I sure enjoy play sim racing games.

When I play such as Asseto Corsa or one of the F1 games, my Logitech G27 is more than enough with the paddle shifters.

My favourite game at the moment is Dirt Rally 2. If you ever played any rally games with a wheel, you know that the driving style is much more chaotic when compared to a normal racing game.

The amount of wheel rotation means that its really hard sometimes to know which paddle is used for shift up or for shift down.

For that reason, I decided to create a sequential gear shifter that can be used with just one hand.

I had simple requirements

  • It should send two signals to the computer
  • It should display what is the current gear
  • It should have a max limit and a minimum limit
  • It should exist a way to reset the count without disconnecting

During this instructable you will see the build process step by step, starting by the design and 3D printing, then moving on to the HW design and at the end I will go through the SW development.

Hope you enjoy and see something interesting here :)

Supplies

DSC04101_crop.JPG
DSC04106.JPG
DSC04109.JPG

This project spans across multiple domains of the Makerverse, from 3D printing to HW and SW development, so the supplies will vary through the steps.

Lets start with the software tools I've used:

  • Fusion 360 for the 3D parts
  • CircuitMaker for the PCB
  • PlatformIO for SW

For the physical parts the bill of materials is:

  • PLA plastic
  • Neodymium magnets
  • Bearings
  • M4 screws
  • Micro switch

For the hardware board I used:

  • MKR1000 arduino board as the main microcontroller
  • Resistors and capacitors
  • 7 segment display
  • 1.27mm headers

3D Drawing

CrosssectionA.png
CrosssectionB.png
Shifter.png
DSC04068.JPG

TLDR: The model is available at Printables

Searching for a base:


I started my design by taking a look at what had already been done. Using an existing and available basis always helps with your design, it allows to learn by what other people have done and it will also clarify what its absolutely required and what you can ditch for other solutions that might work better for you.

If you search the web you'll see a bunch of different designs for this exact purpose. I based mine on a previous build by @uuild_294934.

I took this decision mainly because at the beginning I didn't know how I would want the mechanism to act and behave, and his design looked like it gave me multiple options to sense the shaft position, both using an analog sensor or digital switches.


Analyzing the gap between the base and the desired outcome:


Now that I have a starting point, its time to see what I need to change to make it accommodate my requirements.

  1. The shaft support/hinge is in direct contact with the support walls, the plastic rubbing on plastic will create some friction and some play that I don't really want to feel when I'm using the shifter, so I needed space for some bearings
  2. There is no end stop to limit the lateral play of the shaft, I will have to find some way to make it so that there is no chance for the shaft to move side to side.
  3. The shaft does not return to the middle position by itself since it doesn't have enough weight, so I will use magnets to make sure the action is precise enough
  4. The original handle was a little small, so I need a new handle aswell


Design, 3D printing and assembly


After defining the requirements, its time to start the development, for that I used fusion360 and printed everything in PLA.

The assembly is pretty simple, theres only a couple of points that you need to be careful.

  • The bearings are press fitted into the wall slots (theres a small lip and the bearing should be pressed into that small lip).
  • The magnet polarity is important, when you glue the them to the wall make sure you glue to the stick shift with the correct polarity, the magnets should make the stick want to center itself (the magnets should attract)
  • To glue the magnets use glue that can be used with plastic, some glues might dissolve the plastic

The assembly order is simple, it should go something like this:

  1. Press fit bearings into walls
  2. Glue the magnets to the walls and stick
  3. Mount the micro switches into the wall
  4. Press fit the stick into the middle of the bearings, for both walls
  5. secure the walls with the M4 screws
  6. Screw the walls to the base
  7. Add the hinge covers
  8. Add the housing to the base
  9. Insert the PCB, connect everything and you should be ready to go :)

HW Design

DSC04078.JPG
DSC04085.JPG
DSC04086.JPG
Captura de ecrã 2023-09-24 155157.png
Captura de ecrã 2023-09-24 155218.png
Captura de ecrã 2023-09-24 155137.png
Captura de ecrã 2023-09-24 155119.png

The hardware is not complicated, basically, it needs to do three things:

  1. Connect the microswitches to the microcontroller
  2. Connect the Max Gear UP/Down and reset switches to the microcontroller
  3. Connect the microcontroller to the 7 segment display

These things are not hard, but I will go into more detail in the following sections


7-Segment display

The MKR1000 is a 3.3V board, so you actually dont need to limit the current to the 7-segment display LEDs, the connection is rather simple, just plug & play

Support Buttons (Max/Min Gear, Reset Count) and shift inputs

For the buttons the design is also not hard, you just need to have the button connected to VCC in one side and connected to the microcontroller in the other side.

The only quirk with these mechanical switches is the output bouncing. When you use mechanical switches, most of the times the output is not a perfect signal edge, but it acts more as multiple edges, which might be detected by the SW as multiple inputs. It is possible to have the SW handling this, but it would take alot of time and effort that is not really required since a easier way exists. I just added a hardware low pass filter, which would make the implementation a lot easier.

However, one thing you can see in the schematics, is that the low pass filter are really not well designed since I connected the resistor and the capacitance in parallel, meaning that the both have at least one terminal connected to ground. This was a mistake I didnt catch while passing the prototype I had in a breadboard to the actual schematic in CircuitMaker, but if I end up doing a new version of the PCB, it will be the first thing I fix.

I also kept a bunch of jumpers in the PCB design, just to allow for easy debugging and to allow to fix issues exactly like this last one.

Downloads

SW Design

Captura de ecrã 2023-09-24 162453.png
Captura de ecrã 2023-09-24 195842.png
Captura de ecrã 2023-09-24 195915.png

For the software, I used an arduino based board and I got accostumed to using the platformIO framework, so the SW will be done based on that framework

The project is available in github, and the organization is as shown in the snapshot from VSCode:

  • IO_output : Class that handles initialization and usage of digital outputs
  • IO_input : Class that handles initialization and usage of digital inputs
  • ScreenControl: Controls the 7 segment display
  • ShifterLogic: Logic part that handles which gear is currently selected

The I developed the ScreenControl and ShifterLogic components in Simulink and then generated the C++ code out of it. Could I develop it in code directly? Yes, but I found it easier to think, design and simulate it fast so I went for it.

I used two existing libraries, TaskScheduler, just to have the cyclic methods running at every 10 ms. And HID-Project so that the MKR1000 is detected as a joystick.

In the main there isn't much going on, just the task that runs at 10 ms and a if else structure to handle the last bit of logic which is not implemented in the ShifterLogic.

Thats the only SW that you really need, after this implementation, the arduino should be perceived by a computer as a joystick, where button 1 is the shift up and shift down is button 2. In the game it should appear as a separate controller aswell, and you can map it whatever way you want it :)



Trying It Out

Now you have everything ready to use it in your games, enjoy :)