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

Compact, Budget 6-ish DOF g-seat with integrated motion using office chair - Copy Build

Discussion in 'DIY Motion Simulator Projects' started by miketunes, Jan 12, 2024.

  1. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    I'm making JumpingCoin's G-seat and need some help.
    Previous Thread:
    https://www.xsimulator.net/communit...otion-using-office-chair-and-rc-servos.17323/

    I could use some guidance on the simtools/arduno setup:
    Is the code from 11/17/2020 still current, should I add that to setup - run once, or main - run repeatedly?

    I have simtools 3 beta installed and have added the serial interface, but not sure where to get the values for for the outputs, I have my com port selected and I'm assuming 115200/8/None/1 should work.
  2. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    Hi @miketunes, the code that I had posted should still be current. As mentioned, the code needs to be compiled on the Arduino card itself. (Note that I'm not the original author of the code; I just adapted it to make it easier for others to use it.)

    There is a section in the code that you'll need to modify to fit your project (search for "Users may need to modify the below section."). I tried to make the code as easily adaptable as possible.
    At minimum, you'll need to modify these variables:
    kActuatorCount
    kPins
    kActuatorName
    kPosAndNeg[kActuatorCount]
    kActuatorScale

    Once you make the necessary changes to these variables, you would only need to compile the code once on the Arduino (assuming those changes are adequate). Of course, each time you want to tweak the code, you'll need to recompile it. From there, everything else is configured within Simtools.

    I believe @noorbeast has graciously posted some links for how to compile the code on the Arduino card.

    As for the values that need to be entered into the Simtools application, below are the values that I initially used.

    The "Interface Output" will need to be updated to match the letters corresponding to the kActuatorName variable in the Arduino code. Basically, you are specifying the servo letter (identified in the code) and pairing it with an axis DOF (e.g. L<Axis1a>~), and you'd repeat this for all servos.

    Interface Type : Serial
    Comport : is at every individual
    BitsPerSec : 9600
    Data Bits : 8
    Parity : None
    Stop Bits : 1
    Bit Range : 8
    Output Type : Decimal
    Interface Output : L<Axis1a>~R<Axis2a>~T<Axis3a>~B<Axis4a>~S<Axis5a>~
    Output Rate : 10ms

    Note that I've only used Simtools 2.x, but I'd imagine most of it should be similar. Also, as @noorbeast mentioned, you should definitely read up on the Simtools documention.

    Best of luck on your project!
  3. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    Thanks for the update. Have some more questions.
    Does the code go in the startup or main section when compiling?
    Each servo needs a ground wire to the arduino right? I only see 3 ground connections, how would I connect over 3 servos?
    Pin Locations - the grounds aren't labels, or am I missing something in the wiring - I attached a photo of my current setup to test the first servo.

    Attached Files:

  4. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    Not sure what you mean by startup or main section. You can just copy the entire code into the Arduino code compiler.

    As for the ground, the Arduino should have 3 GND pin locations. I believe you really only need to connect 1 GND to the breadboard, say on the negative row line (AKA the line of holes near the blue line on the breadboard), and then connect all of the negative power supplies to that 1 negative line on the breadboard. Along that 1 negative line you would also connect a separate wire from the breadboard to each servo.

    Also, the servo has 3 pins:
    White is where you connect the Arduino PWM pin to the servo.
    Red is where you connect the positive power supply to the servo.
    Black is where you'd connect the negative (ground) from the breadboard negative line to the servo.

    When I did this a while ago, I overengineered by using a different column on the breadboard for each servo + power supply, but this is overkill. You can simply place them all along the negative row line.
    • Informative Informative x 1
  5. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    Is this wiring correct for a single servo?
    I used pin 8, I think that's the PWM pin, but where do additional servo's go?

    The Arduino complier shows 2 sections shown below, should this run repeatedly or just on setup?

    void setup() {
    // put your setup code here, to run once:

    }

    void loop() {
    // put your main code here, to run repeatedly:

    }

    Attached Files:

  6. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    As far as I can tell, the wiring looks good.

    Additional servos would follow the same format; you'd connect the negative wire from the next power supply to the same negative breadboard row, and then run a separate wire from the negative breadboard row to the servo's black input. The positive charge from the power supply is wired directly to the servo's red input, and another pwm pin from the Arduino is wired to the white input.

    As for the code, just copy and paste it over the entire contents of the starter code (bith sections including the setup and the loop will be replaced).
  7. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    I have connectivity to the servo's now, thanks. I want to test it with 3 servo's just for the harness, does the attached mounting job look about right?

    I wasn't sure if the servos need to be tight or not, mine move if I pull up on them. I couldn't quite make out the best position to attach the zip ties:
    https://photos.app.goo.gl/1ZvhkEQxrpqRxzB39

    How should I adjust the angles? Should I keep 0,180 in the arduino code and adjust the position of physical the arm?
    I can test the servos in simtools from -100 to 100. Should I set at 0, and that would be aligned parallel to the longer side of the servo?

    What would you recommend for keeping the ardino, power adapters and cabling together? I'll have 3 servos now, but will probably expand to 10 if everything works well. Maybe tie the cables to the legs and along the back piece of wood - going out to a box holding them? Should i get a milk crate like you were originally using?

    Attached Files:

  8. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    Hi,
    Glad to see you're making progress! You'll want to make sure the servos are as fixed and stable as possible, since you'll lose a lot of integrity if they are sliding around. I can't tell you exactly where to place them since each chair and setup are different. You'll need to experiment with the best placement. You may need to improvise to see how to get them to stay in place. I'd recommend a trip to the hardware store to see what might be useful.

    As for adjusting the angles in code, 0 to 180 is correct if you're using 180 degree servos. If using 270 degree servos, 0-180 will actually translate to using all 270 degrees of the servo. For 270 degree servos, I'd change the code to 0-120. Of course, you'll need to test and play around with it to make sure it works as expected. The easiest way to position correctly is to update the code, and then adjust the physical position of the arm to a satisfactory position.

    As for the position of the servos from -100 to 100, there is a line in the code something like this:
    const int kPosAndNeg[kActuatorCount] = {0, 0, 0, 0};
    where each element in the array relates to a servo.
    If the value is zero for a servo, it will only apply positive numbers, so you would only get 0 to 100. This is useful, for example, if you want the servo to respond to acceleration but not braking or if you want the servo to respond to turning left but not turning right. However, if you set this value to 1 for a given servo, it should respond to the entire range of -100 to 100.

    Regarding organizing the components and keeping them tidy, I'm probably not the best person to ask, lol, as my setup is far from neat. You're at the point where you have a working prototype, so just keep doing what you're doing and find what works best for you. Keep up the good work!
    • Informative Informative x 1
  9. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    Do you mind taking a close up pictures of how you strapped one of your servos on securely? I'm pretty sure I have the exact same chair, it looked like you wrapped around the notches but I couldn't quite see the details.

    I do have 270 servo's, so I'll update that range to 0-120. For the 3 connected to the harness - I assume I'd want the entire range for those. So I'd change this for 3 servos?
    const int kPosAndNeg[kActuatorCount] = {1, 1, 1,};

    For the arm positioning, would I want the arm providing maximum slack at -100, and maximum tightness at +100?
  10. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    Regarding whether to use the entire range depends on what you want the servo to respond to. For me, I use sway with just one side of the range (kPosAndNeg = 0) and pitch / surge with both sides of the range (kPosAndNeg = 1). I'd say experiment with it and see what you like.

    Here's a quick picture of how I have the servo attached to the pedestal. I also used some electric tape to keep it from sliding, although it is pretty much fixed with very little flex.
    upload_2024-2-14_14-44-39.png
  11. dgiatr

    dgiatr Member Gold Contributor

    Joined:
    Oct 17, 2023
    Messages:
    50
    Balance:
    223Coins
    Ratings:
    +7 / 0 / -0
    Hello Jumping coin and Miketunes , I watch your conversation which is very interesting , not meaning to hijack but since it is the only active pneumatic g-seat thread here i need some help.

    I own a dof 3p platform and after adding some vibrations with simshaker for il2 flight simulator, I am now ready to proceed to the implementation of a DIY pneumatic g-seat like yours.

    I have already found some 60 kgr servos so in order to find the right power supply I want to ask you :
    1. what's the maximum full load current those 60 kgr servos will need for our project ( each servo for each air wedge bag ). Are 5 amps enough ?
    2. I am about to buy some wedge air bags, so is 5 mm tube - inlet niple diameter enough for a sufficient quantity of air to quickly inflate- deinflate those airbags. Do you know if I can add inlet niples and tubes with larger diameter?
    3. I don't know what air bags to buy, I am finding different brands for the specific sizes we want but cannot decide. Should those air bags have some specific characteristics for our project except the size?

    Thank you both in advance!
  12. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    Hi @dgiatr,
    Glad to help. Here are some quick answers to your questions:
    1. To be honest, I never measured the power draw. I'm sure I overengineered my project, but I use about 20 servos, each with its own wall wart plug, and these are plugged into a surge protector. I've never had issues tripping the surge protector or the circuit breaker.
    2. I used 5mm tube, which was sufficient for me. Using inlet nipples would be a cool experiment, but I'm not sure if it's necessary. Perhaps if you're using really large air bags, but not an issue for me with 11x4 inch air bags.
    3. I bought the cheapest air bags I could find on Amazon, which at the time was 4 for $20. If I were to buy again, I might consider getting slightly more premium bags, since I often need to pump air into some of them each time I use the sim, so I must be losing air somewhere. I'm not sure where, but I suspect it's the super cheap air bags.

    Just a heads up with the airbags. They work well, but I find the biggest bang for your buck with these servos is in pulling belts since they are a bit easier to tune and can more easily feel the full spectrum of force. For me, I don't feel much pressure from the air bags going from 0 to 50%, but a big difference going from 50% to 100%. Keep this in mind when tuning them.
    • Informative Informative x 1
  13. dgiatr

    dgiatr Member Gold Contributor

    Joined:
    Oct 17, 2023
    Messages:
    50
    Balance:
    223Coins
    Ratings:
    +7 / 0 / -0
    Thank you Jumping Coin always willing to help!!
  14. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    I'm still a bit confused how to set it up with the 3 test servo ranges (left, right, and rear). So instead of const int kPosAndNeg[3] = {1, 1, 1,}, you preferred changing some of those to 0's? Which of those 3 positions did you set to 0 and I'll do mine the same.

    Once I've done that how do I align them - I assume I should be using the simtools motion setup interface test? With +100 tightening the belt the most and -100 giving it the maximum slack? Basically +100 pointing the arm down and -100 pointing it up?
  15. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    It's all subjective, so I'd say experiment to find what suits you best. For me, when turning, I only want one side to operate; i.e. if I turn left, I only want the left servo to pull and I don't want the right servo to loosen. As for the pitch/acceleration, I'd want to feel both acceleration and braking. I want the servo to pull me back on acceleration and loosen on braking so that I pitch forward. Thus, if you have (left, right, rear), I'd suggest (0, 0, 1).

    However, keep in mind that this what suited me best, but my solution may be far from the optimal approach. Part of the fun is experimenting with the raw ingredients to see what increases and decreases the immersion. It's wonderful that you now have a working prototype. Continue building and keep up the good work. :)
    • Like Like x 1
  16. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    Ok thanks, but how about the calibration, is that the same for left, right, and rear. Or would the rear be calibrated differently? Should I be using the sim tools +100 an -100 range to align for maximum/minimum slack?
  17. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    Yes, calibration in SimTools should be the same. You shouldn't have to limit the range, since the ranges are defined in the Arduino code.

    If you've set kPosAndNeg to 0, then the servo should only respond for 0 to 100 (or -100 to 0 if you select the reverse direction button.)

    If you've set kPosAndNeg to 1, then the servo should respond for -100 to 100. If needed, you can select the reverse direction button to work in the opposite direction.
    Last edited: Mar 6, 2024
  18. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    Ok, makes sense. So when KPosAndNeg is 0 - should +100 be most tight and -100 most loose? And then with KPosAndNeg is 1, +100 should be most tight and 0 should be most loose? Or should 0 be in-between?

    When you are experimenting with the ranges, are you doing that in the arduino code, or the calibration?
  19. Jumping Coin

    Jumping Coin Member

    Joined:
    Aug 7, 2020
    Messages:
    93
    Balance:
    460Coins
    Ratings:
    +54 / 0 / -0
    If KPosAndNeg is 0, then the servo will only respond to one side, e.g. 0 to 100. To switch to the other side, you can click the reverse direction (Dir) button in SimTools. If you still find that the behavior of the servo is backwards even after clicking the reverse direction (Dir) button in SimTools, then swap the range end points in the Arduino code.

    As for which side should be loose vs tight, that all depends on the range that you set up in the Arduino code and how you've positioned the servo as well as the manufacturer of the servo. Remember, at the end of the day, all we're really doing is moving a servo arm's position. How you've positioned the servo and how you connect to that servo arm will determine the result that you get. For example, just by flipping the servo over, you'd get the opposite effect of wherever you've currently placed the servo.

    Long story short, once you are satisfied with the range established in the Arduino code, then you can use SimTools to figure out which direction the servo will respond to. If still behaving wonky, then swap the ranges in Arduino.
  20. miketunes

    miketunes Member

    Joined:
    Aug 25, 2023
    Messages:
    40
    Balance:
    254Coins
    Ratings:
    +1 / 1 / -0
    I think I almost have it.

    So if KPosAndNeg is 0 - we're just using 0-100 range. So 0 or 100 be maximum tightness, depending on direction.

    Then if KPosAndNeg is 1, we're using the -100 to +100 range. So -100 or +100 should be maximum tightness, depending on direction.
    • Like Like x 1