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

Lesson SimTools v3 - 3D Wind Dash Example (with Arduino Sketch)

Discussion in 'Tutorials and Tips by the Developer' started by yobuddy, Jun 19, 2023.

  1. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    Here is another example of how to use the dash feature found in SimTools v3.
    (Special thanks to @early_m for helping with this post!)

    Below you will find a wiring diagram, a sketch for an Arduino, and instructions to turn a pair of In Line Blower fans into dual speed fan setup for a sway controlled 3D wind setup.



    Here is the fan wiring diagram: (Both fans are connected the same way as shown, with pin 3 in the pic below being the fan’s output pin number)
    DualSpeedFans.png

    Dual SpeedFans Arduino Sketch:
    Dual_SpeedFans.zip

    Once the file is opened, if you need to, you can change the fan output pins here.
    Then upload it to the Arduino and you are golden!
    upload_2023-6-19_12-47-46.png

    SimTools v3 setup.
    Go to the interface settings and connect your new dual speed fan setup.
    upload_2023-6-19_12-48-5.png

    Click here to get to the 3D wind settings:
    upload_2023-6-19_13-6-26.png

    Configure the sway, speed and output configuration settings shown in the orange box below. Then then adjust the fan speeds when panning to your liking
    upload_2023-6-19_12-48-20.png

    And lastly, tell SimTools what to send for output
    upload_2023-6-19_12-49-5.png

    That's it, now run the game and enjoy!
    yobuddy
    • Winner Winner x 4
    Last edited: Jun 23, 2023
  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,862
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    147,009Coins
    Ratings:
    +10,845 / 53 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    • Like Like x 1
  3. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    Hi friends ! I have an arduino one + adafruit motor shield V2 to power two PWMfans. I followed a lot of advice but I'm a bit stuck... I think I need to download a sketch for my arduino to configure it but I don't know don't know how to do that. I put the tables here but it's a bit of a coincidence. Do you have any leads? Maybe I don't have the right equipment? I was on simhub before...I want to be on simtools V3 now. Thank you friends
  4. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    like that

    Attached Files:

  5. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    I'm sure we could get it up and running.
    Do you have a link to the sketch you are using on the Arduino?
    Do both fans blow the same hardness all the time?
    Or are they 3D sway fans?
  6. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    the two fans blow the same hardness... They are not in 3D... So for the sketch.. This is where I get bad... I was using this on simhub, I can find it over there?
    I really don't know where to find the link to the sketch... I don't even know where this sketch would be.. in short, I suck
    Last edited: Jun 23, 2023
  7. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    We can easily format the output to match what ever is needed, we just need to know what the output looks like currently so we can match it is all.

    I don't have a adafruit motor shield V2 to play with here, but if you set the PWM output pins in the sketch above and load it to the Arduino, I believe it will work on your setup. I think the fan pins would be 3 and 11 for your motor shield.

    I would think someone will get this working with a motor shield at some point, if you not comfortable with messing around in code on your Arduino.
  8. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    I mounted my arduino exactly like this :

    I don't know if that helps? I put the link of the tutorial on which I copied the assembly and the photo of my arduino as it is today.

    Attached Files:

  9. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    // 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;
    }
  10. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    Please try this buddy.

    Replace the "GetBits 1 5 8 d" command for speed, with these 2 commands.
    Map 0 100 0 255
    Pad 3 0

    Then for the 'Output Settings' - 'Interface Output' replace the '<Sp1>' with"
    S<Sp1>

    And then give it a run and see what happens.
    Chat soon,
    yobuddy
    • Useful Useful x 1
  11. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    thank you for your patience...unfortunately nothing is happening..
    • Informative Informative x 1
  12. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    The sketch shows that the communication rate is 9600, so please change the 115200 to 9600, and give it another go.
    [​IMG]
  13. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    Still nothing.. no propeller movement. What a mystery.. If I have to buy a specific card I can
    Maybe you can't spend too much time with my story...
  14. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    No worries at all, I'm sure we can get it to work.

    It says it supports sending from game dash, so it should not be to hard.
    Others may want to use Monster Moto's also.

    Looks like it takes a input of 'S' and 3 chars, like S001 thru S255, which is what I was trying to do with our output.
    Just for a test, in output settings, put "S255" instead of "S<Sp1>" and see what happens.
    Last edited: Jun 26, 2023
  15. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    Please make sure you set this to 10 or nothing will happen buddy.
    I bet it will work, once you set this value to 10.
    upload_2023-6-25_21-33-26.png
  16. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    Yep, I changed all that...But nothing...If you have the exact reference of the card to buy, I'm willing to do it...Monster Moto?
  17. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    There should be nothing you need to buy, we just need to get the settings right is all.
    Will you please check that you have all the settings updated correctly, we made multiple changes is all.
    I believe it should work is all.
  18. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    I tried all the combinations.
    I remember loading a sketch via simhub software...shouldn't I do this for simtools?
    Thank you for your incredible patience

    Attached Files:

  19. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    5,247
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,790Coins
    Ratings:
    +5,068 / 17 / -0
    Just to be sure, simhub or anything else that could be using com3, is not running correct?
    Only one thing can use a comport at a time is all.

    No worries at all buddy, thanks for keeping at it.
    Everything looks right to me, makes me thing something is using com3 already.
    If we can get it working, I think I could even edit the sketch above to get you 3d wind.
    I'm sure we can figure this out, still thinking it over...
  20. offman

    offman New Member

    Joined:
    Dec 15, 2021
    Messages:
    27
    Balance:
    10Coins
    Ratings:
    +9 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform
    hello, I uninstalled simhub, I checked that nothing uses COM3 (how to be 100% sure?). But so far nothing is working...
    • Informative Informative x 1