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

rFactor tach + Math Setup question

Discussion in 'New users start here - FAQ' started by Panici, Dec 13, 2011.

  1. Panici

    Panici New Member

    Joined:
    Dec 4, 2011
    Messages:
    4
    Occupation:
    Second Year Electrical Engineering Studnet
    Location:
    Ontario, Canada
    Balance:
    244Coins
    Ratings:
    +0 / 0 / -0
    Hey guys.

    I've got rFactor, X Sim, and an Arduino Nano interfaced over serial.

    I'm using 8 bit binary output for now (0-255).

    My math plugin is just a Output 1:1
    How do I make the tach use the entire value? (which will effectively double my resolution) Right now it's only using half of the range. It's expecting negative values I think.



    Also, right now i'm having my Arduino do the math to calculate the RPM based on the (0-255) signal coming over the COM port. Is there a way to make the computer do the work and output a decimal value directly over serial?

    Thanks in advanced!
  2. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,400Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    ok i use decimal output mate plus slow the packet down i use 40 instead of 33.
    plus ya need to test how far the rpm is climbing and set ya max value in the maths plugin to 100 higher this needs to be done when car changes in rfactor basically write a profile for each car mod ya do.This is what i do. Codes in my posts on the arduino to see if its a code problem, but the above should fix it.
  3. Panici

    Panici New Member

    Joined:
    Dec 4, 2011
    Messages:
    4
    Occupation:
    Second Year Electrical Engineering Studnet
    Location:
    Ontario, Canada
    Balance:
    244Coins
    Ratings:
    +0 / 0 / -0
    Could you link me to your code?


    HOW can i make my math plugin use the whole axis?? I want the extra resoluton.

    Here is idle: It shows up as 127 on my arduino, and I want it to be a LOT closer to zero.
    [​IMG]


    Here is revlimit:
    [​IMG]




    Here's a youtube video of my progress thus far:

    http://www.youtube.com/watch?v=62Zsg3ZVhTE
  4. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,400Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
  5. Panici

    Panici New Member

    Joined:
    Dec 4, 2011
    Messages:
    4
    Occupation:
    Second Year Electrical Engineering Studnet
    Location:
    Ontario, Canada
    Balance:
    244Coins
    Ratings:
    +0 / 0 / -0
    The question still remains,
    HOW can i make my math plugin use the whole axis?? I want the extra resolution it will give me.



    Also, did you have issues with the amount of data sent over the serial connection? Right now i'm trying to send RPM, Speed, and gear position, and my display is beginning to lag.
    Suggestions for x-sim wait time & baud rate and/or internal Arduino delays to fix this?
  6. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,400Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    ok resolution is a problem mate ard works from 0 - 127 xsim works from 0 - 255. hence Value = Value/2*1+0 changeing it for the ard to work.
    Havent tried sending it differently it works nicely for with my current guages.

    But in turn what i do is go into the game fire xsim with sender, put the game and xsim into windows , rev the car flat out and note down what rev limit it had in xsim, then stop xsim and change the max value for rpm math calc to rpm noted from game plus another hundred, plus set min to 1 or 0. then retest in game on my rpm at idle no leds are on , steadly run through revs and end revs just light up before ya hit max revs, shit light is easier find ya rpm limit ya need for shift light aand set its math calc to max right on those revs, set code in ard to only turn shift light on when max is reached.

    Havent had time to finish updating my post. All will be explained i have rpm(10 leds) plus 2 shift lights plus 3 digit speed o plus gear counter, water and oil overheat leds and finally a 2x16 lcd for other stuff lap times ,etc

    Right timming issues yes ya have to fiddle a bit, i used a port capture too see what xsim was send to the comport and notice as you added more varibles the port seem to lag, so changing the datapacket speed work to keep the flow going, then noticed the ard was waiting too long and started to miss values and cause a display lag, all because im only using simply delays in code to capture the information flowing in. So I changes the delays in reading to speed it up, 1ms waits seem to work for me with a 40ms delay on xsim sight.
  7. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,400Coins
    Ratings:
    +1,683 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    ok resolution is a problem mate ard works from 0 - 127 xsim works from 0 - 255. hence Value = Value/2*1+0 changeing it for the ard to work.
    Havent tried sending it differently it works nicely for with my current guages.

    But in turn what i do is go into the game fire xsim with sender, put the game and xsim into windows , rev the car flat out and note down what rev limit it had in xsim, then stop xsim and change the max value for rpm math calc to rpm noted from game plus another hundred, plus set min to 1 or 0. then retest in game on my rpm at idle no leds are on , steadly run through revs and end revs just light up before ya hit max revs, shit light is easier find ya rpm limit ya need for shift light aand set its math calc to max right on those revs, set code in ard to only turn shift light on when max is reached.

    Havent had time to finish updating my post. All will be explained i have rpm(10 leds) plus 2 shift lights plus 3 digit speed o plus gear counter, water and oil overheat leds and finally a 2x16 lcd for other stuff lap times ,etc

    Right timming issues yes ya have to fiddle a bit, i used a port capture too see what xsim was send to the comport and notice as you added more varibles the port seem to lag, so changing the datapacket speed work to keep the flow going, then noticed the ard was waiting too long and started to miss values and cause a display lag, all because im only using simply delays in code to capture the information flowing in. So I changes the delays in reading to speed it up, 1ms waits seem to work for me with a 40ms delay on xsim sight.