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

1dof Project from a chair with a stepper servo drive

Discussion in 'DIY Motion Simulator Projects' started by natpoh, Jul 14, 2025 at 09:14.

  1. natpoh

    natpoh New Member

    Joined:
    Jul 4, 2025
    Messages:
    4
    Balance:
    34Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Arduino
    Concept:

    To create an inexpensive project for a deeper immersion into sim racing without cluttering up the space with a large cockpit.

    We have a regular office chair with a rocking chair option. Our task is to remove the spring and replace it with a servo drive. We are not changing the rest of the functionality. upload_2025-7-14_10-4-29.png upload_2025-7-14_10-5-23.png

    Calculations showed that a 2 Nm motor would be sufficient to generate a lifting force of 100 kg. However, we decided to play it safe and go for an 8.5 Nm motor. [​IMG]
    Stepper servo drive with encoder (feedback) 86EBP145ALC-TK0 + HBS86H, 8.5 Nm
    We will also need a SHV1605 screw and a 10-14 mm D32L45 rigid coupling.
    upload_2025-7-14_10-12-10.png
    upload_2025-7-14_10-12-42.png
  2. natpoh

    natpoh New Member

    Joined:
    Jul 4, 2025
    Messages:
    4
    Balance:
    34Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Arduino
    We take apart the chair, remove the spring, drill a hole to put the axle in, cut the axle to size, and screw it on.
    upload_2025-7-14_10-26-50.png
    upload_2025-7-14_10-27-2.png
    upload_2025-7-14_10-27-37.png
  3. natpoh

    natpoh New Member

    Joined:
    Jul 4, 2025
    Messages:
    4
    Balance:
    34Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Arduino
    Code:
    // Pins for connecting to HBS86H driver
    #define PUL_PIN 9  // STEP — to PUL+
    #define DIR_PIN 8  // DIR+
    #define ENA_PIN 7  // ENABLE
    #define MICROSTEP_PER_REV 1000     // Microsteps per revolution, set according to driver configuration
    #define MAX_REVOLUTIONS    2       // Number of revolutions corresponding to SimTools maximum (adjust for your actuator)
    long targetPosition = 0;           // Desired position (in steps)
    long currentPosition = 0;          // Current position (in steps)
    void setup() {
      Serial.begin(115200);
      pinMode(PUL_PIN, OUTPUT);
      pinMode(DIR_PIN, OUTPUT);
      pinMode(ENA_PIN, OUTPUT);
      digitalWrite(ENA_PIN, LOW); // LOW — enable driver (for HBS86H, usually LOW = ON)
    }
    void loop() {
      static String inputString = "";
      static bool inputStarted = false;
      // ==== Read command character-by-character for reliability ====
      while (Serial.available()) {
        char inChar = (char)Serial.read();
        if (inChar == '[') {
          inputStarted = true;
          inputString = "";    // start collecting the string
        } else if (inChar == ']') {
          inputStarted = false;
          inputString.trim();
          processCommand(inputString);
          inputString = "";
        } else {
          if (inputStarted) inputString += inChar;
        }
      }
    }
    // ==== COMMAND PROCESSING ====
    void processCommand(String cmd) {
      // Example: "A512"
      if (cmd.length() < 2) return;
      if (cmd.charAt(0) == 'A') {
        int rawValue = cmd.substring(1).toInt();      // numeric value after 'A'
        long mapped = mapPosition(rawValue);
        if (mapped != targetPosition) {
          targetPosition = mapped;
          moveToPosition(targetPosition);
        }
      }
    }
    // ==== MAPPING SimTools values (0-1023) => step count (e.g., 0 ... 8000) ====
    long mapPosition(int val) {
      long minStep = 0;
      long maxStep = long(MAX_REVOLUTIONS) * long(MICROSTEP_PER_REV); // e.g., 2 × 1000 = 2000 steps
      if(val < 0) val = 0;
      if(val > 1023) val = 1023;
      return map(val, 0, 1023, minStep, maxStep);
    }
    // ==== MOVE to the desired position ====
    void moveToPosition(long target) {
      long stepsToGo = target - currentPosition;
      if (stepsToGo == 0) return;     // already in place
      int dir = (stepsToGo >= 0) ? HIGH : LOW;
      digitalWrite(DIR_PIN, dir);
      stepsToGo = abs(stepsToGo);
      for (long i = 0; i < stepsToGo; ++i) {
        digitalWrite(PUL_PIN, HIGH);
        delayMicroseconds(250);      // step speed — adjust for your motor!
        digitalWrite(PUL_PIN, LOW);
        delayMicroseconds(250);
        currentPosition += (dir == HIGH) ? 1 : -1;
      }
    }
    • Creative Creative x 1
  4. natpoh

    natpoh New Member

    Joined:
    Jul 4, 2025
    Messages:
    4
    Balance:
    34Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Arduino
    upload_2025-7-14_10-40-19.png
    We received a chair that can be used as a regular chair, but can also be used as a single-axis sim racing chair.