Hello
I am renovating a Sega Rally 2 to be a MAME / XBOX360 / PS driving simulator.
I have been searching for a way to connect my original Sega pedals to work.
If you use a computer there is no problem. But the problems begins when you want to connect to a console.
I changed the potentiometers to 10K 300 degrees ones but I did not get it to go from 0-10K got about 7,5K span.
So my next way of attacking the problem was to use an Arduino to solve the problem.
I think I have the solution and since I have not seen any good solution I will share it here.
If you use a Fanatec wheel you will have to connect the potentiometers to get 5v output when you dont press the pedal.
If you use a Logitech wheel you will have to connect the potentiometer to get 0v output when you dont press the pedal.
The next thing you have to do is because Arduino uno dont have real analog output it is PWM output.
You have to use a simple DAC to convert it to a real analog output. Build a RC filter with a 10k resistor and a 10 microfarad capacitor.
The next thing is because the DAC makes the voltage drop you have to use a OP-amplifier. LM358
I have made a simple wiring diagram for you if you need.
To get the values that your pedals output uncomment the part in the sketch that is equivalent to the pedal you want to calibrate
start up the serial monitor and press the pedal to max and min and put in the values in the sketch.
Do the same for the other pedal. If you use a Fanatec wheel you will get a high value span and Logitech a low value span.
Put the lowest value a little higher than your lowest value the pedal could output and the highest value a little lower than the highest value the pedal could output to
get a deadzone.
I could change the code to always have a auto calibration function that starts everytime you restart the Arduino. When you start it you have to depress the pedals one at a time to get the high and low level of the pedals.
The downside is that you dont have any deadzone so it gets very sensitive.
Hope it helps someone
Here is the sketch
// Arduino sketch for SEGA or other pedals to connect to Fanatec or Logitech G2X wheels. Made by Robert Andersson.
// Any value of potentiometers work.
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin1 = A0; // Analog input pin that the Gas potentiometer is attached to
const int analogOutPin1 = 9; // Analog output pin that the Gas output is attached to
const int analogInPin2 = A1; // Analog input pin that the Brake potentiometer is attached to
const int analogOutPin2 = 10; // Analog output pin that the Brake output is attached to
int sensorValue1 = 0; // value read from the Gas pot
int outputValue1 = 0; // value output to the Gas PWM (analog out)
int sensorValue2 = 0; // value read from the Brake pot
int outputValue2 = 0; // value output to the Brake PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog Gas and Brake in value:
sensorValue1 = analogRead(analogInPin1);
sensorValue2 = analogRead(analogInPin2);
// map it to the range of the Gas and Brake analog out:
outputValue1 = map(sensorValue1, 370, 1020, 0, 255); // this is the values that your gaspedal put out as most and least and gets mapped to 0-255
outputValue2 = map(sensorValue2, 370, 850, 0, 255); // this is the values that your brake put out as most and least and gets mapped to 0-255
// in case the Gas or Brake sensor value is outside the range force it to stay within 0-255
outputValue1 = constrain(outputValue1, 0, 255);
outputValue2 = constrain(outputValue2, 0, 255);
// change the Gas analog out value:
analogWrite(analogOutPin1, outputValue1);
analogWrite(analogOutPin2, outputValue2);
// print the results to the serial monitor:
//Uncomment the next four rows to see the most and least values your gaspedal gives
//Serial.print("sensorGas = " );
//Serial.print(sensorValue1);
//Serial.print("\t outputGas = ");
//Serial.println(outputValue1);
//Uncomment the next four rows to see the most and least values your brakepedal gives
//Serial.print("sensorBrake = " );
//Serial.print(sensorValue2);
//Serial.print("\t outputBrake = ");
//Serial.println(outputValue2);
// wait 2 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(2);
}