Easy DIY wind simulator for Assetto Corsa

Discussion in 'Sim Racing Hardware' started by Insert Coin, Apr 1, 2017.

  1. Insert Coin

    Insert Coin

    Messages:
    399
    Ratings:
    +141
    Do you want to feel the wind blowing when you drive your open wheeler in Assetto Corsa? Now you can!

    In short: ACFan sends speed of car in AC to Arduino Uno R3, which controls PWM fan(s). No PWM whine. Hardly any CPU load.

    Scythe GlideStream 120 PWM SC (silent)


    Delta AFB1212SH fans (more wind, noisier)


    Sanyo San Ace 120 9SG1212P1G03 (only one fan, loud!)

    I needed to clamp the fan to the desk or it would fly away :laugh:.
    Don't mind the driving, I'm not used to an Xbox controller.

    Thermalright TY 143 140 mm fans (no video)
    Dsc01897.jpg

    (pen for size)

    I would like to present my little project: a wind simulator for Assetto Corsa. Most wind simulators use an Arduino combined with a separate motor controller, which can be expensive if you use larger fans. My project also uses an Arduino, but with standard PWM PC case fans. A PWM fan has a motor controller built into the fan. The Arduino just sends a PWM signal to the fan and this will control the speed of the fan. This way there are less parts needed and the project is kept simple.

    Credits
    It’s not an original idea of me, I just combined two ideas: using an Arduino to control a PWM fan and using an existing interface between Assetto Corsa and the Arduino. There is no PWM whine coming from the fan because a 25 KHz PWM signal is used.

    I would like to thank afremont for his PWM logic, see https://forum.arduino.cc/index.php?topic=155089.45

    I would like to thank mongo56 for his ‘ACFan’ executable and source code, see https://www.reddit.com/r/oculus/comments/2b8d3m/assetto_corsa_fan_control/

    ACFan
    The program ACFan is the interface between Assetto Corsa and an Arduino. ACFan reads the shared memory of AC: the speed of the car and the steering input. When the car is idle, it sends value 30 to the Arduino. As soon as the cars starts rolling, it sends between 61 and 100 to the Arduino, depending on the speed of the car. ACFan also varies the values a bit when you are steering to simulate wind direction changes.

    Arduino
    I have modified the sketch (program) mongo56 made for the Arduino, it now uses PWM to control the speed of the fan. It has a startup sequence built in which speeds up the fan in a few seconds so you know the Arduino is doing its job. After that it continuously translates the values sent by ACFan to a usable PWM value, between 0 and 79.
    Remark: when there is no PWM signal sent to the fan, it will run at top speed.

    Fans to use
    Most fans cannot stop completely, even with a PWM signal at zero. The Scythe GlideStream 120 PWM SC fans I chose have a speed of 300 to 1500 RPM. This means there will always be some wind blowing when the car stops (= 300 RPM). At best you can use fans with a broad RPM range: a low minimum and high maximum RPM value. This way the fan will produce a higher wind speed difference at high and low car speed.
    The Delta and Sanyo have a minimum RPM of 0. The Thermalright fans have a 600 RPM minimum, but you can hardly feel anything at this speed (so no problem).
    The Sanyo fan will only start after reaching a higher minimum PWM threshold, but still has a fairly low minimum RPM.

    You need as much air flow as you can get, this is the CFM (Cubic Feet per Minute) value of the fan: a higher CFM value means more air flow. The Scythe fan produces 85 CFM, the Delta AFB1212SH fan produces 113 CFM and the Thermalright TY 143 fan produces 130 CFM. There are PWM fans which can produce 260 CFM like the Sanyo San Ace 120 9SG1212P1G03, but they produce a lot of noise! Check the dB value of the fan to see how much noise it produces: 29.5 dB for the Scythe fan, 45 dB for the Thermalright TY 143 fan, 46.5 dB for the Delta fan and a whopping 64 dB for the Sanyo fan (that’s LOUD, see video above). A small fan with a high RPM value will also make a lot of noise. A larger fan is recommended: lower noise and a wider air flow (but see the addendum below).
    My current recommendation is to use the Thermalright TY 143 140 mm fans: more wind (130 CFM), not too loud (45 dB).

    Power
    A high CFM fan needs more power. The Scythe fan I chose draws 0.22 Amps at 12V. If you use two of them you need a 12V power adapter which can deliver at least 0.5 Amps (0.22 x 2).
    Power supply.jpg

    The Delta AFB1212SH fan draws 0.83 Amps maximum, if you use two of them you need a 2 Amps power adapter (0.83 x 2).
    The Thermalright TY 143 fans draw 0.6 Amps each, so 1.2 Amps if you use two of them.
    The 260 CFM Sanyo fan I mentioned draws 4 Amps, so if you use that one you need a much bigger power adapter: 4 Amps or 8 Amps if you use two fans (but then the neighbors will complain about the noise :D).

    To avoid damaging the Arduino the power to the fans in my project is connected directly to the power adapter, it is not running through the Arduino. The Arduino is only controlling the speed.

    More fans
    You can use as much fans as you want: by connecting the PWM signal from the Arduino to each fan the speed will be controlled of all fans. Do check if you need a bigger power adapter.

    I’m using two fans as shown in this picture:
    Two fans.jpg

    The fans are tie wrapped together with a piece of tube in the middle, so you can angle the fans a bit inward.

    What do you need?
    I have added the price I paid for it.
    • Arduino Uno R3 (clone), 13 euro
    • Arduino Uno frame (mini case) is recommended, 5 euro
    • USB cable type B, 0.50 euro
    • 12V power adapter of at least 0.5A (2A recommended), 5 euro
    • Multicolored Dupont wires (a kit of male / male, male / female, female / female is handy), about 6 euro
    • Two Scythe GlideStream 120 PWM SC (SY1225HB12MS-RKP) fans (or just one), 8.79 euro each
      or
      two Delta AFB1212SH fans (eBay), about 10 euro each
      or
      two Thermalright TY 143 fans, 13.43 euro each.
      I do not recommend the Sanyo fans: too loud.
    • 3 pin tumbler switch, 0.75 euro. Alternative: use a power socket with a switch in which you plug the adapter
    • 4-pin PWM fan splitter cable (Y-cable) if you use more than one fan: build it yourself or buy this one
    • Pin header, 0.25 euro
    Total costs: 48.09 euro (50.51 euro when Delta fans are used, 57.36 euro when Thermalright fans are used). Shipping costs excluded.

    Programming
    • Download the Arduino IDE (programming environment) at https://www.arduino.cc/en/Main/Software and install it.
    • Connect the Arduino to your PC using the USB cable.
    • Check Windows’ device manager to see which COM port the Arduino is using.
    Start the Arduino IDE and
    • click on Tools – Board and select Arduino Uno
    • click on Tools – Port and select the COM port you found in the device manager
    • click on Tools – Programmer and select USBasp
    Delete all shown source code in the IDE (all text) and paste my sketch into the IDE:
    Code:
    // Arduino UNO sketch
    // Insert Coin
    // Version 1.0: April 1, 2017
    // Version 1.1: May 26, 2018
    //
    // Thanks to afremont for his PWM logic,
    // see https://forum.arduino.cc/index.php?topic=155089.45
    //
    // Thanks to mongo56 for his idea ACFan and source code,
    // see https://www.reddit.com/r/oculus/comments/2b8d3m/assetto_corsa_fan_control/
    //
    // Version 1.1: higher minimum speed of the fans while driving slowly
    // Maximum speed of the fans now set at 250 km/h
    //
    
    String incomingValue;
    int myval;
    unsigned int x;
    
    const int PWMPin = 3;
    
    void setup() {
      myval = 0;
      Serial.begin(9600);
     
      // generate 25kHz PWM pulse rate on Pin 3
      pinMode(PWMPin, OUTPUT);   // OCR2B sets duty cycle
      // Set up Fast PWM on Pin 3
      TCCR2A = 0x23;     // COM2B1, WGM21, WGM20
      // Set prescaler  
      TCCR2B = 0x0A;   // WGM21, Prescaler = /8
      // Set TOP and initialize duty cycle to zero(0)
      OCR2A = 79;    // TOP DO NOT CHANGE, SETS PWM PULSE RATE
    
      // start-up sequence: let the user know we are working OK
      // start fan at lowest speed
      OCR2B = 0;   // duty cycle for Pin 3 (0-79) generates 1 500nS pulse even when 0 :(
      // wait for the fan to power down
      delay(1000);
      // ramp up fan speed by increasing duty cycle every 50mS, takes 4 seconds
      for(x = 0; x < 80; x++) {
        OCR2B = x;    // set duty cycle
        delay(50);
      }  
    
      // wait a bit
      delay(3000);
      // set fan to lowest speed
      OCR2B = 40;   // duty cycle for Pin 3 (0-79) generates 1 500nS pulse even when 0 :(
    }
    
    void loop() {
    
      // waiting for data coming from ACFan.exe
      // which retrieves the speed from Assetto Corsa,
      // converts it to a string and sends it to the Arduino
      if(Serial.available() > 0)
      {
        char ch = Serial.read();
        // check for new line and add the char if it isn't
        if (ch != 10){
          incomingValue += ch;
        }
        else
        {
          // Serial.println(incomingString);
          int val = incomingValue.toInt();
         
          // Text copied from ACFan.cpp:
          // ESC value between 30 and 180 (30 = initial startup)
          // adjust this to fit your ESC/motor and liking
          // 61 was the value my motor started running
          // 350 was my max speed in Assetto Corsa (in kmh)
          // 50 was an arbitary multiplier to normalise the output values between ~61-100
          // also added a bit of variance with steerAngle so that when you turn in you get a little less "wind"
         
          if (val > -1 && val < 181)
          {
    
           // Version 1.1, another approach: about 30% low speed boost
           if (val < 63)
           {
            myval = 0;  // fans to 0% when the car isn't moving
           }
           else {
            myval = (val - 35) * 1.25;
            // To get a variance between 0 and 79 instead of 61 and 100.
            // 1.25 = max speed around 250 km/h, decrease this value for faster cars.
            // Higher minimum speed of the fans.
           }
           
           // check if out of bounds
           if (myval < 0) {
            myval = 0;
           }
           if (myval > 79) {
            myval = 79;
           }
    
    
           // set the fan speed (duty cycle)
           OCR2B = myval;
          }
          // clear the input string that came from ACFan
          incomingValue = "";
        }
      }
    
    }
    
    Click on the icon with the arrow pointing right, this will compile the sketch and send it to the Arduino. If there are no errors shown in red you can now close the IDE.

    Connecting the fans
    Connect the power adapter and the fans like this:

    Schema.jpg

    Dsc01412.jpg

    Dsc01415.jpg

    Dsc01414.jpg

    Dsc01413.jpg



    Pin 3 of the Arduino is connected to the PWM pin of the fan (the orange wire on the fan).
    The GND of the power adapter is connected to the GND of the Arduino and the black wire of the fan.
    The + of the power adapter is connected to the red wire of the fan. A switch in this wire is handy to power off the fans after racing.
    My son (thanks man!) did all the soldering and made a Y-cable which splits the power and PWM signal to both fans, but you can buy a ready made.

    Dsc01419.jpg

    Testing the hardware
    Plug in the power adapter and switch it on. The fans should start running.
    Press the reset button on the Arduino, this will initiate the startup sequence: the fans will run faster and faster and drop to the lowest speed in about 4 seconds time.

    Connecting to Assetto Corsa
    Download the program ACFan.exe which you can find in the binary folder here: https://drive.google.com/drive/folders/0B-23DIE-A8sUYXowYTlXXzBpR00
    Save ACFan.exe in a folder, for example in C:\AC.
    Create a shortcut to C:\AC\ACFan.exe on your desktop.
    Right click the shortcut, go to Properties and add the COM port to the target, for example “C:\AC\ACFan.exe” com5 and click on OK.
    Start Assetto Corsa and start a practice run. Tip: keep Assetto Corsa running in a small window so you can see the game and the output ACFan at the same time. While driving you should see numbers between 61 and 100; 30 when your car doesn’t move.
    The fans should blow accordingly.
    Note: when you run the game as administrator, you may need to run ACFan as administrator as well.

    Addendum: airflow straightener
    It is a good idea to mount an airflow straightener to the fans. As the name implies the airflow will be straightened ('combed', 'directed') when it leaves the fan. This results in a 20 - 25% higher airflow and the wind doesn't 'flutter' around. You really can feel the difference with and without it. Highly recommended.

    I was looking for a ready made airflow straightener, but couldn't find one, so I built one myself. What you need: thick straws, super glue, scissors and some tape.
    I bought 200 1.1 cm STANNY straws at Jysk.
    I cut all yellow straws into 3 cm pieces. For a 140 mm fan you need 133 pieces, so that's 266 for two fans. Glue the pieces together with super glue so you get a nice 'pancake'. Let them dry for at least 48 hours or you will get a headache from the glue when the fans are blowing in your face!
    Tape the 'pancakes' to the fan with sealing tape for cardboard boxes.

    The result looks like this (yes, I'm driving in VR only):
    Dsc01913.jpg

    The flexible gooseneck and clip is a Bresser BR-12 (40 cm).

    More photos in the comments below as I cannot post more in this article.

    I hope you will be blown away :D. Let me know what you think. Feel free to ask.

    Insert Coin
     
    Last edited: May 26, 2018
    • Like Like x 8
  2. Mr Chip

    Mr Chip
    A lot of gear, little idea.......

    Messages:
    170
    Ratings:
    +85
    Nice, love it!

    I don't race open wheelers much, but this could be a good way to help keep cool with Rift on :thumbsup:
     
  3. RinusDirtRally

    RinusDirtRally

    Messages:
    194
    Ratings:
    +111
    Nice guide, mate. I love it too. Maybe a project for in the future. Bookmarked it.
     
  4. Paul Blythe

    Paul Blythe

    Messages:
    195
    Ratings:
    +115
    Nice little project ... certainly a good way to keep cool with the Rift.

    Just wondering if there's any way of using this with other sims also?
     
  5. Vantage9

    Vantage9

    Messages:
    2
    Ratings:
    +0
    Yes, the Xsimulator guys have it working for all kinds of games. Anything that's supported by SimVibe. I've been researching ways to tackle this project as a programming newbie, and the SimVibe route seemed like the most user-friendly, but its somewhat expensive software if you're only using it for Assetto. This solution looks like it might be easier and cheaper, I'll think I'll give it a shot first.

    https://www.xsimulator.net/community/threads/simulated-wind-using-monstermoto-and-arduinouno.6876/
     
  6. Vantage9

    Vantage9

    Messages:
    2
    Ratings:
    +0
    Total idiot question here, but I'm using this project as my intro to Arduino. My only real experience with electrical circuits is with wiring LEDs of various types & applications, and I've always had to be concerned with using resistors to not blow out the LEDs.

    If I use a power supply that's more than I need, or if I only use 1 Fan, do I need to be concerned with sending too much juice to the Fans? If not, I think I have everything I need to test this out right away...
     
  7. Insert Coin

    Insert Coin

    Messages:
    399
    Ratings:
    +141
    A power supply doesn't push the amps, it only delivers as requested. As an example you can use a 20 Amps power supply and connect a 0.5 Amp fan. The power supply will deliver 0.5 (as requested by the fan), not 20. In this case you're using a much too expensive power supply, that's all. So no fireworks ;).
     
  8. Mr Latte

    Mr Latte

    Messages:
    1,245
    Ratings:
    +409
    Nice, enjoyable read @Insert Coin.

    Think a lot might like this little mod sir.
    I'd like to see a solution that can be bought with interconnecting cables, so no soldering to work with 4 pin fans.

    Such may be found here if you can direct to something suitable for no soldering?

    I've imported to UK from this company for suitable cables to replace the noisy fans in Behringer Inuke amps. Couldnt find the cables in UK/Europe and they seem to do a LOT of stuff. Appreciate if a solution hassle free if a bit more expensive is found.
     
    Last edited: Apr 5, 2017
  9. Insert Coin

    Insert Coin

    Messages:
    399
    Ratings:
    +141
    Post updated: videos added using Delta AFB1212SH fans and a Sanyo San Ace 120 9SG1212P1G03 fan. Also updated the text with the specs of those fans.

    Regarding soldering, consider this to avoid most of it:
     
  10. museumsteve

    museumsteve

    Messages:
    474
    Ratings:
    +172
    Look up Symprojects fan board..plug n play and works with just about all current sims
     
    • Like Like x 2
  11. gmerariu

    gmerariu

    Messages:
    1
    Ratings:
    +1
    • Like Like x 1
  12. Insert Coin

    Insert Coin

    Messages:
    399
    Ratings:
    +141
    Added to the article: Thermalright TY-143 fans and the use of air flow straighteners, built with Jysk STANNY 1.1 cm jumbo straws. Highly recommended.

    nexbeam120_6.jpg

    Jumbo straw STANNY 20_pk _JYSK.jpg

    Dsc01898.jpg
    Dsc01899.jpg

    Dsc01900.jpg

    Dsc01901.jpg

    Dsc01903.jpg
    Dsc01907.jpg

    Dsc01910.jpg
    Dsc01914.jpg
     
  13. Fabian Biehne

    Fabian Biehne
    Premium

    Messages:
    707
    Ratings:
    +675
    Is it the first of april again? :D
     
    • Haha Haha x 2
    • Agree Agree x 1
  14. Mr Latte

    Mr Latte

    Messages:
    1,245
    Ratings:
    +409
    Some nice creativity not looked or kept up much with this type of immersion.
    Maybe me just being me here, but does or can this be tailored to support more than one "channel"?

    For example, use telemetry values to have more "air force" on the outside and less on the inside to represent cornering or steering for lateral G?

    Would even a 3-way fan configuration be possible with like speakers producing L / C / R independent fan activity in relation to the telemetry?
     
  15. Insert Coin

    Insert Coin

    Messages:
    399
    Ratings:
    +141
    It is possible, by using more than one PWM channel on the Arduino. The program ACFan.cpp (made by mongo) sends the telemetry data to the Arduino. It should be changed so it would send a second telemetry parameter: the steering angle. There is some speed variation already built in:
    // See ACFan.cpp:
    // also added a bit of variance with steerAngle so that when you turn in you get a little less "wind"

    But in reality you cannot feel the change in wind speed when you are steering: this is due to the fact it takes time for the fan to spin down and spin up. I would recommend two smaller fans at the sides which spin up and down faster.
    Unfortunately I'm not a C-programmer so I cannot change the ACFan program, I only programmed the Arduino which translates the ACFan value into a PWM signal. Maybe someone with knowledge of the C programming language can help?
     
  16. Mr Latte

    Mr Latte

    Messages:
    1,245
    Ratings:
    +409
    Thanks for reply, I was just wondering how far people may have been experimenting with this or if more than just a static but directional speed based airflow was possible.

    I guess having someone stand in front of the user with two hairdryers, manually switching between flow speeds for the left/right units and rotating them to represent the cars steering angle, might be then the easiest way to trial more than one channel. :)

    Just an idea but could say servo motors be used for rotating a vane to control/direction of airflow holes? In an attempt to deflect or help then generate directional flow control?

    Plenty of fan/heaters have rotating bodies, curious if someone someday attempts to have direction steering be translated to rotating fans supports or vanes in front of them to alter the airflow sensation.

    I like the concept but think in the current form its got more potential.
    Neat idea with the straws though

    Found these that could be stacked together.
    Perforated Materials Plastic

    Alu and steel also available in many forms
     
    Last edited: Jan 29, 2018
  17. Insert Coin

    Insert Coin

    Messages:
    399
    Ratings:
    +141
    A rotating vane would direct the wind away from you, that's the opposite of what you are trying to achieve.
    Thanks for the suggestion of the perforated materials, but they block almost 50% of the airflow. You need very thin material, that's why I am using straws.
     
  18. Mr Latte

    Mr Latte

    Messages:
    1,245
    Ratings:
    +409
    You make a good point but thats the idea to have one side with more flow to the other on cornering..
    Testing/experimenting is going to determine how well such may or not work.

    Now where are my daughter's hairdryers.... :)

    What about these?
    https://www.ebay.co.uk/i/1510379497...9045180&device=c&campaignid=1029939270&crdt=0
     
  19. Insert Coin

    Insert Coin

    Messages:
    399
    Ratings:
    +141
    Nothing beats cheap straws :)
     
    • Haha Haha x 1
  20. Ceolmor

    Ceolmor
    Premium

    Messages:
    144
    Ratings:
    +50
    I also have two Thermalright TY 143 140 mm fans, one placed either side of my wheel, held in place by heavy duty velcro, but controlled by a board from Symprojects, based in Cambridge, UK. https://www.symprojects.com/categor...her-controllers-fan-controller/fan-controller. This can take up to 4 fans. Together with the SimDash software, it works in most racing sims, and you can adjust the min and max of the fan speed to different cars, with saved profiles. I am currently using in Assetto Corsa, DiRT Rally and Project Cars 2.

    As with Insert Coin's system, great for adding a bit of immersion (although I am rarely very aware of the fan when racing) and, more importantly, keeping you cool.

    I like the idea of the straws (although not sure about the colour).

    @Mr Latte my friend, I'm not convinced there is a need for directional flow control. In an open wheel car, the main air stream will be coming from the front of the car, which is always directly in front of the driver. In a closed cockpit car, the airflow will be coming from the vents, which will also always be in the same position, usually in front of the driver.
     
    • Like Like x 2