Coder Social home page Coder Social logo

cdemetriadis / thrustmaster-t300-steering-wheel-emulator Goto Github PK

View Code? Open in Web Editor NEW
71.0 6.0 6.0 4.37 MB

Arduino Nano based emulator for an advanced Console Sim-Racing experience on a Thrustmaster T300 base.

License: GNU General Public License v3.0

C++ 100.00%
simracing thrustmaster t300 emulator steering-wheel console arduino arduino-nano racing ps4

thrustmaster-t300-steering-wheel-emulator's Introduction

Thrustmaster T300 Steering Wheel Emulator

This project started when I decided to update my steering wheel so that it would suit my personal sim driving requirements, something that represented the driving experience with realism and no frills.

This build is intended for use with a Thrustmaster T300 Base (direct plugin), Playstation 4 Pro and Assetto Corsa Competizione.

But, having said that, it should work with any compatible Thrustmaster Base and Console, since it's emulating the F1 Steering Wheel.

The Build

I set my goals high and made a list of things I wanted the steering wheel to feature.

Features

  1. The steerig wheel should feature all of the buttons available on the Playstation DualShock 4 controller
  2. I wanted to include a display for settings related to the steering wheel (and possibly future updates)
  3. Rotary encoders for quick access to necessary driving functions (Brake Balance, ABS & Traction Control)
  4. I wanted to also include a custom Combined Action Button (CAB) that would enable me to increase or decrease - with a single click - any of the above functions an X amount of times.

Design

Since I do not have immediate access to a 3D printer or a CNC machine, I decided to go with one of 3DRap.it's designs. With the help of Antonio, we designed a new version of the current wheel they have on stock, and one that matches my design below.

F1 Steering Wheel


๐Ÿ“บ Watch a quick Video Demonstration of the wheel in action.


Stickers & Labels

The stickers were printed using a standard inkjet on an A4 sticker sheet, and then covered with transparent packing tape.


๐Ÿ“„ Download the sticker sheet here (pdf).


The Hardware

The most important thing to remember with the hardware is that the Thrustmaster base powers your steering wheel with ~3,5V. Everything you use should be able to run on that voltage.

The Brains

From the very beginning, the idea was to build this around an Arduino Nano board. I've had previous experience with this platform and the fact that I found some starting points on the internet made this decision easy.

The Display

Next up was the display. I just wanted the display as a means for me to view and edit settings on the wheel itslef, not to connect or view telemetry. So, a simple 16x2 backlit LCD would suffice. To keep the GPIO's limited, I also added an I2C Backpack.

The Rotary Encoders

The Rotary Encoders were a bit of trouble as the Arduono Nano does not support many GPIO's. At the end of the day, I went with three DuppaNet I2C Rotary Encoder Mini v2.1 boards. They work great, never miss a hit and require only 3 GPIO's total.

The Rotary Switches

Finally, for the Rotary Switches I used two Mini 8-way Rotary Switches, each one driving a single analog GPIO, reducing the required GPIO's even more. The idea is pretty simple, and you can find out more here.

The Buttons

I needed 22 buttons to perform all of the funcitons I planned. I sourced them from multiple online vendors with no particular one to mention. Most buttons are simple temporary (ON)-OFF switches with the exception of the (ON)-OFF-(ON) toggles. For the paddle shifters 3Drap.it supplies heavy duty microswitches that fit snuggly into the enclosure.


๐Ÿ”ฉ Here's the complete list of the hardware I used.


The Software

This is where I received a lot of help from the community (pls see the Credits below). I did my research and found that many people were doing similar things, but none the way I wanted my steering wheel to work. So, I contacted a few of them, got some insights and started building my own version.

My starting point was this post by Taras, where I got the basic hardware & software connection guides to the T300. This was also the first post I read that led me on this journey. Taras has been an immense help as he's been responding to all my technical questions.

Following that, I found the reverse engineered Thrustmaster F1 Wheel bits & bytes in a project by Bram Harmsen, which includes the L3 & R3 buttons, which in turn are generally not available on any other steering wheel. Having all of the information required to replicate all the actions, I started putting it all together.

I won't get into too much detail on that code here, but you are welcome to view it in the repo. I've added as many comments as possible.


๐Ÿ“Ÿ View the Arduino Sketch files


The Functions

The wheel behaves very much like any other wheel on the market. It emulates all of the Playstation DualShock 4 controller buttons. The main differences are the Button Matrix, Display Menu, Rotary Encoders and the Rotary Switches (CAB Functions).

Button Matrix

In the name of saving GPIO's on the Nano, I created a 5x5 Button Matrix to support the 22 buttons I required for my design (yes, I have 3 to spare!).


๐Ÿ—บ๏ธ Here's the Button Matrix.


Display Menu

There were a few reasons I wanted a display. First, I needed a way to change the wheel settings without the need to connect it to a computer. Second, I also thought it be nice to have a clock to display the real-world time & date. Third, the display could be used in future updates to display telemetry... (but nothing planned yet). And finally, it just looks cool.

The display is controlled by the three display buttons:

  1. MENU: Open/close the Wheel Menu
  2. NEXT: Scroll through the Menu
  3. SELECT: Select an option

Display Menu options:

  1. Wheel Mode: Set the mode of the wheel depending on which platform you're playing on:
    • PS - PlayStation (PS) Mode
    • PC - Advanced (PC) Mode
  2. Disp. Mode: Set the mode of the display when Display Keypress is on. Every time you press a button it displays its' function:
    • PS - Pressing any button displays the Playstation button function (Cross, Triangle, L2, R2, ... etc)
    • GT - Pressing any button displays the simulator button mapping according to my personal preferences (Pit Limiter, HUD, Wipers, ... etc)
  3. Keypress: Show the button keypress on the display
  4. Date/Time: Show or hide the Date & Time on the home screen
  5. Buzzer - Turn the buzzer on or off
  6. Hour Chirp - Yes, it could also beep every hour to keep track of the time you spend on the simuator
  7. Display Off - Turn the display off (any display button turns it back on a again)
  8. Runtime - Display the time since the steering wheel booted, so you know how long it's been running

Rotary Encoders

The Rotary Encoders allow for quick access the Brake Balance, ABS and Traction Control adjustments while driving. Rotary Encoders are cool because you can quickly tweak settings without needing to distract yourself with on screen menus etc.

The Rotary encoders have been mapped as follows:

PlayStation (PS) Mode

Description Left Rot. (-) Right Rot. (+)
Brake Balance (BB) D-Pad Down D-Pad Up
Antilock Braking System (ABS) L3 R3
Traction Control (TC ) D-Pad Left D-Pad Right

Advanced (PC) Mode

Description Left Rot. (-) Right Rot. (+)
Brake Balance (BB) Down Up
Antilock Braking System (ABS) 20 21
Traction Control (TC ) Left Right

๐ŸŽฎ Here is the map of control bindings I've applied in Assetto Corsa Competizione for both platforms.


CAB (Combined Action Buttons)

This is something I thought about while watching a video where Nico Rosberg was explaining how you need to shift the Brake Balance from the front to the rear and back multiple times on a single lap to optimise your driving. You can of course use the Rotary Encoders, but you can't be precise, especially with the force feedback kicking on your wheel.

The idea is to create a set buttons that can replicate mutliple clicks depending on your preferences. Using the Rotary Switches, you can quickly set the parameters:

  • CAB Mode: Selects the function you want to replicate (BB, ABS, TC)
  • CAB Steps: Select the number of times you want to press the button (1x-8x)
  • CAB -/+: When selecting the CAB -/+ button, it will execute on your selected preferences

Putting it all together

I wanted to keep things as compact as possible so a custom board was required. I also wanted things to be removeable and interchangeable in case there is failure in the future. My intention was to create a custom printed PCB but it really did not make sense at this point in time (maybe in an update?). The final board is made up of a 5x7cm perfboard and I used solid core wire to make the connections.

Although my first attempt (v1) functioned perfectly it was not as compact as I'd like. In fact, it did not fit into the steering enclosure at all. I redesigned the tracks and rebuilt a second version (v2) using angled DuPont male connectors, saving a lot of space due to a limited height.


๐Ÿ“‹ Take a look at the Final Diagram Layout & Board.


Installing

If you've got everything wired and connected as the diagram shows, you will probably be all set to use the steering wheel.

Dependencies

To compile the Arduino Sketch you will need to have these libraries installed:

  • EEPROM.h - EEPROM library for storing settings
  • LiquidCrystal_I2C.h - Liquid Crystal Display I2C library
  • i2cEncoderMiniLib.h - Rotery Encoder I2C library
  • TimeLib.h - Time library
  • DS1307RTC.h - DS1307 RTC library

Setting the time

Follow the library's instructions on how to setup the current time on the RTC.

Setup Rotary Encoders

Follow the library's instructions on how to change the address of each of the Rotary Encoder boards. I've set them as follows:

  • BB (Brake Balance): 0x20
  • ABS (Antilock Braking System): 0x21
  • TC (Traction Control): 0x22

Setup Rotary Switch values

The one thing that may need tweaking are the Rotary Switch values, given that the values returned are dependent on the voltage supplied. Set the DEBUG_ROTARY_SWITCHES to true and the LCD will display the current values of both switches. make a note of those numbers and update them in the t300_functions Sketch file, under getCABMode() & getCABSteps() functions.

Debugging Performance

I've added a built in performance monitor. You'll need to set DEBUG_LATENCY to true and open the Serial Monitor (115200 baud). Once uploaded, you will view a real-time report on the current loop latency.

Performance

The first software version had quite a few issues, with latency being the largest. Every now and then a button click would be missed which during a race this meant an misfire on an upshift or a downshift. This made up for some bad performance.

After running tests I discovered that a single loop ran at around 2800ms with an eventual hiccup every second at around 106000ms. It was abvious that something was producing some type of delay. I eventually optimised the code for the Rotary Encoders and the Clock (RTC).

The final version of the code running on the Arduino Nano with all the hardware connected has a steady loop latency of about ~1790ms. When the display is turned off the latency drops to 195ms (roughly 0.000195 seconds).

Since the display does not add much to the driving experience, you can opt to turn it off while driving by long-pressing the ABS Rotary Switch.

The current version works seamlessly and I have not noticed any misfires during racing.

Credits

A small space to acknowledge the work done previously by others.

  • Taras Ivaniukovich https://rr-m.org/blog/ - For the work he's shared on his blog and the help he provided all along the way
  • Bram Harmsen https://www.thingiverse.com/thing:2813599 - For reverse engineeirng the F1 steering wheel
  • mrfid72 - For the awesome Youtube Video explaining the Analog Rotary Switches
  • Danny van den Brande - For the code I found online that helped me setup the button matrix
  • Antonio De Stefano https://3drap.it - For the awesome Steering Wheel enclosure

License

GNU General Public License v3.0 or later

thrustmaster-t300-steering-wheel-emulator's People

Contributors

cdemetriadis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

thrustmaster-t300-steering-wheel-emulator's Issues

T300 F1 wheel no display

Hi,
Thanks for your generosity in providing full details of your build. I am having a problem with not being able to display anything.
I have loaded the i2c demo from arduino ide and get the hello world. Loading your code i get nothing. I wondered if it had anything to do with the display on/off switch but cant see in your docs where this switch is connected. I even disconnected everything and just had the Display and nano connected and still nothing. Any help would be appreciated. Thanks, Les

Wire.h

Hey mate,

Thanks again for your awesome work. I am building my second wheel at this point. I run into a problem. The original code does not include wire.h and wire.begin, but now, without including them, the arduino is stuck at setup while initialising the encoders..

Do you have any hint why this is happening? Which version of i2cminiencoderlib.h do you use?

Greetings

Encoders displaying opposite Polarity

Hi,
When rotating any of the encoders anticlockwise is displaying + and clockwise a -.What have i got wrong.I am a novice with Arduino sorry.

Thanks
Les

Clean Thrustmaster F1 code

Hi, i've seen you fantastic job about this project a few time ago, i've made myself too a few wheels using T300RS emulation and also a work in progress with T-GT emulation(thanks to Taras for his work), i would like to ask you if it is possible for you to publish the code to emulate the Thrustmaster F1 wheel(the one you used for this project), but in a clean version. I mean without screen controls and in the original buttons form(like the original F1 wheel: 18 buttons and 2 encoders). I've already try to contact Bremme on thingiverse for the original code but i didn't gen answer... and Taras told me that he don't have the time to work anymore on these projects.
I'm not a programmer and except for a few buttons reordering i'm not able to modify your sketch or the bremme's one.
Thank you very much
Best regards
Roberto

Buttons are not constant

First of all, thanks for the amazing work,

I realized, that Buttons are not constant pressed but flicker a lot. I do not use a rtc nor a display, just 3 encoders as you and some buttons. Therefore I modified the code, but it also happens with the original one. If i keep the button pushed, it is like i would very very very frequently push it. Any chance to look into it or does it happen because i do not use RTC, nor buzzer or reset? I use it on a TS-PC.

Best Regards!

Change Button Matrix with Shift Registers (PISO)

Hi, I was reading your code, very useful, and documented

thanks for that!

I was thinking about using some 74HC165 PISO register (paralel in, serial out) to get the inputs.

Do you think that could be done?

For example, one register could get the second wheelstate byte, every button click sends a complete 8 bit pack. Another, for the third... etc.

what do you think?

Edit: Something like this:
https://wokwi.com/projects/306024460940476993

CAB / Display Bug

When the display is switched off I noticed that the CAB Mode button does not function properly. It does not properly select the mode.

I've tested the voltage and everything seems to be just fine. I need to further investigate as I currently do not know what is wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.