Skip to content

Converting CH Products Pedals to USB

19 January, 2015

This was a nice quick project.

IMG_20150119_232701

I had these CH Products Pro Pedals lying around for ages, and they were useless because they were gameport not USB and I haven’t had a computer with a gameport since about 2008. I found them again recently while doing something else, so in a spirit of procrastination I opened up the case and threw in a Teensy 2.0.

I don’t know how gameport wiring works. The pedals have three 100K potentiometers, for yaw and the two toe-brakes. They were wired up as rheostats, or variable resistors: two wires per pot, connecting to one end of the track and to the wiper. I don’t know how to interface with potentiometers wired up this way, so I added a third wire to each pot, connecting the other end of each track, so they’re now acting as potential dividers rather than as rheostats.

If you’ve done the PJRC Teensy tutorials, you’ll know how to wire up a potentiometer this way to a Teensy board. One end of each track connects to AREF. The other end connects to ground. The wipers each connect to a separate analogue input pin – remembering they’re numbered differently to the IO pins. I’ve read somewhere that pots in the range 1K-100K are suitable to use with Teensy boards as potential dividers. Lower resistance means higher current flow and therefore power consumption; higher resistance means more signal noise.

I used a Teensy 2.0, which gives 8-bit conversion, meaning there are 1024 steps between full-left and full-right yaw. If I’d used a Teensy 3 I’d have got something like 12-bit conversion, or approx 8000 steps between full-left and full-right. I’m not sure this would make much of a difference though; the tiny size of the Teensy 2.0 made it easier to fit inside the case.

I think the yaw pot is worn – when centred, the Teensy reads the yaw pot as being at 600/1024 when it ought to be 512/1024. I discovered this using serial-output while testing the Arduino sketch. The code will interpolate the yaw input so that 600 is neutral. Ideally I’d replace the yaw pot with a Hall sensor.

Reassembling the pedals was a bit of a puzzle! Sorry for the lack of photos…

This is the code running on the Teensy inside the pedal’s case:

// joystick axis mapping for CH Pedals with Teensy 2 Plain on board.

const int Led = 11;

const int LeftBrakePin = 0;
const int RightBrakePin = 1;
const int YawPin = 2;
const float YawCentre = 600;

void setup() {
  Serial.begin(9600);
  Joystick.X(1023);
  Joystick.Y(1023);
  Joystick.Z(YawCentre);  
}

void loop() {
  Joystick.X(analogRead(LeftBrakePin));
  Joystick.Y(analogRead(RightBrakePin));
  float yaw = analogRead(YawPin);
  if (yaw <= YawCentre) {
    // (x-x1)/(y-y1) = (x2-x1)/(y2-y1)
    // y = y1 + (x-x1)(y2-y1)/(x2-x1)
    Joystick.Z((yaw*512)/YawCentre);
  }
  else {
    Joystick.Z(512 + (yaw-YawCentre)*512/(1023-YawCentre));
  }
  Serial.print("X: ");
  Serial.print(analogRead(LeftBrakePin));
  Serial.print("\tY: ");
  Serial.print(analogRead(RightBrakePin));
  Serial.print("\tZ: ");
  Serial.println(yaw);
}
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s