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

Using plugins to drive servo motors

Discussion in 'DIY Motion Simulator Projects' started by hugso, Oct 6, 2013.

  1. hugso

    hugso Active Member

    Joined:
    Sep 17, 2013
    Messages:
    138
    Location:
    Glos UK
    Balance:
    599Coins
    Ratings:
    +50 / 1 / -0
    My Motion Simulator:
    Arduino, Motion platform, 4DOF
    I am now working through SimTools Quickstart. I have opened Game Manager and Game engine and I have got to Patching the Game. I have selected DCS World in the drop down and clicked on Patching. It then says "follow the instructions of the individual plugins". Where are these instructions? I have tried entering the Game Patching Path with Edit Path, but I keep getting "Game did not Patch". Stuck again, I'm afraid. In the Installation to Do List is says I must run the game in order to patch for output. I have run the game a couple of times with and without SimTools running.
  2. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,158
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,176Coins
    Ratings:
    +2,156 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    The message that you get should read:

    "Please Select the DCS's Saved Games Directory. e.g. C:Users\User\Saved Games\DCS\Scripts"

    You may have to create the "Scripts" directory ahead of time; I had as I had never modded the game before and this directory is created using mods (or so I understand).

    aahhh, noticed that you are quoting the quick start guide and not the message that is given when you click on "Edit Path".

    After installing the plug-in and starting the Game Manager there is a hint on what path to patch to when you click "Edit Path" under Patching. The text that I quoted above is the hint given with the DCS plug-in.
  3. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,390Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    I do apologize for the Quickstart not my document at all.
    As Historiker has explained you after installing the plugin you need to patch the game for data by using the Patching - Edit Path - then select the above path but really before this step there is a major flaw in the quick start, please take a few steps back.

    First of all we need to setup our basics.
    Open SimTools Game Engine.
    Click Axis Assignments.
    Ok in this window setup your default axis first.
    In the Game List select Default
    Now we are just dealing with Roll and Pitch to start with so.
    For Axis 1 if this just controls the Roll set the Roll in the Force of DOF1.
    Now if this axis will use the full Roll set % (which is the amount in percent of the total axis movement) to 80% this gives us a safety margin of 20 % not used, once tested you can increase this to 100% if needed.
    For Axis 2 if this just controls the Pitch , set the Pitch in Force of DOF1.
    Again set the % to 80% can be changed later.
    Now press Save Setting to save the Default Axis Assignments
    Now these steps are an important one as you will see as we continue.
    Ok then we need to setup our Interfaces, you will only setup Interface 1 as you only have 1 Ard.
    Ok Click on the Interface Settings in the right hand button bar.
    Now Click on Interface1 in the top button bar.
    Now to set the output type - Click on the drop box labeled Output Type and select Ser as the Ard is a Serial device, ie connected via a virtual com port via a USB cable.
    Ok in the resulting Serial Output box we need to fill it in as per below.
    Comport - Comport the Ard is appearing in the Device Manager of windows, You should know this you have been using the Arduino IDE its the same COM number. and if the Ard is plugged in when setting up it will appear in the ComPort drop box.
    BitsPerSec - Baud rate at which the Ard Code is set at which is 9600.
    Data Bits is set at 8
    Parity is set to none
    Stop Bits is set to 1
    Output - Bit Range is set to 8.
    Output - Type is set to Decimal.
    Ok now the the bits that decide what the sim does.

    Startup - Output is set too - R90~P90~ please not if the Ard code has been change you will need to change this accordingly, as in R - Roll and is Servo 1 and P is Pitch and is Servo 2 and 90 is the center point where your simulator is level and in its middle point.

    Interface - Output is set too - R<Axis1>~P<Axis2>~, again if you have changed the code please change this, plus you will note Axis1 and Axis2 refer to what you have set in the Axis Assignments above.

    ShutDown - Output is set to - R90~P90~ , again this should be the same as the Startup, too be nice its good to have the system (simulator) come back to a centre to allow you to get out nicely and hold that position until you power it down.

    Ok I missed the ms settings on the right for the Ard I would use 10ms on all if you find the pc or ard is not handling theses speed in testing the outputs you can increase them to 20ms, from memory they handle 10ms fine on mine but its a AMDx8 - 3.9 processor, my machines got ballz.
    Ok now that's all set press Save to save all the interface settings.

    Ok now we have our interface setup we need to test it to make sure the directions are correct and our interfaces work correctly before even trying it in the game.

    Click on Output Testing in the right hand button bar.
    Now comes the fun part. If everything is right above, Click on Turn On, your simulator should fire and servos should move to their centre positions straight away, normally quiet quickly.
    You will notice next to the Turn On Button, we have a Output Type.
    Make sure to start its set to DOF Output.
    Now carefully move the slider with the Mouse and test Roll and Pitch, noting which way they move, as well by pressing the clr button on the right they should jump straight back to centre.
    Now we have our default axis correct, our interfaces working correctly ,we can then install game plugins.
    As when you first install the plugin they copy the default axis setting to each plugin installed.
    Since you followed the poor Quick Start, sorry about that. You will need to step back to the Axis Assignments, and

    Click on Axis Assignments,
    Click on Game List and select DCS.
    Now we need to copy over the Default Axis because it could be set wrong. Do this by pressing Load Default, which is beside the Game List.
    And Press Save Settings.
    Ok now we can test game.
    As long as you patch the game and it said Patch successful.
    We can just start the Game , leaving the Game Engine and Game Manager in the background.They will just work , believe me.

    The simulator should jump into action, if anything set wrong it will 'Beep at you'
    Now test the roll and pitch in game. From there we can tune our Min Max in the tuning centre and stuff like that, but will leave that for another post.

    Good Luck mate, and again sorry for the confusing quick start, not really suited to a newbie or the latest version.
    • Like Like x 1
  4. RaceRay

    RaceRay Administrator Staff Member SimAxe Beta Tester

    Joined:
    Nov 8, 2006
    Messages:
    4,656
    Occupation:
    Self-employed | Web and application development
    Location:
    Hamburg, Germany
    Balance:
    23,837Coins
    Ratings:
    +1,958 / 13 / -0
    My Motion Simulator:
    2DOF, DC motor, SimAxe, SimforceGT
    The quickstart guide was well enough for the development version of SimTools but it was never vaild for the current production version. Now i marked it as outdated it will be replaced soon.
  5. hugso

    hugso Active Member

    Joined:
    Sep 17, 2013
    Messages:
    138
    Location:
    Glos UK
    Balance:
    599Coins
    Ratings:
    +50 / 1 / -0
    My Motion Simulator:
    Arduino, Motion platform, 4DOF
    Thanks so much for your help eaorobbie. Nearly there now. Both servos fire up and move, but then move randomly as if there is some sort of interfering going on. I noticed that when I powered up the Ard, and before I plugged in the USB, the servos were active and locked in position. Is this right? Or should the Ard be "empty" before loading SimTools? If so, how do I clear the Ard? Pressing the reset button on the Ard seems to clear things, but after a couple of seconds the LED comes on again and the servos are locked again.
  6. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,390Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    Ok is this happening while SimTools is not connected?
    The Ard should actually do nothing until SimTools send a command to them. As in you have pressed Turn On in the Output Testing.
    From here the ard should show a green led flashing very quickly.
    If this flashing doesnt seem to be smooth you need to increase ms in the interfaces try adjusting this up in value.
    Or we may require the baud rates to be increased.
    Its a communication error to me. I need to plugin my model and test again. To be totally sure then I can do some screenshots of my settings I use so you can refer to them.
  7. hugso

    hugso Active Member

    Joined:
    Sep 17, 2013
    Messages:
    138
    Location:
    Glos UK
    Balance:
    599Coins
    Ratings:
    +50 / 1 / -0
    My Motion Simulator:
    Arduino, Motion platform, 4DOF
    It seems there is a program on the Ard all the time even after I have pressed the reset button. When I power it up either without the USB cable plugged in, or with the USB in and SimTools not running, the two servos connected both are rigid. If this is not right how do I clear the Ard?
  8. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,158
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,176Coins
    Ratings:
    +2,156 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    Hi Hugso,

    Yes, there is a program running on the Arduino any time it is plugged in. The Arduino Sketch (program) tells the servos to go to center (90 degrees) and wait for instructions from the program (Simtools). You only have to program it once and then leave it alone unless you add more features (like more servos). When I turn on my PC the Arduino will straighten the platform if it is not already straight and then it will wait for input.
  9. hugso

    hugso Active Member

    Joined:
    Sep 17, 2013
    Messages:
    138
    Location:
    Glos UK
    Balance:
    599Coins
    Ratings:
    +50 / 1 / -0
    My Motion Simulator:
    Arduino, Motion platform, 4DOF
    Hi Historiker.

    Yes, that is exactly what it does: fire the Ard up and the servos go to 90 degrees and stay there. I have followed eaorobbie's instructions above for SimTools, but when I press Turn On in Output Testing the servos both move and then just keep moving about in a random fashion. While they are moving about all the amber LEDs (L TX and RX) are on steadily.
  10. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,158
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,176Coins
    Ratings:
    +2,156 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    I am not sure which sketch (program) he gave you to use. If it is the same one that he posted in his R/C servo miniature platform thread it might have "#define DEBUG 1" in the second line. That has to be commented out (by adding // in front of it) otherwise signals are only sent to the serial monitor. I had the same issue, drove me nuts for a while until Aarondac pointed it out to me ;)

    But I am not sure if they sketch is the same or not.
  11. Hypo

    Hypo Member

    Joined:
    Oct 4, 2013
    Messages:
    50
    Occupation:
    Former cooperate enterprise software developer
    Location:
    Harlow, Essex, UK
    Balance:
    879Coins
    Ratings:
    +24 / 0 / -0
    I am just waiting for Windows 7 64bit to arrive so I can install it on a disk in my Mac Pro. I need 64bit because DCS has now gone fully 64bit. Once Windows arrives and I get everything set up I will assist Hugso. No disrespect to Hugso, however he is new to the concept of programming micro-controllers and some of the more techie PC stuff. This is where I will be able assist Hugso. I have just sold my PC and shipped it off to Hugso. Until I get Windows 7 installed on my Mac I can't set up SimTools and assist. Once I have I am looking forward to getting everything working with Hugso and getting gSeat moving.

    To clear up any confusion about what Arduino sketch is uploaded it is eaorobbie's sketch. I have asked Hugso to rename the sketch to gSeat.ino and it's containing folder to gSeat. From now on Hugso and I will refer to the sketch being used as gSeat.
    • Like Like x 1
    Last edited: Oct 21, 2013
  12. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,390Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    Spot on mate. If Debug line needs to be set in Ard too.
    //#define DEBUG 1 // comment out this line to remove debuggin Serial.print lines

    or SimTools will have issues.
    To test in Serial Monitor , Remove the // from it
    Sorry my bad , thanks heaps Historiker

    I have added a new code with Debug line comment out.
    So now should work under SimTools.

    Attached Files:

  13. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,390Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    The code is place on site for everyone , myself wrote the original and Aarondc mangled it nicely into this , its free for everyone to do as they please its an example for an open source for people to be able to build a model. As you might have change it slightly or not , please feel free to use it as you wish.
    • Like Like x 1
  14. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,158
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,176Coins
    Ratings:
    +2,156 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    It is a great bit of code, I mangled it a bit further to make it work with six R/C servos. Works great!
    • Like Like x 1
  15. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,390Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    Thats what Im talking about still blown away with what ya did with it.
    My morals here "Keep it Open for all to have fun with, dont lock ya code up"
    Or ya might miss out on something you didnt think off.
  16. Hypo

    Hypo Member

    Joined:
    Oct 4, 2013
    Messages:
    50
    Occupation:
    Former cooperate enterprise software developer
    Location:
    Harlow, Essex, UK
    Balance:
    879Coins
    Ratings:
    +24 / 0 / -0
    Just after I sent my last post I got an email saying my Windows had been dispatched. Should be here Wednesday. I can then get involved and help.

    It is great you are all helping Hugso. That is what community spirit is all about. Thanks guys.
  17. hugso

    hugso Active Member

    Joined:
    Sep 17, 2013
    Messages:
    138
    Location:
    Glos UK
    Balance:
    599Coins
    Ratings:
    +50 / 1 / -0
    My Motion Simulator:
    Arduino, Motion platform, 4DOF
    eaorobbie you are a star! The new code works a treat and and servos moving with sliders perfectly. Thank you so much.
  18. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,390Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    Cool you should now be able to patch game and enjoy.
  19. hugso

    hugso Active Member

    Joined:
    Sep 17, 2013
    Messages:
    138
    Location:
    Glos UK
    Balance:
    599Coins
    Ratings:
    +50 / 1 / -0
    My Motion Simulator:
    Arduino, Motion platform, 4DOF
    Yea!! We are rockin' in DCS! CoD seemed to take the patch OK, but I can't get the servos to move in game. Never mind, we are really moving on here. Next question: can we add heave and sway?
  20. Hypo

    Hypo Member

    Joined:
    Oct 4, 2013
    Messages:
    50
    Occupation:
    Former cooperate enterprise software developer
    Location:
    Harlow, Essex, UK
    Balance:
    879Coins
    Ratings:
    +24 / 0 / -0
    Nice one eaorobbie:cheers