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

Wind simulation

Discussion in 'DIY peripherals' started by f1iceman, Apr 30, 2020.

  1. f1iceman

    f1iceman Why So Serious ? ( The Joker )

    Joined:
    Aug 29, 2015
    Messages:
    832
    Location:
    UK
    Balance:
    791Coins
    Ratings:
    +390 / 2 / -0
    My Motion Simulator:
    2DOF, 3DOF, SCN5
    Hi i am just finding the parts out lying around to make a basic wind simulation with an arduino.
    it should be simple enough.

    it will be parts wise.

    Lipo battery for main power.
    RC electronic speedo
    RC motor
    Aeroplane fan.

    So all i need to do is control the Speedo and to link to the Simtools too extract the wind side of things, so the thingwill work i think its basic servo codes used as thats all it will be really i guess a servo control.

    I am very very rusty these days and not what i used to be so i do stuggle these days and need help with things.

    Thanks for any replies of help.
    I have had a quick glance at some things.
    But my state of mind struggles and a sort of personal guide type thing is needed i guess to get my head working again.

    As i have the bits lying around i thought it would be a good way to get my brain working again and actually doing something positive with my simulator again.
  2. MarkusB

    MarkusB Well-Known Member Gold Contributor

    Joined:
    Jun 30, 2015
    Messages:
    552
    Location:
    Germany
    Balance:
    4,212Coins
    Ratings:
    +594 / 2 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino, Motion platform
    • Agree Agree x 1
    Last edited: Apr 30, 2020
  3. f1iceman

    f1iceman Why So Serious ? ( The Joker )

    Joined:
    Aug 29, 2015
    Messages:
    832
    Location:
    UK
    Balance:
    791Coins
    Ratings:
    +390 / 2 / -0
    My Motion Simulator:
    2DOF, 3DOF, SCN5
    right just found all my bits out for the wind side of things.
    what i need to know is really.
    Can i just use a basic servo code for the arduino if i find a code for it? and then does the simtools dash then detect when i set that up with the ports ect... so no really special code to set up for the speedo.

    so will be usb arduino loaded with servo code.
    battery
    speedo connected to the arduino in the pin 9 socket and ground.
    motor connected to speedo.
    fan on end of motor from a plane.

    set up game dash and configure the setup there to connect to a servo.

    just getting my head back into the ways of the force ! lol
    Last edited: May 2, 2020
  4. f1iceman

    f1iceman Why So Serious ? ( The Joker )

    Joined:
    Aug 29, 2015
    Messages:
    832
    Location:
    UK
    Balance:
    791Coins
    Ratings:
    +390 / 2 / -0
    My Motion Simulator:
    2DOF, 3DOF, SCN5
    Now i am all set up on my desk having a play.
    I am not sure the code for the moto would work with a stand alone RC speedo.

    This is what i have so far to test the kit.

    #include <Servo.h>
    Servo myservo;
    void setup()
    {
    myservo.attach(9);

    myservo.write(40); // initialization of speed controller
    delay(5000);
    myservo.write(40); //almost the highest possible speed , this i can change the number to change the speed of the motor but i have to up load each time.
    }
    void loop(){}

    Its cool when the motor moves.

    So the test is done the kit works.

    Now i am stuck !! LMAO
  5. f1iceman

    f1iceman Why So Serious ? ( The Joker )

    Joined:
    Aug 29, 2015
    Messages:
    832
    Location:
    UK
    Balance:
    791Coins
    Ratings:
    +390 / 2 / -0
    My Motion Simulator:
    2DOF, 3DOF, SCN5
    right cheated abit now.
    this is not as easy as it look but i have found some code that now lets me press a button on the keyboard (u) speed up (d) speed down.
    now is there any way i can change this code so it links to the way simtools would use it for the control.
    i feel i am doing this all wrong and barking up the wrong tree.

    /*
    Copyright (c) <2014> <Ankur Mohan>

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.

    Note: Select the mode (program mode/throttle setting mode/normal mode), run this code,
    then power on the ESC. Don't power on the ESC before this code is executing, otherwise
    the ESC will see random values on the PWM pin.
    */

    // Need the Servo library
    #include <Servo.h>

    #define NUMMOTORS 4
    typedef struct MotorDef
    {
    Servo Motor;
    int Pin; // Indicates the Pin this motor is connected to
    };

    MotorDef Motors[NUMMOTORS];

    // Stores the settings for all ESC. This can be made specific to each ESC, but that's not needed
    // for a quadcopter project
    typedef struct ESCSettingsDef
    {
    int Low;
    int High;
    };

    ESCSettingsDef ESCSettings;

    //#define PROGRAM_MODE
    //#define THROTTLE_MODE
    #define NORMAL_MODE

    int CurrentSpeed;
    int Step = 10;


    #define ESC_HIGH_DEFAULT 200
    #define ESC_LOW_DEFAULT 20

    void setup()
    {

    // Required for I/O from Serial monitor
    Serial.begin(9600);
    Serial.println("Setup: Serial port communication at 9600bps");
    // Attach motors to pins

    Motors[0].Pin = 11;
    Motors[1].Pin = 10;
    Motors[2].Pin = 9;
    Motors[3].Pin = 8;

    for(int i = 0; i < NUMMOTORS; i++)
    {
    int pin = Motors.Pin;
    Motors.Motor.attach(pin);
    }

    // Set the ESC settings to the defaults
    ESCSettings.Low = ESC_LOW_DEFAULT;
    ESCSettings.High = ESC_HIGH_DEFAULT;
    }

    // Read low/high speed for the ESC
    void ReadLHSpeed()
    {
    Serial.println("Enter Low Speed");
    delay(10);
    while(!Serial.available()){}
    ESCSettings.Low = Serial.parseInt();
    Serial.println("Low Speed is");
    Serial.print(ESCSettings.Low);
    Serial.println("\nEnter High Speed\n");
    delay(10);
    while(!Serial.available()){}
    ESCSettings.High = Serial.parseInt();
    Serial.println("High Speed is");
    Serial.print(ESCSettings.High);
    Serial.println("\n");

    }

    void SetThrottleRange()
    {
    Serial.println("In Set Throttle Range mode");

    for (int i = 0; i < NUMMOTORS; i++)
    {
    Motors.Motor.write(ESCSettings.High);
    }

    Serial.println("Connect the ESC now. After connecting the ESC, you should hear the ESC startup tones. Shortly afterwards, you should hear two beeps indicating that the ESC has registered the high throttle value. Immediately after hearing the two beeps, push any key. If you don't do so in 5 sec, the ESC will go into program mode");

    // Wait for user input
    while (!Serial.available())
    {
    }
    Serial.read();

    Serial.println("\nSetting the low throttle setting. If this happens successfully, you should hear several beeps indicating the input voltage supplied to the ESC followed by a long beep indicating that the low throttle has been set. After this point, push any key to proceed, your ESC is ready to be used");

    for (int i = 0; i < NUMMOTORS; i++)
    {
    Motors.Motor.write(ESCSettings.Low);
    }

    // Wait for user input
    while (!Serial.available())
    {
    }
    Serial.read();
    }

    void ProgramESC()
    {
    Serial.println("In program mode");

    for (int i = 0; i < NUMMOTORS; i++)
    {
    Motors.Motor.write(ESCSettings.High);
    }

    // Serial.println("Connect the ESC now. After connecting the ESC, you should hear \"
    // "the ESC startup tones. Shortly afterwards, you should hear two beeps \"
    // "indicating that the ESC has registered the high throttle value. Now wait \"
    // "for about 5 seconds and the ESC will enter program mode. Once the ESC is in \"
    // "program mode, it will play a special tone. AFter this, it will emit a series of \"
    // "beeps indicating different settings. When you hear the beep corresponding to the \"
    // "setting you want to change, push a key. This will set the throttle to low and the \"
    // "ESC will play beeps corresponding to the various values of that setting. As soon as \"
    // "you hear the right beep, push another key and the throttle will be raised to high \"
    // "and the value for that setting will be set. The ESC will acknowledge by playing a \"
    // "special tone");

    // After the user inputs a key stroke, set the throttle to low
    while (!Serial.available())
    {
    }
    Serial.read();

    for (int i = 0; i < NUMMOTORS; i++)
    {
    Motors.Motor.write(ESCSettings.Low);
    }

    // After the user inputs a key stroke, set the throttle to high. This will set the value of the setting.
    while (!Serial.available())
    {
    }
    Serial.read();

    for (int i = 0; i < NUMMOTORS; i++)
    {
    Motors.Motor.write(ESCSettings.High);
    }

    delay(2000);

    Serial.println("Programming the ESC finished, you can power off the ESC now");

    }

    // Increase the speed of the motor from low to high as set by the user
    void Run()
    {
    // Send a low signal initially for normal mode
    for (int i = 0; i < NUMMOTORS; i++)
    {
    Motors.Motor.write(ESCSettings.Low);
    }
    Serial.println("Running ESC");
    Serial.println("Step = ");
    Serial.print(Step);
    Serial.println("\nPress 'u' to increase speed, 'd' to reduce speed");

    CurrentSpeed = ESCSettings.Low;
    while (1) {
    while (!Serial.available())
    {
    }
    char currentChar = Serial.read();
    if (currentChar == 'u')
    {
    Serial.println("\nIncreasing motor speed by step");
    if (CurrentSpeed + Step < ESCSettings.High) {
    CurrentSpeed = CurrentSpeed + Step;
    Serial.println("New speed = ");
    Serial.print(CurrentSpeed);
    }

    else
    {
    Serial.println("\nMax speed reached\n");
    }
    }
    if (currentChar == 'd')
    {
    Serial.println("\nDecreasing motor speed by step\n");
    if (CurrentSpeed - Step >= ESCSettings.Low)
    {
    CurrentSpeed = CurrentSpeed - Step;
    Serial.println("New speed = ");
    Serial.print(CurrentSpeed);
    }

    else
    {
    Serial.println("\nMin speed reached\n");
    }
    }
    if (currentChar == 'e')
    {
    Serial.println("\nStopping Motors\n");
    CurrentSpeed = ESCSettings.Low;
    }
    for (int i = 0; i < NUMMOTORS; i++)
    {
    Motors.Motor.write(CurrentSpeed);
    }
    }
    }

    void loop()
    {
    #ifdef NORMAL_MODE
    Run();
    #elif defined THROTTLE_MODE
    SetThrottleRange();
    Run();
    #elif defined PROGRAM_MODE
    ProgramESC();
    #endif
    while(1) { }
    }


    Can not get my head into it and really can not find much regarding RC esc for this so i am defo stuck, most code is with a pot for speed control.
    Brain hurts now so stopping and prob going to get a monster moto thingy me bobs, as i be running now thank to you awesome lot.
  6. f1iceman

    f1iceman Why So Serious ? ( The Joker )

    Joined:
    Aug 29, 2015
    Messages:
    832
    Location:
    UK
    Balance:
    791Coins
    Ratings:
    +390 / 2 / -0
    My Motion Simulator:
    2DOF, 3DOF, SCN5
    Well I am running, but not with esc, i ended up buying a monster moto board, installing simhub and was running in about 5 mins.
    I still like the esc better as i can trust the amps and what they can handle.

    The one bit that i just don't get is do i have to load the arduino up with the code for games dash or does game dash just do generic type link as a servo so no need to code the arduino.
    I have been reading but don't understand if i need to code game dash in or just the servo code and the game dash dies the rest when you select servo and assign.
    Its possible i have worked out i prob only need a code for zero to 255 pwm.
    And add the esc arm code to it.

    Was posting a video but was too large will do it tomoz.
  7. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,535
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,034Coins
    Ratings:
    +10,776 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Last edited: May 6, 2020
  8. f1iceman

    f1iceman Why So Serious ? ( The Joker )

    Joined:
    Aug 29, 2015
    Messages:
    832
    Location:
    UK
    Balance:
    791Coins
    Ratings:
    +390 / 2 / -0
    My Motion Simulator:
    2DOF, 3DOF, SCN5
    I habe it working for the MM board its the esc i want to get working as the amps can be unlomited with that kit.
    So what i mean is do i need to load the arduino up with some games dash code or just basic servo and esc inicialization code an the gamesm dash will work it as a servo naturallu like rc speedo is pretty much.
    So line of my thinking.
    Add the esc initialasation code first
    Then the servo code for pwm 0-255.

    Then game dash will see it as a servo.

    Or is it do all that and load it with some sim dash basic code aswell.
    This is where i kinda fall short if there is a standard code for game dash i need to add.
    I get confuse as there is nothing in the line of what i am teying to do.
    Nobody seems to have done it with an esc yet it does get mentioned here and there as a great option.
    Last edited by a moderator: May 6, 2020