Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help  (Read 7979 times)

0 Members and 1 Guest are viewing this topic.

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« on: November 05, 2021, 03:21:39 am »
Hey all

I'm working on a project and I think I'm in way over my head....I bought a Maximum Tune 3 shell which I planned to convert to use with a PC running Teknoparrot. The cab has no screen or game, but does have the shifter, pedals, wheel and boards to go with them.

My initial thought process was to rip out all the existing hardware (which I've done and now regretting not leaving it all in tact until I finished planning) and fit my Thrustmaster T300 in the cab. After reading some articles on this forum and the seeing the awesome work people have done with interfacing arcade hardware with a PC ideally I'd like to go down that path. Fitting the Thrustmaster without butchering the bezels will be very difficult.

So my question is based on the below photos of the parts I have is a possible to interface the wheel with a PC and use an emulator such as Teknoparrot? Or am I better of figuring out how to fit my Thrustmaster in the cab?

I came across this video on YouTube which gave me hope that I could at least use the shifter -

Any tips and links would be greatly appreciated, I'm new to arcade hardware.


buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1758
  • Last login:March 22, 2024, 12:55:20 am
  • Is running at 15kHz
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #1 on: November 05, 2021, 11:33:55 pm »
I've never done it, but there are a few options out there. Take a look at this linked thread on a similar project, at least for the wheel:
http://forum.arcadecontrols.com/index.php/topic,165422.0.html

Does the shifter use switches for each gear, or pots, or what? Howard Casto on here had a project up recently to mod those for use on PC as well... http://forum.arcadecontrols.com/index.php/topic,165162.0.html
« Last Edit: November 05, 2021, 11:38:02 pm by buttersoft »

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #2 on: November 06, 2021, 05:50:00 am »
Thanks for the links buttersoft, I had come across the Initial D cab conversion post but there hadn't been an update on that thread for a while so I'm not sure if they ended up getting it working. The shifter thread I hadn't seen before and looks perfect for what I want to do, I'm hoping Howard Casto finishes the project soon and provides a wiring/how to guide. I familiar with PC's and tech in general but I'm very green to arcade hardware and electronics so I'm hoping for a guide to get started.

From the article you linked me and others that I've read it seems like the starting point is a Arduino Mega so I'll order one of those and start playing around and learning.

According to the manual it has two photosensors and microswitches, like I said I'm new to arcade hardware/electronics so I could be very wrong!


PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 08:55:04 am
  • Designated spam hunter
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #3 on: November 06, 2021, 02:30:55 pm »
According to the manual it has two photosensors and microswitches, like I said I'm new to arcade hardware/electronics so I could be very wrong!
Looking at pages 114-117 and 135 of the manual here, you are very correct.   :cheers:

The two microswitches determine if the shift lever is up (1/3/5), center (N), or down. (2/4/6)

The two photosensors determine if the shift lever is left (1/2/N), center (3/4/N), or right. (5/6/N)

Looks like WMMT and WMMT3 use the same shifter.

There's a more detailed parts breakdown on pages 112-113 and schematic on page 118 of the WMMT manual here.

If you look at the front top of index 3 on page 112, you see the flat tab that can block the left or right photosensor (index 20) depending on the shift lever position.


Scott
« Last Edit: November 06, 2021, 02:42:46 pm by PL1 »

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #4 on: November 12, 2021, 04:02:50 am »
Cheers for the reply PL1 :cheers: that's very helpful to know.

I've been playing around with an Ardunio Mega and the Namco steering wheel in my WMMT Cab and managed to get the board reading a signal from the wheel so I'm actually making (very minor) progress, its been a very steep learning curve! I'm not sure why the Mega board was recommended on some posts since it seems very difficult to make it read as a HID device in Windows or requires additional programming to convert the serial input, so I'll be picking up a Leonardo style board since its has everything built in and I'll be able to use the Joystick library which looks simple enough to get my head around.

My aim is to get the steering wheel and pedals working then move on to the shifter. I'll let you all know how it goes, if anyone has any tips tricks please post!

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 08:55:04 am
  • Designated spam hunter
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #5 on: November 12, 2021, 06:26:09 am »
My aim is to get the steering wheel and pedals working then move on to the shifter. I'll let you all know how it goes, if anyone has any tips tricks please post!
I'd say the best starting point is to define the controls/inputs you will eventually need.
  Wheel - 1 potentiometer
  Pedals - 2 potentiometers
  Shifter - 2 microswitches, 2 optical switches
  Buttons - Coin, View(?), Mode(?), etc.

Looks like it adds up to 3 pot and 7+ button/optical inputs.

I think baritonomarchetto did some encoder sketches that should cover the wheel, pedals, and buttons, but I can't find the related post(s).   :dunno
- Check out his project thread here for some inspiration.   :cheers:

The shifter code will be more complicated, but if you initialize the inputs correctly and set up the program loop so the shifter logic is at the end of the program loop and works something like this (it's not actual code), it should work:

if ShifterUpSwitch = pressed goto 135 subroutine
else if ShifterDownSwitch = pressed goto 246 subroutine
else gear = N
restart program loop

(135 subroutine)
if Shifterleft = pressed, gear = 1
else if ShifterRight = pressed, gear = 5
else gear = 3
restart program loop

(246 subroutine)
if Shifterleft = pressed, gear = 2
else if ShifterRight = pressed, gear = 6
else gear = 4
restart program loop


Scott

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Yesterday at 02:40:48 pm
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #6 on: November 13, 2021, 03:08:00 am »
Yes, I wrote an instructable about that:

https://www.instructables.com/ArcadeHID-Multi-HID-Arcade-Interface/

I will update that in the near future with version 2 of that interface board (giroscope added for virtual pinballs)

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 08:55:04 am
  • Designated spam hunter
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #7 on: November 13, 2021, 04:42:55 am »
Yes, I wrote an instructable about that:

https://www.instructables.com/ArcadeHID-Multi-HID-Arcade-Interface/
That's the one I was thinking about.   :cheers:

Looks like it would be easy to take the potentiometers.ino from GitHub and add pedals by changing:
- Line 11 to "true, true, true,    // X, Y, Z Axis"
- Line 14 to "true, true, true);   // No accelerator, brake, or steering"
- Lines 16-31 to add the accelerator/brake pins, variables, ranges, loop steps, and subroutines

Code: [Select]
/* ArcadeHID - steering wheel handling example
 * gamepad emulation
 * 
 * by Barito, 2021
*/

#include <Joystick.h>

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_GAMEPAD,
0, 0,                  // Button Count, Hat Switch Count
true, false, false,    // X, Y, Z Axis
false, false, false,   // No Rx, Ry, or Rz
false, false,          // No rudder or throttle
false, false, true);   // No accelerator, brake, or steering
 
const int steerPin = A0;
int steerValue;

void setup() {
Joystick.setXAxisRange(0, 1023); //Joystick.setXAxisRange(min, max);
Joystick.begin();
}

void loop() {
SteerWheel();
}

void SteerWheel(){
steerValue = analogRead(steerPin);
Joystick.setXAxis(steerValue);
}

The hard part is to add 7 inputs and 10 gamepad(?) button outputs.

Looks like you'd change line 10 to "10, 0,                  // Button Count, Hat Switch Count", but you'd also need to:
- Initialize the 7 input pins
- Read the pins
- Translate the 4 shifter inputs into the one of seven possible button presses that corresponds to the current position of the shifter (gear 1-6 or N)
- Output the regular (coin, view, mode) and shifter button presses


Scott

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #8 on: November 13, 2021, 07:41:29 am »
This is amazing, thanks for the help baritonomarchetto and PL1. I bought a Leonardo board today and using the code from ArcadeHID-potentiometers.ino I've got the steering wheel working in Teknoparrot! Now to wire up and add in the pedals to the sketch and test it out. Then I'll tackle the View, Mode and Coin buttons then try my luck with the shifter.

I'll send an update once I get the pedals working.

Cheers :cheers:

 

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #9 on: November 13, 2021, 10:03:58 am »
Made some slight progress tonight and will try continue tomorrow if I get some free time. I've updated Barito's code just by copying the logic of the original and adding in Brake and Accel and getting inputs from the pedals but some strange behavior.

The strange thing is when I Serial Print the Accel and Brake pedals they read in a weird range and do not start from 0, for example the Accel pedal reads from 490 - 920 (pedal fully compressed). Would this be an indicator of bad wiring/ground or something else??

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #10 on: November 13, 2021, 11:22:48 pm »
Here is the code so far so for Steering, Accelerator and Brake (thanks again to baritonomarchetto and PL1) - I'm still testing this out and still unsure about the pots for the Accel and Brake if they are working properly, would it be normal to have ranges of Brake - 350 to 765 and Accel - 490 to 915.

I would have though they would act similar to the Wheel pot and go from 0 - 1000, or are they designed like that so the react quicker to inputs?? :dizzy:

Code: [Select]
/* ArcadeHID - steering wheel handling example
 * gamepad emulation
 *
 * by Barito, 2021
 * Rev-2 - Steering, Accelerator and Brake
*/

#include <Joystick.h>

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_MULTI_AXIS,
0, 0,                  // Button Count, Hat Switch Count
false, false, false,    // X, Y, Z Axis
false, false, false,   //Rx, Ry, Rz
false, false,          //rudder, throttle
true, true, true);   //accelerator, brake, steering
 
const int steerPin = A0;
const int brakePin = A1;
const int accelPin = A2;
int steerValue;
int brakeValue;
int accelValue;


void setup() {
//Steering Options - X Axis or Steering
//Joystick.setXAxisRange(0, 1023); //Steering Wheel - Joystick.setXAxisRange(min, max);
Joystick.setSteeringRange(0, 960);

//Brake Options - Y Axis or Brake
//Joystick.setYAxisRange(0, 1023); //Brake Pedal - Joystick.setYAxisRange(min, max);
Joystick.setBrakeRange(366, 767);
Serial.begin(9600); // Testing analog input

//Accelerator Options - Z Axis or Acceleratro
//Joystick.setZAxisRange(0, 1023); //Accel Pedal - Joystick.setZAxisRange(min, max);
Joystick.setAcceleratorRange(490, 915);

//Start Joystick
Joystick.begin();
}

void loop() {
BrakePedal();
SteerWheel();
AccelPedal();
}

void SteerWheel(){
steerValue = analogRead(steerPin);
//Joystick.setXAxis(steerValue);
Joystick.setSteering(steerValue);
delay(1);
}

void BrakePedal(){
brakeValue = analogRead(brakePin);
//Joystick.setYAxis(brakeValue);
Joystick.setBrake(brakeValue);
Serial.println(brakeValue); // Testing analog input
delay(1);
}

void AccelPedal(){
accelValue = analogRead(accelPin);
//Joystick.setZAxis(accelValue);
Joystick.setAccelerator(accelValue);
delay(1);
}

This code is working with Teknoparrot 1.53 running Maximum Tune 5 the inputs all seem to registering and working. I have everything dismantled on a table so its bit hard to test to see if its all working properly but it seems ok.

Now to add in the buttons, any feed back on the code or info around the Accel and Brake pots would be awesome.

Cheers  :cheers:
« Last Edit: November 13, 2021, 11:40:16 pm by Vee21 »

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 08:55:04 am
  • Designated spam hunter
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #11 on: November 14, 2021, 04:22:38 am »
The strange thing is when I Serial Print the Accel and Brake pedals they read in a weird range and do not start from 0, for example the Accel pedal reads from 490 - 920 (pedal fully compressed). Would this be an indicator of bad wiring/ground or something else??
It's not that unusual for pedals to have a limited range of motion resulting in a limited range of values.

As long as the values aren't jumpy/jittery as you move through the range, it should work fine.

Calibrate the pedals in Windows Control Panel and in the in-game calibration menu and you should be fine.   :cheers:

Now to add in the buttons, any feed back on the code or info around the Accel and Brake pots would be awesome.
Baritonomarchetto also wrote ArcadeHID-Buttons.ino if you want to use keyboard keystrokes, but that could cause problems if the shifter is left in gear while the PC is booting.   :banghead:
- The "INPUT_PULLUP" command makes the input "active low" so ground applied to the input triggers the output.

I don't know how difficult it would be to make a composite HID device that is both gamepad and keyboard.   :dunno
- That would allow you to have keystrokes like ESC for exiting games in a multi-racer setup and allow you to keep the shifter on gamepad buttons so the PC doesn't think there's a stuck key while booting up.
- This might also help for some stand-alone games that only accept inputs from a single controller.


Scott

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Yesterday at 02:40:48 pm
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #12 on: November 14, 2021, 11:45:07 am »
Joystick library is compatibile with keyboard (built-in) library, so a composite HID is absolutely possible (and it's the point under Arcade HID vs most commercial interfaces)

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 08:55:04 am
  • Designated spam hunter
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #13 on: November 14, 2021, 02:14:53 pm »
Joystick library is compatibile with keyboard (built-in) library, so a composite HID is absolutely possible (and it's the point under Arcade HID vs most commercial interfaces)
Excellent.   :cheers:

Could I just merge the code from the "potentiometers.ino" and "ArcadeHID-Buttons.ino" sketches to make a composite HID or is there something else that needs to be added?

I assume that gamepad buttons can be added to the "potentiometers.ino" sketch like in this example, right?
- Please consider adding one or two buttons to your "potentiometers.ino" sketch since it seems like that would be a very widely-used feature.

Can the shifter decoding logic I described earlier work?
- I figured that it would be possible to read the four input pins to one set of variables then use "if-else" logic (or a truth table?) to determine the gear and pass the necessary info (one button pressed, the others not pressed) to a second set of variables that the joystick library would then use to output the button press.


Scott

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Yesterday at 02:40:48 pm
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #14 on: November 15, 2021, 01:18:23 pm »
If I add two buttons I also have to change the sketch name :D
Jokes apart, those sketches are only feasibility examples. The number of lines are kept at a minimum to help people figure how specific tasks can be approached and give a "kick" to start. They are based on well documented libraries and examples on how to use the joystick library, keyboard and mouse in full are all over the net. You only uave to start toying with them ;)
You can merge those codes and it will very likely work. In case of errors I am here :)
About the shifter decoding logic: as far as you have enought inputs for your switches, you can literally do everithing comes to your mind with those microcontroller boards

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 08:55:04 am
  • Designated spam hunter
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #15 on: November 15, 2021, 05:14:29 pm »
If I add two buttons I also have to change the sketch name :D
OK.  How about adding a "GamepadJoystickAndButtons.ino" sketch?

They are based on well documented libraries
"Well documented" assumes that people can find a good example and understand the code and comments.   ;)
- There are lots of not-so-great examples and comments that make sense to experienced coders but not to beginners.

About the shifter decoding logic: as far as you have enought inputs for your switches, you can literally do everithing comes to your mind with those microcontroller boards
The question wasn't, "Can an experienced coder put shifter logic into a gamepad sketch?" -- that is rather obvious.   ::)   :lol

The question is, "Do these general steps with two sets of variables (pin states and decoded button states) and if/else branching to subroutines sound like a good approach for adding shifter logic to a gamepad sketch, or is there a better way like a seven-line truth table to do it?"
- No sense sinking time into an ill-suited, convoluted, or highly inefficient approach.


Scott

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #16 on: November 15, 2021, 09:41:55 pm »
Just a quick update from my end, I've updated the sketch and now have the Mode and View buttons configured. I still haven't looked into getting the actual button LEDs to light up but switches work in control panel. I've just wired up the four digital input wires for the shifter and will be trying to get that working next. The sketch is based on baritonomarchetto sketch and the example included with the Joystick library.

Code: [Select]
/* ArcadeHID - steering wheel handling example
 * gamepad emulation
 *
 * by Barito, 2021
 * Rev-3 - Steering, Accelerator, Brake + 2 Buttons
*/

#include <Joystick.h>

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_MULTI_AXIS,
2, 0,                  // Button Count, Hat Switch Count
false, false, false,    // X, Y, Z Axis
false, false, false,   //Rx, Ry, Rz
false, false,          //rudder, throttle
true, true, true);   //accelerator, brake, steering
 
const int steerPin = A0;
const int brakePin = A1;
const int accelPin = A2;
int steerValue;
int brakeValue;
int accelValue;


void setup() {
//Steering Options - X Axis or Steering
//Joystick.setXAxisRange(0, 1023); //Steering Wheel - Joystick.setXAxisRange(min, max);
Joystick.setSteeringRange(0, 960);

//Brake Options - Y Axis or Brake
//Joystick.setYAxisRange(0, 1023); //Brake Pedal - Joystick.setYAxisRange(min, max);
Joystick.setBrakeRange(366, 767);
Serial.begin(9600); // Testing analog input

//Accelerator Options - Z Axis or Acceleratro
//Joystick.setZAxisRange(0, 1023); //Accel Pedal - Joystick.setZAxisRange(min, max);
Joystick.setAcceleratorRange(490, 915);

//Default Buttons - WMMT (Mode (Red Button) and View (Green Button))
//Initialise button pins
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);

//Start Joystick
Joystick.begin();
}

// Constant that maps the phyical pin to the joystick button.
const int pinToButtonMap = 7;

// Last state of the button
int lastButtonState[2] = {0,0};

void loop() {
BrakePedal();
SteerWheel();
AccelPedal();
ReadButtons();
}

void SteerWheel(){
steerValue = analogRead(steerPin);
//Joystick.setXAxis(steerValue);
Joystick.setSteering(steerValue);
delay(1);
}

void BrakePedal(){
brakeValue = analogRead(brakePin);
//Joystick.setYAxis(brakeValue);
Joystick.setBrake(brakeValue);
Serial.println(brakeValue); // Testing analog input
delay(1);
}

void AccelPedal(){
accelValue = analogRead(accelPin);
//Joystick.setZAxis(accelValue);
Joystick.setAccelerator(accelValue);
delay(1);
}

void ReadButtons(){
  // Read digital pin values
  for (int index = 0; index < 2; index++)
  {
    int currentButtonState = !digitalRead(index + pinToButtonMap);
    if (currentButtonState != lastButtonState[index])
    {
      Joystick.setButton(index, currentButtonState);
      lastButtonState[index] = currentButtonState;
    }
  }
  delay(50);
}


Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #17 on: November 15, 2021, 10:00:46 pm »

It's not that unusual for pedals to have a limited range of motion resulting in a limited range of values.

As long as the values aren't jumpy/jittery as you move through the range, it should work fine.

Calibrate the pedals in Windows Control Panel and in the in-game calibration menu and you should be fine.   :cheers:


Thanks mate good to know, I thought the pots might need replacing or something. They don't seem jittery when logging the values and I tested the accelerator pedal in the windows game controllers calibration and it seems to be working as it should as in part throttle and full throttle.
« Last Edit: November 15, 2021, 10:02:33 pm by Vee21 »

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #18 on: November 15, 2021, 11:57:59 pm »
So I've done some very basic code to check the status/logic of the switches on the shifter and map it to a "gear". Now to convert these to Joystick outputs! wish me luck!  :dizzy:

Code: [Select]
  //Setup Shifter pins
  const int bluePin = 10;
  const int yellowPin = 11;
  const int brownPin = 12;
  const int greenPin = 13;

void setup() {
  //start serial connection
  Serial.begin(9600);
  //configure Namco WMMT 6 Speed shifter pins as an input
  pinMode(10, INPUT_PULLUP); //Shifter (Blue)
  pinMode(11, INPUT_PULLUP); //Shifter (Yellow)
  pinMode(12, INPUT_PULLUP); //Shifter (Brown)
  pinMode(13, INPUT_PULLUP); //Shifter (Green)
}

void loop() {
  //Set state of Shifter Gear
  char shifterGear = '0';
  int bluePinState = digitalRead(bluePin);
  int yellowPinState = digitalRead(yellowPin);
  int brownPinState = digitalRead(brownPin);
  int greenPinState = digitalRead(greenPin);
  //print out the value current selected gear
  Serial.print("Blue Pin State:");
  Serial.println(bluePinState);
  Serial.print("Yellow Pin State:");
  Serial.println(yellowPinState);
  Serial.print("Brown Pin State:");
  Serial.println(brownPinState);
  Serial.print("Green Pin State:");
  Serial.println(greenPinState);
 
  if(bluePinState == 1 && yellowPinState == 1 && brownPinState == 1 && greenPinState == 1) {
    shifterGear = 'N';
    Serial.println(shifterGear);
  }
 
  if(bluePinState == 0 && yellowPinState == 1 && brownPinState == 0 && greenPinState == 1) {
    shifterGear = '6';
    Serial.println(shifterGear);
  }

  if(bluePinState == 1 && yellowPinState == 1 && brownPinState == 0 && greenPinState == 0) {
    shifterGear = '5';
    Serial.println(shifterGear);
  }
 
  if(bluePinState == 0 && yellowPinState == 1 && brownPinState == 1 && greenPinState == 1) {
    shifterGear = '4';
    Serial.println(shifterGear);
  }

  if(bluePinState == 1 && yellowPinState == 1 && brownPinState == 1 && greenPinState == 0) {
    shifterGear = '3';
    Serial.println(shifterGear);
  }

  if(bluePinState == 0 && yellowPinState == 0 && brownPinState == 1 && greenPinState == 1) {
    shifterGear = '2';
    Serial.println(shifterGear);
  }

  if(bluePinState == 1 && yellowPinState == 0 && brownPinState == 1 && greenPinState == 0) {
    shifterGear = '1';
    Serial.println(shifterGear);
  }
   
  delay(1000);
 
}

 :cheers:

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9394
  • Last login:Today at 08:55:04 am
  • Designated spam hunter
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #19 on: November 16, 2021, 03:07:43 am »
Looks like a solid start on the "truth table" approach.   :cheers:

You may want to find the answers to these questions before you proceed too much further.

1. What type of input does Teknoparrot/MAME and the game(s) you plan to use need from the shifter?
- One button for each gear 1-6, but none for Neutral?
- One button for each gear 1-6 and a button for Neutral?
- A sequential shifter input?

2. Do the emulators/games you plan to use care if the shifter sends gamepad button presses or keystrokes?
- Some games only allow inputs from a single device.

3. Do the emulators/games you plan to use care if gamepad outputs are dinput or xinput?


Scott

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #20 on: November 16, 2021, 05:18:54 am »
Looks like a solid start on the "truth table" approach.   :cheers:

You may want to find the answers to these questions before you proceed too much further.

1. What type of input does Teknoparrot/MAME and the game(s) you plan to use need from the shifter?
- One button for each gear 1-6, but none for Neutral?
- One button for each gear 1-6 and a button for Neutral?
- A sequential shifter input?

2. Do the emulators/games you plan to use care if the shifter sends gamepad button presses or keystrokes?
- Some games only allow inputs from a single device.

3. Do the emulators/games you plan to use care if gamepad outputs are dinput or xinput?


Scott

Thanks!

1) The games I want to play are all in Tekoparrot - WMMT, Initial D, Sega Racing Classics and Battle Gear. Some of these games require a Up/Down style shifter so I'm going to have to try figure something out for that, would you guys have any ideas?

2) Teknoparrot seems to be ok with gamepad inputs and/or keyboard inputs.

3) I've currently got Teknoparrot configured to use direct input which seems to be working fine.

I have the first complete working draft code which incorporates the Steering Wheel, Brake/Accel, View/Mode buttons and the 6 Speed Shifter!  :cheers:
I tested it out on WMMT on Teknoparrot, its basic and not efficient but seems to do the job everything seems to be working as it should.

Still can't believe its all working!  :laugh: thanks again for the help.

Here is the complete code for anyone interested. If anyone is reading this and has some ideas to make the code more efficient please share!

Code: [Select]
#include <Joystick.h>

Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_MULTI_AXIS,
8, 0,                  // Button Count, Hat Switch Count
false, false, false,    // X, Y, Z Axis
false, false, false,   //Rx, Ry, Rz
false, false,          //rudder, throttle
true, true, true);   //accelerator, brake, steering

//Setup steering, brake and accel pins
const int steerPin = A0;
const int brakePin = A1;
const int accelPin = A2;
//Setup Shifter pins
const int bluePin = 10;
const int yellowPin = 11;
const int brownPin = 12;
const int greenPin = 13;
//Setup Mode and View pins
const int modePin = 7;
const int viewPin = 8;
//Setup Values
int steerValue;
int brakeValue;
int accelValue;


void setup() {

//Initialise button pins
pinMode(7, INPUT_PULLUP); //Mode
pinMode(8, INPUT_PULLUP); //View
pinMode(10, INPUT_PULLUP); //Shifter (Blue)
pinMode(11, INPUT_PULLUP); //Shifter (Yellow)
pinMode(12, INPUT_PULLUP); //Shifter (Brown)
pinMode(13, INPUT_PULLUP); //Shifter (Green)

//Setup buttons - Mode, View, Gears 1-6
Joystick.setButton(0, 0);
Joystick.setButton(1, 0);
Joystick.setButton(2, 0);
Joystick.setButton(3, 0);
Joystick.setButton(4, 0);
Joystick.setButton(5, 0);
Joystick.setButton(6, 0);
Joystick.setButton(7, 0);

//Steering Options - X Axis or Steering
//Joystick.setXAxisRange(0, 1023); //Steering Wheel - Joystick.setXAxisRange(min, max);
Joystick.setSteeringRange(0, 960);

//Brake Options - Y Axis or Brake
//Joystick.setYAxisRange(0, 1023); //Brake Pedal - Joystick.setYAxisRange(min, max);
Joystick.setBrakeRange(400, 767);

//Accelerator Options - Z Axis or Acceleratro
//Joystick.setZAxisRange(0, 1023); //Accel Pedal - Joystick.setZAxisRange(min, max);
Joystick.setAcceleratorRange(490, 915);

//Start Joystick
Joystick.begin();
}

//Start loop
void loop() {
  BrakePedal();
  SteerWheel();
  AccelPedal();
  ReadButtons();
  ReadShifter();
}

void SteerWheel(){
  steerValue = analogRead(steerPin);
  //Joystick.setXAxis(steerValue);
  Joystick.setSteering(steerValue);
  delay(1);
}

void BrakePedal(){
  brakeValue = analogRead(brakePin);
  //Joystick.setYAxis(brakeValue);
  Joystick.setBrake(brakeValue);
  Serial.println(brakeValue); // Testing analog input
  delay(1);
}

void AccelPedal(){
  accelValue = analogRead(accelPin);
  //Joystick.setZAxis(accelValue);
  Joystick.setAccelerator(accelValue);
  delay(1);
}

void ReadButtons(){
 
  //Set state of buttons
  int modePinState = digitalRead(modePin);
  int viewPinState = digitalRead(viewPin);

  if(modePinState == 1 ) {
    Joystick.setButton(0, 0);
  }
  else {
    Joystick.setButton(0, 1);
  }

  if(viewPinState == 1) {
    Joystick.setButton(1, 0);
  }
  else{
    Joystick.setButton(1, 1);
  }

  delay(50);
}

void ReadShifter(){
 
  //Set state of Shifter Gear
  int bluePinState = digitalRead(bluePin);
  int yellowPinState = digitalRead(yellowPin);
  int brownPinState = digitalRead(brownPin);
  int greenPinState = digitalRead(greenPin);

  //Neutral
  if(bluePinState == 1 && yellowPinState == 1 && brownPinState == 1 && greenPinState == 1) {
    Joystick.setButton(2, 0);
    Joystick.setButton(3, 0);
    Joystick.setButton(4, 0);
    Joystick.setButton(5, 0);
    Joystick.setButton(6, 0);
    Joystick.setButton(7, 0);
  }
 
  //Gear 6
  if(bluePinState == 0 && yellowPinState == 1 && brownPinState == 0 && greenPinState == 1) {
    Joystick.setButton(2, 0);
    Joystick.setButton(3, 0);
    Joystick.setButton(4, 0);
    Joystick.setButton(5, 0);
    Joystick.setButton(6, 0);
    Joystick.setButton(7, 1);
  }
 
  //Gear 5
  if(bluePinState == 1 && yellowPinState == 1 && brownPinState == 0 && greenPinState == 0) {
    Joystick.setButton(2, 0);
    Joystick.setButton(3, 0);
    Joystick.setButton(4, 0);
    Joystick.setButton(5, 0);
    Joystick.setButton(6, 1);
    Joystick.setButton(7, 0);
  }

  //Gear 4
  if(bluePinState == 0 && yellowPinState == 1 && brownPinState == 1 && greenPinState == 1) {
    Joystick.setButton(2, 0);
    Joystick.setButton(3, 0);
    Joystick.setButton(4, 0);
    Joystick.setButton(5, 1);
    Joystick.setButton(6, 0);
    Joystick.setButton(7, 0);
  }

  //Gear 3
  if(bluePinState == 1 && yellowPinState == 1 && brownPinState == 1 && greenPinState == 0) {
    Joystick.setButton(2, 0);
    Joystick.setButton(3, 0);
    Joystick.setButton(4, 1);
    Joystick.setButton(5, 0);
    Joystick.setButton(6, 0);
    Joystick.setButton(7, 0);
  }

  //Gear 2
  if(bluePinState == 0 && yellowPinState == 0 && brownPinState == 1 && greenPinState == 1) {
    Joystick.setButton(2, 0);
    Joystick.setButton(3, 1);
    Joystick.setButton(4, 0);
    Joystick.setButton(5, 0);
    Joystick.setButton(6, 0);
    Joystick.setButton(7, 0);
  }

  //Gear 1
  if(bluePinState == 1 && yellowPinState == 0 && brownPinState == 1 && greenPinState == 0) {
    Joystick.setButton(2, 1);
    Joystick.setButton(3, 0);
    Joystick.setButton(4, 0);
    Joystick.setButton(5, 0);
    Joystick.setButton(6, 0);
    Joystick.setButton(7, 0);
  }
  delay(50);
}


The next step for me is cleaning up the cab and putting it all back together, then I'll look into sequential style gear shifting (up/down) and getting FFB working which looks like it could be a mission  :dizzy:
« Last Edit: November 16, 2021, 05:48:22 am by Vee21 »

baritonomarchetto

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:Yesterday at 02:40:48 pm
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #21 on: November 17, 2021, 02:37:28 pm »
I am not a coder but a tinkerer, so I am not the person that could give best practice informations to anyone, unfortunately. There are some modifications to your actual code I would do, anyway:
- being gear positions mutually exclusive, you could have used "else if" statements instead of "if" after the neutral position declaration
- you don't need all those delay functions in your code: remove them all. If you will notice some "instability" (unlikely), add a 5ms (or even less) single delay function at the end of the loop.
- it would be more efficient to check switches and send the button press/release at state change instead of at every loop. This makes the code a little bit more complex and then less easy to modify... If you are curious, I have used such approach in my monsterbash and earthshaker boards (and jammarduino before them...I am at the phone now, but some googlefu will suffice to find them).

When I say "well documented libraries" I refer to authors instuctions about the use of those libraries, not to the inner working routines underneath pre digested functions the coder gives to the final user. In addition, every library has a full set of (often well commented) "official" examples that, combined with dedicated examples shared by community members (like those I wrote for our hobby) will help new users to move the first steps (and, like in this case, reach the final goal!)

Vee21

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19
  • Last login:February 01, 2022, 07:08:14 am
  • I want to build my own arcade controls!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #22 on: January 18, 2022, 06:22:00 am »
Thanks baritonomarchetto, I’ve been playing around with the code based on your suggestions to make it bit neater and more efficient.

I’ve been busy cleaning up the cab, sanding painting and putting it all back together and finally enjoying it.

My next goal is to get Force Feedback working, games just aren’t the same without it…

The steering wheel has a potentiometer attached to the motor and the wheel it’s self is attached direct to the motor so it’s a direct drive style setup not a belt driven setup.

From what I’ve researched I’ll need at a minimum a motor driver, the BT7960 seems like the go to choice so I’ll be picking up one of those. I’m still unsure how it’s all going to work together, has anyone done something like this before?

Empo

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 34
  • Last login:October 05, 2022, 05:47:50 pm
  • I want to build my own arcade flux capacitors!!
Re: Maximum Tune 3 (WMMT 3DX) - Cab Conversion Help
« Reply #23 on: January 20, 2022, 06:54:51 pm »
Following this!  :)  Great job so far!