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

Question Wind simu

Discussion in 'DIY peripherals' started by michel123, Jul 19, 2024.

  1. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    Hello, after some research, here is where I am to create a wind simulator with 2 PC fans:

    2 SUNION DC 12 V 7.4 W PC fans - taken from an old xenon PC

    1 ELEGOO MEGA 2560 R3 arduino board - given by a friend who didn't use it

    I asked ChatGPT for an arduino code to control 2 PC fans for FLyPT Mover and here is the code in question, if anyone has the knowledge to check but it seems pretty good to me!!

    // Définir les broches PWM pour les ventilateurs
    const int fan1Pin = 9;
    const int fan2Pin = 10;

    // Variables pour stocker les vitesses des ventilateurs
    int fan1Speed = 0;
    int fan2Speed = 0;

    void setup() {
    // Initialiser la communication série
    Serial.begin(115200);

    // Configurer les broches des ventilateurs en tant que sorties
    pinMode(fan1Pin, OUTPUT);
    pinMode(fan2Pin, OUTPUT);

    // Initialiser les ventilateurs à l'arrêt
    analogWrite(fan1Pin, 0);
    analogWrite(fan2Pin, 0);
    }

    void loop() {
    // Vérifier si des données sont disponibles sur le port série
    if (Serial.available() > 0) {
    // Lire les données entrantes
    String data = Serial.readStringUntil('\n');

    // Analyser les données reçues
    if (data.startsWith("FAN1:")) {
    // Extraire et convertir la vitesse du ventilateur 1
    fan1Speed = data.substring(5).toInt();
    // Limiter la vitesse entre 0 et 255
    fan1Speed = constrain(fan1Speed, 0, 255);
    // Ajuster la vitesse du ventilateur 1
    analogWrite(fan1Pin, fan1Speed);
    } else if (data.startsWith("FAN2:")) {
    // Extraire et convertir la vitesse du ventilateur 2
    fan2Speed = data.substring(5).toInt();
    // Limiter la vitesse entre 0 et 255
    fan2Speed = constrain(fan2Speed, 0, 255);
    // Ajuster la vitesse du ventilateur 2
    analogWrite(fan2Pin, fan2Speed);
    }
    }
    }
    20240719_184030.jpg

    I'm waiting for my dual motor controller to manage my 12 V fans with my arduino card.

    For the moment we have this, if anyone has a better designed arduino code, I'm interested, I will receive the material on Sunday, I could test if it already works with the code proposed by ChatGPT.
  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,851
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    146,942Coins
    Ratings:
    +10,841 / 53 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  3. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    Thank's for the link !!

    Here my sim Wind ! run with simhub perfectly !

    the vidéo link who help me :



    Attached Files:

    Last edited: Jul 31, 2024
  4. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    The vidéo link it's not me ! just help me for my simu wind !

    The mine :

  5. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    Another code that works when I send the data to the arduino monitor: 000 255, motor 2 is running, 255 000, the right motor is running and if I put 255 255 both are working.

    Problem I put <L> and <R> with an output which gives me 000 000 under flyPT mover nothing seems to come out, as if arduino did not understand the sending of FlyPT ???? ?
    Help ! I don't see what is wrong, the code works very well under arduino with the monitor, why does it not work with FlyPT???

    // Define pins for L298
    #define ENA 10
    #define IN1 8
    #define IN2 9
    #define ENB 5
    #define IN3 7
    #define IN4 6

    void setup() {
    // Initialize serial communication at 115200 bits per second:
    Serial.begin(115200);


    TCCR2B = TCCR2B & B11111000 | B00000101;

    // Set all the motor control pins to outputs
    pinMode(ENA, OUTPUT);
    pinMode(IN1, OUTPUT);
    pinMode(IN2, OUTPUT);
    pinMode(ENB, OUTPUT);
    pinMode(IN3, OUTPUT);
    pinMode(IN4, OUTPUT);

    // Initially stop both fans
    // stopFans();
    }

    void loop() {
    // Check if data is available to read
    if (Serial.available() > 0) {
    // Read the incoming string:
    String command = Serial.readStringUntil('\n');

    // Parse the command
    parseCommand(command);
    }
    }

    // Function to parse and execute the command
    void parseCommand(String command) {
    // Example command format: "000 000"
    if (command.length() == 7) { // Ensure the command is the correct length
    int f1Value = command.substring(0, 3).toInt();
    int f2Value = command.substring(4, 7).toInt();

    // Constrain values to 0-255 range
    // f1Value = constrain(f1Value, 0, 255);
    // f2Value = constrain(f2Value, 0, 255);

    // Control fans
    controlFan1(f1Value);
    controlFan2(f2Value);
    }
    }

    // Function to control fan 1
    void controlFan1(int speed) {
    if (speed > 0) {
    digitalWrite(IN1, HIGH);
    digitalWrite(IN2, LOW);
    analogWrite(ENA, speed);
    } else {
    analogWrite(ENA, 0);
    }
    }

    // Function to control fan 2
    void controlFan2(int speed) {
    if (speed > 0) {
    digitalWrite(IN3, HIGH);
    digitalWrite(IN4, LOW);
    analogWrite(ENB, speed);
    } else {
    analogWrite(ENB, 0);
    }
    }

    // Function to stop both fans
    // void stopFans() {
    // analogWrite(ENA, 0);
    // analogWrite(ENB, 0);
    // }

    I'm repost here, because it's more simple for mee. Sorry. I'have posted to other "forum wind" but no response.

    Attached Files:

  6. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    That's it !

    I found the right code for my fans with the right data to send with FlyPT Mover!

    So below is the code (with the good trick which avoids a REMAP of the data, you have to put the sync at 31 Khz with the line TCCR3B = TCCR3B & B11111000 | B00000001;
    TCCR2B = TCCR2B & B11111000 | B00000001; this is blah operating frequency of the fans in reality):

    And the photo of FlyPT mover to send the right data!

    #define BRAKEVCC 0
    #define CW 1
    #define CCW 2
    #define BRAKEGND 3
    #define CS_THRESHOLD 100

    int inApin[2] = {8, 9}; // INA: Clockwise input - Entrée dans le sens des aiguilles d'une montre
    int inBpin[2] = {6, 7}; // INB: Counter-clockwise input - Entrée dans le sens inverse des aiguilles d'une montre
    int pwmpin[2] = {5, 10}; // PWM input - Entrée PWM
    int cspin[2] = {2, 11}; // CS: Current sense ANALOG input - CS : entrée ANALOGIQUE de détection de courant
    int enpin[2] = {0, 1}; // EN: Status of switches output (Analog pin) - État de la sortie des commutateurs (broche analogique)
    int statpin = 13;

    byte bytesBuffer[4] = {0};

    void setup()
    {
    Serial.begin(115200);
    pinMode(statpin, OUTPUT);

    // Initialize digital pins as outputs - Initialiser les broches numériques en tant que sorties
    for (int i=0; i<2; i++)
    {
    pinMode(inApin, OUTPUT);
    pinMode(inBpin, OUTPUT);
    pinMode(pwmpin, OUTPUT);
    // pinMode(pwmpin, 0);
    analogWrite(pwmpin, 0);
    }

    // Initialize braked - Initialiser freiné
    for (int i=0; i<2; i++)
    {
    digitalWrite(inApin, LOW);
    digitalWrite(inBpin, LOW);
    }
    }

    void loop()
    {
    TCCR3B = TCCR3B & B11111000 | B00000001;
    TCCR2B = TCCR2B & B11111000 | B00000001;

    if (Serial.available())
    {

    bytesBuffer[0]=bytesBuffer[1];

    bytesBuffer[1]=bytesBuffer[2];

    bytesBuffer[2]=bytesBuffer[3];

    bytesBuffer[3] = Serial.read();

    if(bytesBuffer[0] == 0 && bytesBuffer[1] == 0)

    digitalWrite(inApin[2]=8, HIGH);
    analogWrite(pwmpin[2]=10, bytesBuffer[2]);


    digitalWrite(inBpin[2]=7, HIGH);
    analogWrite(pwmpin[2]=5, bytesBuffer[3]);
    }
    }


    With ceal you can therefore control right and left independently.

    Attached Files:

    • Useful Useful x 1
  7. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    Here for my vidéo in the 2Dofs
    • Like Like x 1
  8. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    an here for my video for FlyPT Mover :
  9. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    The armchair with 2 articulated arms found on Amazon for €15 per arm!

    Armchair currently finished, with Flypt mover you can start the fans as you want!

    Wind, canopy and RPM settings to manage all of this!

    Thanks again to the community! 20240817_101842.jpg 20240817_101908.jpg
  10. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,851
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    146,942Coins
    Ratings:
    +10,841 / 53 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    The articulated arms for wind sim fans is a great idea, do you have a brand and product page link for what you used?
  11. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform


    The price has increased slightly since I took them (I had a promotion...).

    But they are very very good, everything is tight and holds well, and can easily be adapted to attach the fans to them.

    Sincerely ! ;)
  12. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    I don't understand, my link to Amazon doesn't appear???

    I leave you here the full name to type in Amazon to find the article: "
    Phieeseriy Support Tablette Lit en Aluminium, Portable Support Vidéo Bras Articulé Porte pour iPad 10/9/8/7/6/Pro 12.9/11/Mini 6 5 4/, Support de Bureau Flexible et Rotatif à 360° pour Téléphone 4-7""
    • Informative Informative x 1
  13. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    Capture d'écran 2024-08-21 103348.jpg
    • Informative Informative x 1
  14. michel123

    michel123 Member

    Joined:
    Jan 12, 2024
    Messages:
    37
    Occupation:
    cadre sncf
    Location:
    lezignan-corbieres
    Balance:
    62Coins
    Ratings:
    +22 / 0 / -0
    My Motion Simulator:
    2DOF, AC motor, Arduino, Motion platform
    And so now, with the covers made by my brother on his 3D printer (model easily found on intent and scaled for 12 cm venilos). 10 euros of plastic and 22 hours of printing to make both! Works perfectly ;)

    20240825_112638.jpg 20240825_192935.jpg 20240825_192942.jpg 20240825_193040.jpg

    Attached Files:

    • Like Like x 1