1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Tutorial DIY 3D printed Sim Racing Hydraulic pedals SRT

Discussion in 'DIY peripherals' started by Lebois, Jan 26, 2020.

  1. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    Well reversing the GND wires from pin 6 to Pin1 and the VCC from pin 1 to Pin 6 also doesn't work connecting the pedals to the base of the g27. Neither the accelerator, which is a potentiometer, nor the brake, which is a sensor. In arduino leonardo it works but only the throttle. The brake does not respond. I've put a 500 PSI pressure sensor on it. I think that could be the problem, that maybe it needs a lot of strength to make it work.
  2. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    Even with hand it should work. Can you post pictures of the wiring ?
  3. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    I can pass you a photo but there are many messy cables. I summarize you.

    I have 3 pedals, clutch, brake, accelerator. the accelerator goes with potentiometer and brake and clutch with pressure sensor. the brake has a 500 psi sensor and the clutch has a 300 psi sensor. both the potentiometer and the 2 sensors I have the 3 red wires attached and I suppose they are VCC the red one. then the GND (black wire) of the 2 sensors and potentiometer are linked. then the green cable that would be the signal vam separately each one on a pin of the VGA connector.

    In short, the 3 red wires (vcc?) I have jumpered and the 3 ground wires (black) I have jumpered. The 3 green signal cables are separated.
    Last edited: Sep 11, 2020
  4. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    I leave you some attached images. in the first you can see the wiring. It's very messy. You can see how I have it soldered with pins. this way it lets me connect it either by arduino leonardo or by vga connected to the base of the g27.

    In the second image, see what it does when connecting only the brake and clutch to the arduino. and in the third image is what it does when connecting the throttle.

    Attached Files:

  5. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    Hi ! Please try the following code with each pedal :
    Code:
    int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3
                        // outside leads to ground and +5V
    int val = 0;  // variable to store the value read
    
    void setup() {
      Serial.begin(9600);           //  setup serial
    }
    
    void loop() {
      val = analogRead(analogPin);  // read the input pin
      Serial.println(val);          // debug value
    delay(100);
    }
  6. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    On the first picture, where does the gas wire go ?
  7. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    In the first image of the gas cable I have it disconnected because at that time I only had the clutch connected to the arduino to test. the gas cable that is the accelerator is soldered to the signal pin of the potentiometer.
  8. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    @Lebois. Placing the parameters that you tell me in the arduino IDE, the pedal of both the brake and the clutch already responds to me. It goes perfect. But I do not understand anything about arduino so I do not know what I have to put so that the 3 pedals respond to me.

  9. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    It seems that the problem is in the parameters that I copy / paste in the arduino IDE. If I put these parameters, when iracing only detects the accelerator but the accelerator pedal is very slow. In Windows only the accelerator detects me.

    // V1.0 : ajout du mode verbose
    // V1.1 : correction
    // Disable verbose mode once you have calibrated your pedals to make work at full speed !
    // comment either out to disable || Mettre en commentaire pour désactiver

    #define USE_ACCEL
    //#define USE_BRAKE
    //#define USE_CLUTCH
    #define VERBOSE_MODE //allow to tune min and max

    int AcceleratorPin = A0;
    int BrakePin = A1;
    int ClutchPin = A2;

    int minAccelerator = 210;
    int maxAccelerator = 595;
    int minBrake = 0 ;
    int maxBrake = 1023;
    int minClutch = 0;
    int maxClutch = 1023;

    int lastAcceleratorState ;
    int lastBrakeState;
    int lastClutchState;
    int currentAcceleratorState;
    int currentBrakeState;
    int currentClutchState;

    #include "Joystick.h"
    Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
    JOYSTICK_TYPE_MULTI_AXIS, 4, 0,
    true, false, false, false, false, false,
    false, false, true, true, false);

    void setup() {
    #ifdef VERBOSE_MODE
    Serial.begin(9600);
    Serial.println("Verbose mode activated");
    #endif

    Joystick.setXAxisRange(minClutch, maxClutch);
    Joystick.setAcceleratorRange(minAccelerator, maxAccelerator);
    Joystick.setBrakeRange(minBrake, maxBrake);
    Joystick.begin();
    lastAcceleratorState = analogRead(AcceleratorPin);
    lastBrakeState = analogRead(BrakePin);
    lastClutchState = analogRead(ClutchPin);
    delay(1000); //safety delay to flash the code
    }

    void loop() {






    #ifdef USE_ACCEL

    int currentAcceleratorState = analogRead(AcceleratorPin);

    if (currentAcceleratorState != lastAcceleratorState)
    {
    Joystick.setAccelerator(currentAcceleratorState);
    lastAcceleratorState = currentAcceleratorState;
    }
    #ifdef VERBOSE_MODE
    Serial.println("acceleration ");
    Serial.println(currentAcceleratorState);
    delay(500);
    #endif
    #endif

    #ifdef USE_BRAKE
    int currentBrakeState = analogRead(BrakePin);
    if (currentBrakeState != lastBrakeState)
    {
    Joystick.setBrake(currentBrakeState);
    lastBrakeState = currentBrakeState;
    }
    #ifdef VERBOSE_MODE
    Serial.println("frein ");
    Serial.println(currentBrakeState);
    delay(500);
    #endif
    #endif

    #ifdef USE_CLUTCH
    int currentClutchState = analogRead(ClutchPin);
    if (currentClutchState != lastClutchState)
    {
    Joystick.setXAxis(currentClutchState);
    lastClutchState = currentClutchState;
    }
    #ifdef VERBOSE_MODE
    Serial.println("embrayage ");
    Serial.println(currentClutchState);
    delay(500);
    #endif
    #endif

    delay(10);
    }


    If I put this other parameter in arduino IDE it detects the 3 pedals separately in windows but in iracing it does not detect them.

    int analogPin = A3; // potentiometer wiper (middle terminal) connected to analog pin 3
    // outside leads to ground and +5V
    int val = 0; // variable to store the value read

    void setup() {
    Serial.begin(9600); // setup serial
    }

    void loop() {
    val = analogRead(analogPin); // read the input pin
    Serial.println(val); // debug value
    delay(100);
    }
  10. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    Hi :
    Remove the // to use three pedals :
    #define USE_ACCEL
    //#define USE_BRAKE
    //#define USE_CLUTCH

    becomes :
    #define USE_ACCEL
    #define USE_BRAKE
    #define USE_CLUTCH


    You can use the arduino monitor (M or ctrl+M) to see which value are sent back, and calibrate your pedals :
    int minAccelerator = 210;
    int maxAccelerator = 595;
    int minBrake = 0 ;
    int maxBrake = 1023;
    int minClutch = 0;
    int maxClutch = 1023;


    Once the pedals are calibrated, add "//" to
    #define VERBOSE_MODE //allow to tune min and max
    becomes :
    //#define VERBOSE_MODE //allow to tune min and max
    The arduino will stop to send datas to the monitor, and will work faster.

    By the way, if you have problems with the joystick library, please use the online arduino editor, all the libraries are included.
  11. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    I have problems loading the skech in the arduino IDE, it gives me errors because I have already had problems with colorduino in the past with the libraries. Mysteriously, it still works for me even though I get an error loading skech.

    I'll look at editing the commands to see.
  12. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    Now if all 3 pedals work for me. Video here



    I do not execute the brake because I have it without an axle, waiting for the axles from china to arrive. But the clutch does not reach 100% of the travel and the brake makes com, or a little interference even though I am not touching the pedal.
  13. Craig Bartlett

    Craig Bartlett New Member

    Joined:
    Sep 4, 2020
    Messages:
    5
    Balance:
    29Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    Arduino
    Great work, this is definitely a project I'd like to try out. Are there print files available for the P1 Accelerator and clutch? I can only find the P1 brake pedal on Thingiverse.
  14. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    on the main page you have a link to the lebois website. there you find everything you need to press the pedals.
  15. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    @7HUND3R If you want the accelerator to reach the 100%, you need to change the value of maxAccelerator in the arduino code.
    Regarding the brake, is it fully connected ? If the cable isn't connected, it's normal to have the value moving around. You can also print the 3D printed axle.
    @craig Barlett : P1 throttle and clutch aren't released yet. But the clutch pedal will be like the brake pedal. I will just change the brake calipper for a slave cylinder.
    • Like Like x 1
    • Informative Informative x 1
  16. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    New pedals compatible :
    [​IMG]
    • Like Like x 1
  17. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    I can print the shafts but I would need the bearings even if right?
  18. Lebois

    Lebois (maybe I am wrong, but who knows...)

    Joined:
    Dec 10, 2018
    Messages:
    350
    Occupation:
    Math teacher
    Location:
    France
    Balance:
    2,544Coins
    Ratings:
    +206 / 2 / -0
    My Motion Simulator:
    2DOF
    You need the KP001 or the M12 axle ?
  19. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    The kp001 is made up of 2 pieces, the k001 which is the outer casing and the p001 which is the bearing. What is 12mm, I have the k001. I am missing the p001.

    I have this
    https://www.thingiverse.com/thing:4496045

    I am missing this
    [​IMG]
  20. 7HUND3R

    7HUND3R Active Member

    Joined:
    May 25, 2020
    Messages:
    154
    Balance:
    1,159Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    Arduino
    I am also adding vibrate motors.

    Attached Files: