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

Arduino Dashboard - Almost Complete.

Discussion in 'SimTools compatible interfaces' started by eaorobbie, Jul 18, 2011.

  1. 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
    We after alot of reading and looking around i decided i wanted a dashboard for my sim. Hmmm they are not cheap, wonder what else i can find out there?.
    Well the Arduino Uno looks promising at only $40 for the microcontroller and a couple of buks for some leds.
    A simple circuit was born.
    [img600px]http://www.x-simulator.de/forum/gallery/image.php?album_id=92&image_id=397[/img600px]

    [img600px]http://www.x-simulator.de/forum/gallery/image.php?album_id=92&image_id=398[/img600px]
    eXpanDASHV1-pcb layout (PCB).pdf
    Arduino Code - eXpanDASH V1 - RPM.txt
    Working Vid showing wiring only using 3 pins. plus 5v and Gnd
    http://www.youtube.com/watch?v=Ep0aGIdxNbs

    Right then X - Sim side. Ok little more to it but it worked eventually and i can adjust the value where the last led lights on, so i can use this later to hook acouple of flashing (bright) LEDS to incicate the shift point, tried it with all my x-sim compatable games and yes all go. Just had to adjust the setting in x sim to gain full use of lights ie v8supercars need a rpm max of 8500 , TCL's Max was 6550, and so on.

    Right that made me pretty happy but I really would love a gear indicator too. Hmmm, everyone else uses a 7 Seg Display, ok time to make a circuit to test first before combining it all into one. :uups: oops done that and added some shift lights too.

    [img600px]http://www.x-simulator.de/forum/gallery/image.php?album_id=92&image_id=399[/img600px]
    gallery/image.php?album_id=92&image_id=399
    (X - Sim Values)
    • Like Like x 1
  2. Mexwall

    Mexwall New Member

    Joined:
    Jun 5, 2009
    Messages:
    22
    Location:
    Netherlands
    Balance:
    345Coins
    Ratings:
    +0 / 0 / -0
    Re: Arduino Dashboard - WIP

    Any pictures or video's of your project?
  3. 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
    Re: Arduino Dashboard - WIP

    sorry mate only a couple had to put project down to finish something more important.

    http://www.youtube.com/watch?v=OrAQlqbQEZg

    [​IMG]

    When time comes back to me will update post fully.
    • Like Like x 1
  4. RaceRay

    RaceRay Administrator Staff Member SimAxe Beta Tester

    Joined:
    Nov 8, 2006
    Messages:
    4,656
    Occupation:
    Self-employed | Web and application development
    Location:
    Hamburg, Germany
    Balance:
    23,839Coins
    Ratings:
    +1,968 / 13 / -0
    My Motion Simulator:
    2DOF, DC motor, SimAxe, SimforceGT
    Re: Arduino Dashboard - WIP

    Thanks for your project.
    Would you publish here the sourcecode for flashing the Arduino?
    Maybe some is willing to help to continue the developing process
  5. RaceRay

    RaceRay Administrator Staff Member SimAxe Beta Tester

    Joined:
    Nov 8, 2006
    Messages:
    4,656
    Occupation:
    Self-employed | Web and application development
    Location:
    Hamburg, Germany
    Balance:
    23,839Coins
    Ratings:
    +1,968 / 13 / -0
    My Motion Simulator:
    2DOF, DC motor, SimAxe, SimforceGT
    Re: Arduino Dashboard - WIP

    Nice, thank you very much :)
  6. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    Hey there!

    Great job done here so far. I have an Arduino Uno myself and use the same principles as you do except I do not use X-Sim.
    I use rfactor-python scripting. My Led project includes a 7 segment display as well and that is hooked to Arduino also.
    I am not too happy with the way the LEDS functions at the moment hence this post.
    What I really need to know is how you set up X-Sim to push the data to the Arduino. I am really having problems trying to figure that out at the moment. I would appreciate it if you could maybe post some pics on your configuration of X-Sim. If you need some code regarding the 7 Seg part I will post all my code here if you want it. I suppose I could post some pics as well. Will do that later this evening.
    Cheers :clap: :D
  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
    Re: Arduino Dashboard - WIP

    ok rpm is easy one. 7 seg gets harder, all depends on ya wiring back to the shift register74hc595. Just set up a axis using gear and insert a serial.println in code and spy on the arduino with x sim connected to find the values x - sim is sending and once you capture there values insert them into you code.
  8. 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
    Re: Arduino Dashboard - WIP

    My std code for 7 seg - 6 speed with n and r.

    not im using a blue 7 seg a little different on oin out than the red.
    [​IMG]
  9. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    This code works with my setup using rfactorpython
    it can be found here: http://b.joaoubaldo.com/?p=154


    const int SER = 11;
    const int SCLK = 8;
    const int SRCLK = 12;

    unsigned long beep_start = 0;
    int gear = 0;
    int rpm = 0;
    byte int_to_7seg(int value) {
    const byte N1 = B00000110;
    const byte N2 = B01011011;
    const byte N3 = B01001111;
    const byte N4 = B01100110;
    const byte N5 = B01101101;
    const byte N6 = B01111101;
    const byte N7 = B00000111;
    const byte N8 = B01111111;
    const byte N9 = B01100111;
    const byte N0 = B00111111;
    const byte WITH_DOT = B10000000;

    switch(value) {
    case 0:
    return N0;
    case 1:
    return N1;
    case 2:
    return N2;
    case 3:
    return N3;
    case 4:
    return N4;
    case 5:
    return N5;
    case 6:
    return N6;
    case 7:
    return N7;
    case 8:
    return N8;
    case 9:
    return N9;
    default:
    return -1;
    }
    }
    byte int_to_rpm_led(int value) {
    byte b = 0;
    for (int i=0; i < value; i++) {
    b = b << 1 | 1;
    } return b;
    }

    void setup() {
    pinMode(SER, OUTPUT);
    pinMode(SCLK, OUTPUT);
    pinMode(SRCLK, OUTPUT);
    Serial.begin(9600);
    // checkup
    for (int j=0; j < 3; j++) {
    for (int i = 0; i < 9; i++ ) {
    digitalWrite(SCLK, LOW);
    shiftOut(SER, SRCLK, MSBFIRST, int_to_7seg(i));
    shiftOut(SER, SRCLK, MSBFIRST, int_to_rpm_led(i));
    digitalWrite(SCLK, HIGH);
    delay(50);
    }
    }

    digitalWrite(SCLK, LOW);
    shiftOut(SER, SRCLK, MSBFIRST, 0x00);
    shiftOut(SER, SRCLK, MSBFIRST, 0x00);
    digitalWrite(SCLK, HIGH);
    }

    void loop() {
    byte v = 0;

    while (Serial.available()) {
    v = Serial.read();
    int new_gear = v >> 4;
    int new_rpm = (v << 4 & 0xFF) >> 4;
    if (new_gear != gear || new_rpm != rpm) {
    digitalWrite(SCLK, LOW);
    shiftOut(SER, SRCLK, MSBFIRST, int_to_7seg(new_gear));
    shiftOut(SER, SRCLK, MSBFIRST, int_to_rpm_led(new_rpm));
    digitalWrite(SCLK, HIGH);
    }
    gear = new_gear;
    rpm = new_rpm;

    }
    delay(20);
    }
  10. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    Only problem I am having is setting up X - Sim correctly
    I have no clue what to do. My brain is fried at the moment
    I am able to see the values change in X-Sim once in rFactor.
    3 screens is a bonus ;D
    unfortunately nothing happens on my LEDs or 7 Seg
    not sure where I am doing wrong here.
  11. 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
    Re: Arduino Dashboard - WIP

    yea couldnt get that one to work correctly and no support for rfactorpython.
    So used it as a base then wrote new code to run in xsim and from vids i have seen for python, xsim does it better (faster response) but python plugin has the potential to provide alot more data to the arduino than xsim can.
  12. 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
    Re: Arduino Dashboard - WIP

    with python code running in arduino wont work mate been there. Have to write new code and set xsim up right. Will try to post combo code plus xsim setup to run a combined rpm and gear, have to test mine a bit to be sure i can successfully show someone else. Sorry for a delay. But if ya flash the rpm code to your card, just check the pin are the same value ie data,clock pins. Then set an axis to rpm and max of 8500 min 0 overwrite
    then uso output is 8bit decimal. Send packet R~a01~ and the rpm leds should come alive same for gear but with send packet change the R to a G. And axis for gear is 6 to -1. But if adventurious combine the two and the whole board should come alive. Sorry not a complete tutorial, still writting another one this goes onto the bottom of the list to complete.
  13. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    Brilliant I could almost love you :) I know that the code is used for rfactorpyrhon and that it will not work with X-Sim. I have more ammunition to play with tonight so I will set X-Sim up axxordingly and hope for the best. The code you put here I use with X-Sim only problem I had was the setup of X-Sim. Now I will be able to use your advice and see if all works. If it does expect a post with some pics and maybe a video. Thanks mate.
  14. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    This is my combined code of the RPM and GEAR you wrote

    int Rpm
    int RpmLight = 0;
    int Gear;
    int GearLight = 0;


    char kind_of_data;

    int latchpin = 8;
    int clockpin = 12;
    int datapin = 11;


    void setup(){

    pinMode(latchpin, OUTPUT);
    pinMode(clockpin, OUTPUT);
    pinMode(datapin, OUTPUT);

    Serial.begin(9600);
    }

    void loop(){
    //****************************** READ DATA FROM SERIAL ******************************
    while (Serial.available() > 0)
    {

    kind_of_data = Serial.read();
    if (kind_of_data == 'R' ) Read_Rpm();
    if (kind_of_data == 'G' ) Read_Gear();


    digitalWrite(latchpin, LOW);
    shiftOut(datapin, clockpin, MSBFIRST, RpmLight);
    shiftOut(datapin, clockpin, MSBFIRST, GearLight);
    digitalWrite(latchpin, HIGH);
    }
    }


    //****************************** READ DATA FROM SERIAL END ******************************


    void Read_Rpm(){

    int Rpm = 0;
    delay(2);
    int Rpm100 = Serial.read();
    delay(2);
    int Rpm10 = Serial.read();
    delay(2);
    int Rpm1= Serial.read();

    Rpm100 = ((Rpm100)-48)*100;
    Rpm10 = ((Rpm10)-48)*10;
    Rpm1 = ((Rpm1)-48)*1;
    if (Rpm10 < 0 && Rpm1 < 0){Rpm100 = Rpm100/100;Rpm10 = 0;Rpm1 = 0;}
    if (Rpm1 < 0){Rpm100 = Rpm100/10;Rpm10 = Rpm10/10;Rpm1 = 0;}

    Rpm = Rpm100+Rpm10+Rpm1;


    if (Rpm > 108) { RpmLight = 0;}
    if (Rpm > 0 && Rpm <= 16){ RpmLight = 255;}
    if (Rpm > 16 && Rpm <= 32){ RpmLight = 254;}
    if (Rpm > 32 && Rpm <= 48){ RpmLight = 252;}
    if (Rpm > 48 && Rpm <= 54){ RpmLight = 248;}
    if (Rpm > 54 && Rpm <= 60){ RpmLight = 240;}
    if (Rpm > 60 && Rpm <= 76) { RpmLight = 224;}
    if (Rpm > 76 && Rpm <= 92) { RpmLight = 192;}
    if (Rpm > 92 && Rpm <= 108) { RpmLight = 128;}
    }
    void Read_Gear(){

    //int Gear = 0;
    delay(2);
    int Gear100 = Serial.read();
    delay(2);
    int Gear10 = Serial.read();
    delay(2);
    int Gear1= Serial.read();

    Gear100 = ((Gear100)-48)*100;
    Gear10 = ((Gear10)-48)*10;
    Gear1 = ((Gear1)-48)*1;
    if (Gear10 < 0 && Gear1 < 0){Gear100 = Gear100/100;Gear10 = 0;Gear1 = 0;}
    if (Gear < 0){Gear100 = Gear100/10;Gear10 = Gear10/10;Gear1 = 0;}

    Gear = Gear100+Gear10+Gear1;
    Serial.println(Gear);

    if (Gear < 127) {
    GearLight = 80;
    } //r - little r
    if (Gear == 127) {
    GearLight = 84;
    } //n - little n
    if (Gear == 149) {
    GearLight = 6;
    } //1
    if (Gear == 170) {
    GearLight = 91;
    } //2
    if (Gear == 191) {
    GearLight = 79;
    } //3
    if (Gear == 213) {
    GearLight = 102;
    } // 4
    if (Gear == 234) {
    GearLight = 109;
    }// 5
    if (Gear == 255) {
    GearLight = 124;
    }// 6

    }
  15. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    It does not work tho
  16. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    This is my circuit except I am substituting the greed LEDS for the 7 seg

    Attached Files:

  17. 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
    Re: Arduino Dashboard - WIP

    not sure what ya done. pic of circuit would help.
    i moved on lcd up and running

    http://www.youtube.com/watch?v=pNMBMVO53a4
  18. 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
    Re: Arduino Dashboard - WIP

    only thing i can see is the cap tying latch pin to gnd i dont use it. what is it for?
  19. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    Dont use the cap either on my board as for cicuit will need to make one up still. I basically copied the above one and substituted the leds for 7 seg. The pinouts of the 7 seg are easy to configure if you have a datasheet of a 7 seg.
  20. AlexOki

    AlexOki New Member

    Joined:
    Jul 20, 2011
    Messages:
    20
    Balance:
    66Coins
    Ratings:
    +1 / 0 / -0
    Re: Arduino Dashboard - WIP

    here is the circuit which I based everything on so far altho there is a fault on it the leds are incorrectly wired or named. The circuit does not work either but the wiring of the outputs to 7 seg are correct and combined with the previous attachment I built my board.

    Attached Files: