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

Simulated Wind using MonsterMoto and ArduinoUno

Discussion in 'SimTools compatible interfaces' started by SilentChill, May 15, 2015.

  1. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,616
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,563Coins
    Ratings:
    +10,795 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    To use SimTools and SimHub at the same time you need to use SimHub's port forwarding, to avoid port conflicts, see the FAQs here: https://www.xsimulator.net/community/faq/simhub-port-forwarding.356/
    Last edited: Jan 2, 2023
  2. R-power

    R-power New Member

    Joined:
    Jan 7, 2016
    Messages:
    9
    Balance:
    29Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    3DOF
    For me is sufficient to connect this kit to simhub.
    I have not simtools by now.
    Is it possible to work with only simhub?
    Thc
    Last edited by a moderator: Jan 2, 2023
  3. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,616
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,563Coins
    Ratings:
    +10,795 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Yes you can run fans with just SimHub
  4. R-power

    R-power New Member

    Joined:
    Jan 7, 2016
    Messages:
    9
    Balance:
    29Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    3DOF
    Dear @noorbeast
    Unfortunately I am completely not skilled on these things.
    Is there a link where I can follow steps in order to do the correct setup for simhub?
    Thx a lot
  5. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,616
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,563Coins
    Ratings:
    +10,795 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    You can check the wind section of the SimHub site: https://www.simhubdash.com/

    But there are also easy to follow build videos, such as this one:

    • Like Like x 1
    • Informative Informative x 1
  6. Zed

    Zed VR Simming w/Reverb Gold Contributor

    Joined:
    Apr 4, 2017
    Messages:
    1,040
    Location:
    USA
    Balance:
    5,835Coins
    Ratings:
    +1,040 / 4 / -0
    My Motion Simulator:
    2DOF, DC motor, JRK
    No idea about stetch, (sketch?) but if it works under SimTools, it probably just uses the standard “S” commands.

    Look up Arduino and get the free compiler. It has a terminal program you can use to talk to a com port and if you enter S100 your fans should run a bit under full speed. S255 is full speed. S000 is off. Note the command is an S followed by three digits. To send a 10 it’s S010. 5 is S005. Useful for testing. Obviously to use with Simhub you need to sort them communicating but you can at least test with the Arduino compiler monitor.

    Can’t help you with Simhub, though.
  7. R-power

    R-power New Member

    Joined:
    Jan 7, 2016
    Messages:
    9
    Balance:
    29Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    3DOF
    dear ALL
    thx u so much

    done, followed instructions in simhub wiki, helped by the discussion about the simwind kit here .....
    helped by wonderful @Keith
    i have uploaded a sketch in arduino.
    working perfectly... wind till real 80kmh on my face and ocuculs.
    thx a lot to everyone.
    now next task belt-tensioner....
    • Like Like x 1
  8. stanley johnson

    stanley johnson Active Member

    Joined:
    Sep 14, 2022
    Messages:
    117
    Occupation:
    Diesel tech
    Location:
    Nashville
    Balance:
    82Coins
    Ratings:
    +40 / 0 / -0
    My Motion Simulator:
    3DOF
    D805D963-8ED2-41F0-9E41-DEA56E829B8E.jpeg Hey guys I set up my wind sim using Arduino and motor shield but I couldn’t get sim hub and simtool to work at the same time so now I would love to us simtool v3 wind sim software. My question is can I use the same Arduino and motorsheild driver from sim hub on simtool v3. Do I need to send a different code to Arduino? Or do I need to buy another motor driver. In the pic is what I have.
  9. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,616
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,563Coins
    Ratings:
    +10,795 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    The issue is that SimHub and SimTools can't use the same port at the same time, a workaround is port forwarding from one to the other: https://www.xsimulator.net/community/threads/simtools-v3-public-beta.17329/page-17#post-234379
    • Like Like x 1
  10. Richard Ortengren

    Richard Ortengren Florida Racing Fan Gold Contributor

    Joined:
    May 14, 2022
    Messages:
    49
    Occupation:
    Builder
    Location:
    Florida
    Balance:
    282Coins
    Ratings:
    +13 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    I basically have the same issue/question. A couple weeks ago I followed the video you referenced and have a working wind sim with SimHub, but I would prefer to use SimTools because of the port conflicts between the two programs. Right now I can only use one program or the other, motion and vibe on SimTools or close SimTools and load up SimHub to experience Wind. I cannot get the two programs to work together due to port issues. Anyway, I made the switch to wind with SimTools and loaded the most recent sketch into the Arduino Uno and I have confirmed that I have output from LFS to GameDash and I also can see the data coming into the Arduino (S001, S002, S003+ as speed goes up) with a port sniffer. However I get no movement at all from the fans. One thing that is different, the hardware in the video and pictured in the post by stanley johnson is the Adafruit Motor Shield V2, which is what I have. It is not the Monster Motor Shield mentioned throughout the posts I have seen for building a wind sim with SimTools. Could this be the problem? Does the Arduino sketch only work for the Monster Motor Shield and not the Adafruit Motor Shield V2? Thanks for any input.

    upload_2023-1-27_16-44-33.png
  11. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,616
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,563Coins
    Ratings:
    +10,795 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    There is a wind sim section in the FAQs: https://www.xsimulator.net/community/faq/fans-wind-simulation.67/

    You will likely find @sallerding's use of ChatGPT to create adafruit code, and the code itself, of interest: https://www.xsimulator.net/communit...-wind-arduino-sketch.14425/page-3#post-234646
  12. Richard Ortengren

    Richard Ortengren Florida Racing Fan Gold Contributor

    Joined:
    May 14, 2022
    Messages:
    49
    Occupation:
    Builder
    Location:
    Florida
    Balance:
    282Coins
    Ratings:
    +13 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    Thanks! I have been searching through the various wind posts and FAQ, but did not see that adafruit post! I am going to give this a go, if it works out well I will post the code.
    • Like Like x 1
  13. Richard Ortengren

    Richard Ortengren Florida Racing Fan Gold Contributor

    Joined:
    May 14, 2022
    Messages:
    49
    Occupation:
    Builder
    Location:
    Florida
    Balance:
    282Coins
    Ratings:
    +13 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    Based on your advice I made a sketch for the Adafruit Motor Shield V2 (AMSv2) using all the hard work of sallerding, Zed, SilentChill, Avenga76, and others. It's an option for people who do not have a Monster Moto or who may have started with a wind sim built for SimHub using the AMSV2 and wish to use their existing hardware with SimTools. The procedures and settings in GameDash remain the same, you just need to load this sketch and it should work with AMSV2. I tested the sketch using the EZDIY 120mm 200CFM 1.3A fans that are recommended in the DIY video tutorials for SimHub like this one:

    You should change the Idlespeed setting in the sketch to what you prefer for your rig after you get it running. I left a small Idlespeed value in the sketch so that the fans come on when you load it. That may help with determining if your fans and hardware are wired/working properly without having to load a game. If anyone has any questions I will try to help. The attached file is .txt extension you can change the extension to .ino or copy and paste it into IDE and save. Here is the sketch text in case the file does not work for you:

    // Arduino code to achieve wind simulation with the Adafruit Motor Shield V2 instead of the Monster Moto
    // Based on the work of sallerding, Zed, SilentChill, Avenga76, and others with inspiration from noorbeast
    // Supports right,left and traditional serial speed output from GameDash (R000, L000, S000)
    // Adafruit Motor Shield V2 library is required to be added to Arduino IDE interface prior to uploading sketch
    // Please wire your two fans to motor ports M1 and M3 on the adafruit Motor Shield V2 (Not M1 and M2)
    // This will utilize both mosfets on the board and reduce the potential for overheating with 1.3 Amp fans

    // Version Date 01_28_2023

    #include <Wire.h>
    #include <Adafruit_MotorShield.h>

    #define FALSE 0
    #define TRUE 1
    #define BOTH 0
    #define LEFT 1
    #define RIGHT 2

    // Define a fan idlespeed here if you prefer to have your fans on all the time for ventilation
    // A default idlespeed is set so that you know the sketch is working, set to 0 for no fans at idle
    #define Idlespeed 20

    int Speed = 0;
    int bufferArray[4];
    int whichFan = BOTH;

    // Create the motor shield object with the default I2C address
    Adafruit_MotorShield AFMS = Adafruit_MotorShield();

    // Set port M1 for Motor 1 (Left fan)
    Adafruit_DCMotor *Motor1 = AFMS.getMotor(1);
    // Set port M3 for Motor 3 (Right fan)
    Adafruit_DCMotor *Motor3 = AFMS.getMotor(3);

    void setup()
    {
    AFMS.begin(); // Initialize the shield
    Serial.begin(9600); // Initialize serial communication

    // Initialize motors at idlespeed
    Motor1->setSpeed(Idlespeed);
    Motor1->run(FORWARD);
    Motor3->setSpeed(Idlespeed);
    Motor3->run(FORWARD);
    }

    void loop()
    {
    ReadData();

    if (whichFan == BOTH)
    {
    Motor1->setSpeed(Speed);
    Motor3->setSpeed(Speed);
    Motor1->run(FORWARD);
    Motor3->run(FORWARD);
    if (Speed == 0)
    {
    Motor1->run(RELEASE); // Release the motor
    Motor3->run(RELEASE); // Release the motor
    }
    }

    if (whichFan == LEFT)
    {
    Motor1->setSpeed(Speed);
    Motor1->run(FORWARD);
    if (Speed == 0)
    {
    Motor1->run(RELEASE); // Release the motor
    }
    }

    if (whichFan == RIGHT)
    {
    Motor3->setSpeed(Speed);
    Motor3->run(FORWARD);
    if (Speed == 0)
    {
    Motor3->run(RELEASE); // Release the motor
    }
    }
    }

    void ReadData()
    {
    // We need 4 characters - the command followed by three digits

    bool haveCommand = FALSE;
    bool haveStart = FALSE;

    while (haveCommand == FALSE) // can't exit until have a full valid cddd command
    {
    // where c is a valid char and ddd is a valid 3
    // character representation of three digits

    // Valid command always starts with an S (legacy for both fans), L (left fan), or R (right fan)
    while (haveStart == FALSE)
    {
    while (Serial.available() == 0); // spin and wait for data
    bufferArray[0] = Serial.read(); // have data, read it

    if (bufferArray[0] == 'S') //S
    {
    whichFan = BOTH;
    haveStart = TRUE;
    }
    else if (bufferArray[0] == 'L') //L
    {
    whichFan = LEFT;
    haveStart = TRUE;
    }
    else if (bufferArray[0] == 'R') //R
    {
    whichFan = RIGHT;
    haveStart = TRUE;
    }
    }

    // Now need the numbers - will just read three and throw them away if any don't qualify
    // if we unsynchronize, it will fail valid digits and go back to waiting for command char
    for (int i = 1; i < 4; i++) // read and label each byte.
    {
    while (Serial.available() == 0); // spin and wait for each character to arrive
    bufferArray = Serial.read(); // store as they come in
    }

    // Check the numbers for validity
    if (isDigit(bufferArray[1]) && isDigit(bufferArray[2]) && isDigit(bufferArray[3]))
    // all are numbers - have a full cddd command
    haveCommand = TRUE; // otherwise start over looking for a new and valid command
    }
    // Now turn that into a number and clip to 255 - rely on Game Dash for proper scaling
    Speed = ((bufferArray[1]-48)*100) + ((bufferArray[2]-48)*10) + ((bufferArray[3]-48)*1);
    //Serial.println(SpeedGameDash);
    if (Speed > 255)
    Speed = 255;
    // Add logic for idle speed defined above by user
    if (Speed < Idlespeed)
    Speed = Idlespeed;
    }

    Attached Files:

    • Winner Winner x 2
  14. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,616
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,563Coins
    Ratings:
    +10,795 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  15. stanley johnson

    stanley johnson Active Member

    Joined:
    Sep 14, 2022
    Messages:
    117
    Occupation:
    Diesel tech
    Location:
    Nashville
    Balance:
    82Coins
    Ratings:
    +40 / 0 / -0
    My Motion Simulator:
    3DOF
    ok guys i got the fans to come when i downloaded the sketch and changed defined idlespeed to 0 to get them to stop and not run all the time for ventilation. now what do i need to do in simtool v3 to get the fans to work with the car speed?
  16. Richard Ortengren

    Richard Ortengren Florida Racing Fan Gold Contributor

    Joined:
    May 14, 2022
    Messages:
    49
    Occupation:
    Builder
    Location:
    Florida
    Balance:
    282Coins
    Ratings:
    +13 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    Stanley, I am using SimTools V2, but from what I can tell the process is about the same but easier. Enable GameDash output (it comes standard in V3), configure an arduino interface with the standard settings pointed to your com port, and edit the config file with the data seen in the image below. Maybe you can provide a post on the specifics of V3 when you get it running. I tested mine in LFS first as its the easiest to test in. Good luck!

    upload_2023-2-3_8-43-15.png

    Attached Files:

    • Informative Informative x 1
  17. Chipless

    Chipless Member

    Joined:
    Nov 28, 2019
    Messages:
    79
    Balance:
    132Coins
    Ratings:
    +26 / 0 / -0
    Great summary! Thanks for posting. Unfortunately, I cannot locate the place in SimTools V3 where I would enter the "S<Dash1>" line in Interface - Output. Also in SimTools V3, I cannot find where I actually enter the Output Rules like I would in the Command Editor. Can anyone assist?
  18. stanley johnson

    stanley johnson Active Member

    Joined:
    Sep 14, 2022
    Messages:
    117
    Occupation:
    Diesel tech
    Location:
    Nashville
    Balance:
    82Coins
    Ratings:
    +40 / 0 / -0
    My Motion Simulator:
    3DOF

    Attached Files:

  19. stanley johnson

    stanley johnson Active Member

    Joined:
    Sep 14, 2022
    Messages:
    117
    Occupation:
    Diesel tech
    Location:
    Nashville
    Balance:
    82Coins
    Ratings:
    +40 / 0 / -0
    My Motion Simulator:
    3DOF
    @Chipless If you click on the pencil I guess under speed it will take you to the next screen where you can type in math*1 Round0 and pad30. but still have not got the fans to work

    Attached Files:

  20. Richard Ortengren

    Richard Ortengren Florida Racing Fan Gold Contributor

    Joined:
    May 14, 2022
    Messages:
    49
    Occupation:
    Builder
    Location:
    Florida
    Balance:
    282Coins
    Ratings:
    +13 / 0 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform
    I'm not on V3, but just looking at the overview it seems pretty easy. Do you have the licensed version? You should see Dashboard Settings. Here as a screen grab showing where you would input the data for wind simulation, under speed click the little pencil and input the same 3 lines in Dash Outputs 1.

    upload_2023-2-10_10-18-35.png