Announcement

Collapse
No announcement yet.

uvga + 4d visi + arduino + car sensor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • uvga + 4d visi + arduino + car sensor

    hi all,

    my project is to recover signal car sensor.

    i have try with just an arduino with the library tv-out

    here is vids of tv-out turbo sensor: http://[video=youtube_share;Ogh7Wmlz...?v=Ogh7Wmlzn8I[/video]

    but quality is bad...

    now i have buy here an uvga, and i want to program it with arduino.

    i have seen in software 4d visi the coolgauge.

    so my question is can I program the uvga in 4dvisi and recover the data* about the arduino sending?

    * the data is in numÃric (in the arduino, i recover a signal, and i calcul it for have numeric value)

    thanks

    ps: sorry i'm french, and my english mutn't be good, if probleme for comprehension, signal me!

  • #2


    There is no reason why not - what data are you sending to it?

    What is the arduino connected to to get the data?

    Comment


    • #3


      You should have no problem sending the data serially from Arduino to uVGA.

      The format you send it in needs to be 'optimised' to what the display handles best, eg integer only (you get it back to 'float' using an assumed decimal point, eg 10 can be automatically displayed as 1.0)

      Seerch these forums for serin and you should find a few examples.
      Mark

      Comment


      • #4


        i use an arduino mega 2560

        the data are numÃric value with decimal point

        for example:

        the boost sensor on the car, i connected the signal to the analog 3 on the arduino, the signal is an 0v 5v linear, in the arduino i make a calcul to transfomr it on pression value for example for 3v i get 1.7 bar.

        also i have think to send the value with a serial.print to the uvga, can i connect the tx arduino to the rx uvga to do that?

        Comment


        • #5


          Yep
          Mark

          Comment


          • #6


            i test this code:

            HTML Code:
            #platform "uVGA-II_GFX2"
            
            // Program Skeleton 1.0 generated 15/08/2012 18:08:54
            
            #inherit "4DGL_16bitColours.fnc"
            
            #inherit "VisualConst.inc"
            
            #inherit "NoName2Const.inc"
            
            func main()
                var frame;
                frame := serin1();
                  gfx_Cls();
                txt_Set(FONT_SIZE, FONT2);
                txt_Set(TEXT_OPACITY, OPAQUE);
                putstr("test turbo");
                pause(5000);
                gfx_Cls();
                // Coolgauge1 1.0 generated 15/08/2012 18:15:24
                img_SetWord(hndl, iCoolgauge1, IMAGE_INDEX, frame) ; // where frame is 0 to 3 (for a displayed -1 to -1)
                img_Show(hndl,iCoolgauge1) ;
                hndl := file_LoadImageControl("NoName2.dat", "NoName2.gci", 1);
            
            
                repeat
                forever
            endfunc
            i see the text on the first and after the clear screen i have a black screen, i don't see the "cool gauge".

            what is the problem?

            thanks

            Comment


            • #7


              are you sending a 1 2 3 as a character from the arduino or the ascii 1 etc see asciitable.com

              if you are send 1 (as you type it) its ascci character 49 - so take away 48 from your frame and you should see what you want

              Comment


              • #8


                i send decimal value

                Comment


                • #9


                  how, with "1" type command - show me some code

                  Comment


                  • #10


                    code arduino:

                    HTML Code:
                     int regime=15; //capteur rÃgime
                     int capteurT=3; // capteur pression turbo connectà broche 3
                     float turbo=0; //variable de type int pour stocker la mesure
                     float pression=0; //variable pour stocker le mesure calculÃe
                     float rpm=0; //variable pour stocker la mesure 
                     float calcrpm=0; //variable pour stocker la mesure calculÃ
                     unsigned int ancien_turbo=3;
                     unsigned int ancien_regime=15;
                    
                    void setup();
                    void loop()
                    {
                       
                      rpm = analogRead(regime); // lit le signal du rÃgime
                      turbo = analogRead(capteurT); //lit la valeur de la tension
                      pression = ((turbo/210)/1.9); //convertit la tension en valeur de pression
                      calcrpm = (rpm/210); // convertit le signal en valeur "rpm"
                      
                      unsigned int new_turbo = analogRead(3);
                      unsigned int new_regime = analogRead(15);
                      
                      if(new_turbo != ancien_turbo)
                      {
                      Serial.print(pression);
                      ancien_turbo = new_turbo;
                      } 
                      
                      if(new_regime != ancien_regime)
                      {
                     Serial.print(calcrpm);
                      ancien_regime = new_regime;
                      }
                      
                    }

                    Comment


                    • #11


                      i don't use ascii

                      Comment


                      • #12


                        A rethink is needed

                        You cant use floats in 4dgl

                        if I use the following on my mega i get 2.57 and 4.88

                        PS looks like you didn't start your com port in setup

                        From the ASCII table example

                        // prints value as string as an ASCII-encoded decimal (base 10).
                        // Decimal is the default format for Serial.print() and Serial.println(),
                        // so no modifier is needed:
                        Serial.print(thisByte);

                        HTML Code:
                        int regime=15; //capteur ré
                        int capteurT=3; // capteur pression turbo connecté broche 3 
                        float turbo=0; //variable de type int pour stocker la mesure 
                        float pression=0; //variable pour stocker le mesure calculée 
                        float rpm=0; //variable pour stocker la mesure  
                        float calcrpm=0; //variable pour stocker la mesure calculé 
                        unsigned int ancien_turbo=3;
                        unsigned int ancien_regime=15;
                        void setup(){
                        Serial.begin(9600);
                        }
                        void loop(){
                        rpm = 1024; //analogRead(regime); // lit le signal du régime  
                        turbo = 1024; //analogRead(capteurT); //lit la valeur de la tension 
                        pression = ((turbo/210)/1.9); //convertit la tension en valeur de pression  
                        calcrpm = (rpm/210); // convertit le signal en valeur "rpm"    
                        unsigned int new_turbo = analogRead(3);
                        unsigned int new_regime = analogRead(15);
                        //if(new_turbo != ancien_turbo) { 
                        Serial.println(pression);
                        ancien_turbo = new_turbo;
                        //} 
                        if(new_regime != ancien_regime) 
                        {
                        Serial.println(calcrpm);
                        ancien_regime = new_regime;
                        }
                        }

                        Comment


                        • #13


                          Code posting is up the ! at the minute ?

                          how many values are on the gauge - you can try it by starting the serial terminal in workshop and send HEX 01 or 02 etc


                          this will send an ASCII 1 not the character 1

                          Comment


                          • #14


                            ok thanks for you help

                            i will try tomorrow, here is 11 PM

                            i will say you later if the code works.

                            thanks

                            Comment


                            • #15


                              it's doesn't work, i can't see the gauge on the screen, i just see a black screen.

                              Comment

                              Working...
                              X