1. 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!
  2. 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
  3. 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:
    18,887
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    135,018Coins
    Ratings:
    +10,335 / 48 / -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:
    18,887
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    135,018Coins
    Ratings:
    +10,335 / 48 / -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:
    18,887
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    135,018Coins
    Ratings:
    +10,335 / 48 / -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,037
    Location:
    USA
    Balance:
    5,748Coins
    Ratings:
    +1,030 / 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 Gold Contributor

    Joined:
    Sep 14, 2022
    Messages:
    107
    Occupation:
    Diesel tech
    Location:
    Nashville
    Balance:
    328Coins
    Ratings:
    +38 / 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:
    18,887
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    135,018Coins
    Ratings:
    +10,335 / 48 / -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:
    37
    Occupation:
    Builder
    Location:
    Florida
    Balance:
    204Coins
    Ratings:
    +8 / 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:
    18,887
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    135,018Coins
    Ratings:
    +10,335 / 48 / -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:
    37
    Occupation:
    Builder
    Location:
    Florida
    Balance:
    204Coins
    Ratings:
    +8 / 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:
    37
    Occupation:
    Builder
    Location:
    Florida
    Balance:
    204Coins
    Ratings:
    +8 / 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 1
  14. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    18,887
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    135,018Coins
    Ratings:
    +10,335 / 48 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK