Page 3 of 7 FirstFirst 12345 ... LastLast
Results 21 to 30 of 67

Thread: How to import data from wifi into arduino?

  1. #21
    Superkart Pilot memoric77's Avatar
    Join Date
    May 2015
    Location
    Bochum, Germany
    Posts
    151
    Platform
    PC
    Quote Originally Posted by cyclicscooby View Post
    Thankyou Memoric..

    Yes, Its just the ESP, plugged into an FTDI cable, but I did have it 'bodged' into the Arduino successfully for a week (as in, bypassing the UNO and just hijacking its USB to Serial Port to code the ESP - UNO loaded with empty sketch, and code complied as ESP, NOT UNO, so UNO ignores upload)
    NOTE..... You're not supposed to do this, because the ESP is 3v3 ONLY, on TxRx and the UNO 3v output isnt supposed to be powerful enuf to power the ESP.... BUT, it worked for me, for a week, until my FTDI cable and some 3v regulators arrived...

    Mines on Breadboard, with flyleads..

    Vcc to a 3v3 Regulator,
    Gnd to Gnd (and the FDTI Gnd to same GND) - OR UNO Gnd and 3v3, if you use it that way
    ESP Tx to FDTI Rx
    ESP Rx to FDTI Tx
    NOTE - 'IF' you connect it via an UNO, Tx goes to Tx, Rx to Rx. The UNO appears to be marked with what to 'plug in', NOT what it is..!!

    Then, CH_PD, RST, and GPIO2 each get pinned to Vcc via a 3k3 pullup resistor.

    GPIO 0 is left floating (plugged into nothing) if turning on to run..

    If you want to code the ESP, you just plug GPIO 0 to GND, BEFORE you power up the ESP, and leave it there until you're finished..


    I've found you have to be quick pressing upload (within 3-5secs) after booting up, otherwise it's be off looking for Wifi.. and you'll get

    'ESPCOMM not responding'

    If it does, just power off, power on, try again..


    Regarding Serial out to another MCU. Thats exactly what i'm looking into now..

    As soon as I find a good (easy) way, i'll get back to you...


    Luv
    Chrisie.. xx
    Do you know, if a teensy 2.0 or 3.2 act as a HID Device like the leonardo do? can you programm it with the Arduino IDE with all the librarys and code structure? the teensy should power the esp with 3.3 v directly, the leonardo cant do this directly. otherwise take 5v from arduino or usb and regulate it to 3.3v with a simple regulator, isnt it?
    Put the pedal to the metal
    PSN ID: memoric77 | http://www.virtualracing.org/
    PS4 | SAMSUNG 55" UE55F6500 | Playseat Challenge + DIY Bodyshaker, ButtonboxV3 |
    FANATEC CSP V2 + CSP V2 PEDAL + TM TH8A SHIFTER https://youtu.be/lupNXmrUchc
    The following user likes this Post: GForce


  2. #22
    Kart Driver
    Join Date
    Feb 2016
    Location
    ERR404
    Posts
    77
    Platform
    PS4
    The Telemetry data doesn't stop, even when in menu's, and yoo dont need to send it then..

    GameStateFlag near the top is useful tho..

    =0 on main menu and loading screen
    (no PartInfo packets)

    In race
    =9 on start grid (thr active)
    =10 when lights go green
    =2 for race

    In Practice
    =9 as PitBox screen loads, and participantInfo starts streaming
    Note - thr / str / etc not active (i.e pressing the throttle shows ZERO in unfilteredthrottle)

    Press 'Drive'
    Flag is STILL 9, before crossing start line, BUT throttle, etc now ACTIVE
    Cross start line, Flag = 2


    I also changed the unfilteredSteering 'char' to a byte in the data_struct..

    Thr/Brk/Clutch = 0-255
    Steering = 129-255->0->1-127 (Centre = 0, Left 129max-255min, Right 01min-127max - NO 128 value..


    Deffo off to bed now...

    Luv
    Chrisie..
    The following user likes this Post: GForce


  3. #23
    Kart Driver
    Join Date
    Feb 2016
    Location
    ERR404
    Posts
    77
    Platform
    PS4
    Hi

    A Teensy (ive got 3.1, But 3.2 same) is a 3v3 device, but is 5v tolerant on input.. Power in is 5v.. (outputs are 3v3, NOT 5.. But so is ESP )

    Totally HID compatable as any HID device...

    I dont know if it'll power the ESP directly, as it only gives out 100mA's from the 3v3, but you only need a regulator..

    Personally, I always use an external PSU and usually cut the USB power line.
    I'm currently using an old PlayStation2 8.5v PSU thru 5v regs to my various breadboards, spread all over..
    The 3v3 reg is taking power from the 5v reg, and all grounded together (inc USB / FTDI)


    You need to install the Teensy drivers, but YES, you can code it in Arduino IDE, exactly the same as UNO etc.. When you upload, it opens up a seperate app called TeensyDuino which uploads the code in the background, no extra buttons to press..
    Its a 90Mhz ARM Cortex M3, with loads more memory than an UNO.. Never had any problems with them, and ive had about 5...

    (Unlike the Particle Photon, which is good when online, but RUBBISH to code offline... Shame too, as it's a powerful, cheap Wifi option)


    You can use ALL the standard libraries, but on the Teensy site, there are loads of Libs that have been modified to take full effect of the Teensys abilities (i.e. better)..


    Luv
    Chrisie...
    Last edited by cyclicscooby; 14-02-2016 at 02:33.
    The following user likes this Post: GForce


  4. #24
    Superkart Pilot GForce's Avatar
    Join Date
    Jun 2015
    Location
    @Home :-)
    Posts
    552
    Platform
    PS4
    Guys,

    I'm still waiting for my ESPs to come down the way from china, but what you guys did here is awesome!

    I'm looking forward to join this "party" here as soon as I have my hardware ready!

    Great stuff, really great stuff!

    Cu
    GForce
    PCars on PS4 with G29 Wheel, G27 Shifter and a DIY Bluetooth Botton Box on a Playseat Evo Top Gear edition

    Playseat Challenge for Sale - Shipping within Germany, France, Switzerland possible -> PM me if interested!

  5. #25
    Superkart Pilot memoric77's Avatar
    Join Date
    May 2015
    Location
    Bochum, Germany
    Posts
    151
    Platform
    PC
    Hey Chrisie,

    I am sorry, but at the moment I am out of time. Cant test it. Hope to get time in a few days, maybe a midnight session at the weekend .
    Put the pedal to the metal
    PSN ID: memoric77 | http://www.virtualracing.org/
    PS4 | SAMSUNG 55" UE55F6500 | Playseat Challenge + DIY Bodyshaker, ButtonboxV3 |
    FANATEC CSP V2 + CSP V2 PEDAL + TM TH8A SHIFTER https://youtu.be/lupNXmrUchc

  6. #26
    Kart Driver
    Join Date
    Feb 2016
    Location
    ERR404
    Posts
    77
    Platform
    PS4
    Hi Memoric..

    Me too.. Boring Work getting in the way of fun Arduino...

    I have been reading and thinking while at work tho.. Gonna try something now, and get back to you..


    How you doing Gforce.. Got it yet..?? Are you UK.?
    I use CoolComponents for most of my stuff. Usually arrives within 36-48 hrs, regardless of when you order.
    PS - They do the Polulo A-Star clones. Its essentially a mini UNO, but with one or two MORE pins available.. Tiny and Ł10..!! Had loads, and never a problem..
    That or, if you need/want an Arduino 'Turbo', the Teensy, for Ł20..


    Luv
    Chrisie.. xx

  7. #27
    Superkart Pilot
    Join Date
    May 2015
    Location
    Sydney, NSW
    Posts
    391
    Platform
    PS4
    I've been working on this as a side project from the VBOX for the last few months.

    Damn Chrisie, Thats some really great work you have done there.

    I will give it crack myself on Monday when I'm back in the office and see how I go.

    My parts finally arrived on Monday and I'm still trying to get the ESP2866 Shield to work with a Leonardo.
    Last edited by rotorrian; 19-02-2016 at 13:37.

  8. #28
    Kart Driver
    Join Date
    Feb 2016
    Location
    ERR404
    Posts
    77
    Platform
    PS4
    Hi Guys..

    News so far...


    I've successfully transfered the entire packets serially, both PartInfo, and Telemetry, broken them down, and serially displayed some of the received values on the Teensy, BUT...

    The latency is horrific (even at 115200)... Gone from many values a second, to 2-3.. !! Nowhere near good enough for smooth output....

    So... I cut the data_struct down to just what I need, so removed weather, and such like.. That alone will help with latency, but i've gone further..

    I've split the data down to 'Type'.. Dashboard, Suspension, PartInfo & Motion.. (Suspension for a 2/3 DOF motion seat, Motion for a 6 DOF mkII seat.. )

    Ive then split each 'Type' into even smaller packets, depending on how often I need that data
    (i.e. RPM & Speed - Every packet, fuel level - every 10th packet, MaxRPM = Once)


    Each smaller packet has a 2 byte 'packetType' at the beginning, for the Teensy to know whats coming..

    Basically.. The First byte(converted to a char on Teensy) is 'Type' -
    'D' = Dash
    'P' = PartInfo
    'S' = Suspension
    'M' = Motion

    The next byte denoted how often it's required.. (examples below are for Dash)

    '0' = At Startup ONLY - MaxRPM, FuelCapacity, and a few others.. Data to give min/max values..
    '1' = Every Packet - RPM, Speed, GameState, CurrentLapTime, etc
    '2' = 1 in 5/10/20 packets. Oil press, fuel level, odometer, etc. (5/10/20 Depends on speed when finished )
    '3' = 1 in 50/100 packets. Best/Last Laptimes, etc

    '9' = OnChange - Only send if something changes - CrashState, JoyPad, DPad, etc...

    So, D1, S1, and M1 will go every time. P0 & D0 ONLY at the start of a race/drive..


    The serial packet sizes have reduced from 1367/1347, to 29 for D1, 82 for S1, and 110 for M1... 221 in total.

    The Suspension and Motion data isnt required just yet (my rig is still static), so can be ignored for now and added as required later...


    I've only done the definitions bit so far, as a separate .h

    Please forgive me if something is not correct (packet sizes, byte start positions).. It compiles, but hasn't been fully run thru yet..


    Luv
    Chrisie..

  9. #29
    Kart Driver
    Join Date
    Feb 2016
    Location
    ERR404
    Posts
    77
    Platform
    PS4
    Data_Struct_cut.h


    Code:
    // Project Cars UDP data structure Cut down to required data = 339bytes(was 1367)
    
    /*
     
    Copied from forum.projectcarsgame.com/thread 40113 
    "How to Companion App UDP stream"
    
    
    */
    // struct sParticipantInfoStrings
    unsigned int PartInfo = 1347; // Is PartInfo packet
    byte  ParticipantInfoPacketNum ;   // 2
    char  CarName[64];                 // 3
    char  CarClassName[64];            // 67
    char  TrackLocation[64];           // 131
    char  TrackVariation[64];          // 195
    // 257
    
    
    //struct sTelemetryData
    unsigned int Telemetry = 1367;    // Is a Telemetry packet
    byte TelemetryPacketNum;         // 2    - 2
      
    // Game states
    byte GameSessionState;            // 3    - 3
    
    // Unfiltered input
    byte UnfilteredThrottle;          // 6    - 4
    byte UnfilteredBrake;             // 7    - 5
    byte UnfilteredSteering;          // 8    - 6
    byte UnfilteredClutch;            // 9    - 7
    byte RaceStateFlags;              // 10   - 8
    
    // Event information
    byte LapsInEvent;                 // 11   - 9
    
    // Timings
    float BestLapTime;                // 12   - 10
    float LastLapTime;                // 16   - 14
    float CurrentTime;                // 20   - 18
    
    float PersonalFastestLapTime;     // 40   - 22
    
    unsigned int JoyPad;              // 96   - 26
    
    // Flags
    byte HighestFlag;                 // 98   - 28
    
    // Pit info
    byte PitModeSchedule;             // 99   - 29
    
    // Car state
    int OilTempCelsius;               // 100  - 30
    unsigned int OilPressureKPa;      // 102  - 32
    int WaterTempCelsius;             // 104  - 34
    unsigned int WaterPressureKpa;    // 106  - 36
    unsigned int FuelPressureKpa;     // 108  - 38
    byte CarFlags;                    // 110  - 40
    byte FuelCapacity;                // 111  - 41
    byte Brake;                       // 112  - 42
    byte Throttle;                    // 113  - 43
    byte Clutch;                      // 114  - 44
    char Steering;                    // 115  - 45
    float FuelLevel;                  // 116  - 46
    float Speed;                      // 120  - 50
    unsigned int Rpm;                 // 124  - 54
    unsigned int MaxRpm;              // 126  - 56
    byte GearNumGears;                // 128  - 58
    byte BoostAmount;                 // 129  - 59
    char EnforcedPitStopLap;          // 130  - 60
    byte CrashState;                  // 131  - 61
    
    float OdometerKM;                 // 132  - 62
    float Orientation[3];             // 136  - 66
    float LocalVelocity[3];           // 148  - 78
    float WorldVelocity[3];           // 160  - 90
    float AngularVelocity[3];         // 172  - 102
    float LocalAcceleration[3];       // 184  - 114
    float WorldAcceleration[3];       // 196  - 126
    float ExtentsCentre[3];           // 208  - 138
    
    // Wheels / Tyres
    byte TyreFlags[4];                // 220  - 152
    byte Terrain[4];                  // 224  - 156
    float TyreY[4];                   // 228  - 160
    float TyreRPS[4];                 // 244  - 176
    float TyreSlipSpeed[4];           // 260  - 192
    
    byte TyreGrip[4];                 // 280  - 208
    
    float TyreHeightAboveGround[4];   // 284  - 212
    float TyreLateralStiffness[4];    // 300  - 228
    byte TyreWear[4];                 // 316  - 244
    byte BrakeDamage[4];              // 320  - 248
    byte SuspensionDamage[4];         // 324  - 252
    
    float WheelLocalPositionY[4];     // 376  - 256
    float RideHeight[4];              // 392  - 272
    float SuspensionTravel[4];        // 408  - 288
    float SuspensionVelocity[4];      // 424  - 304
    unsigned int AirPressure[4];      // 440  - 320
    
    // Extras
    float EngineSpeed;                // 448  - 328
    float EngineTorque;               // 452  - 332
    
    // Car damage
    byte AeroDamage;                  // 456  - 336
    byte EngineDamage;                // 457  - 337
    
    byte DPad;                        // 1366 - 338    
    // 339                                 
    //===============================================================

  10. #30
    Kart Driver
    Join Date
    Feb 2016
    Location
    ERR404
    Posts
    77
    Platform
    PS4
    In the // comment after each field. The first no. is the original data_struct start byte, the second no. is the output buffer byte...

    The Output buffer (the data to be sent over serial) is....

    Code:
    // Project Cars UDP data structure
    /*
    Output fields
    P1 & P2 = PartInfo - Sent ONLY once, at start of race.
    D1, D2, D3, D9, D0 = Dashboard - 1=Every Packet, 2= 1 in 5/10
                                     3= 1 in 50, 9=ChangeState, 0=Start only(P1,P2)
    S1 = Suspension Data - Sent EVERY packet
    
    M1,M2,MX, = Motion - XYZ data - 1=Every packet, 2= 1 in 5/10, 9=Change                                  
    
    */
    
    char packetType; // Used to Write Packet Type Out
    char packetIsPartInfo = 'P';
    char packetIsTelemetry = 'T';
    
    byte packetNum;          // Used to Write Packet Number Out
    byte packetnum0 = '0';   // Startup Packet - Only sent at start of Race
    byte packetnum1 = '1';   // Primary data stream. Sent Every packet
    byte packetnum2 = '2';   // Secondary stream. Sent 1 in 5/10 times
    byte packetnum3 = '3';   // 3rd stream. Sent 1 in 50/100 times
    byte packetnum9 = '9';   // Change - Sent on ChangeState
    
    
     
    //===============================
    // P0 - PartInfo_0  -  
    byte P0[194];
    //char  PartInfoP0;                  // 0   // 0 = 'P'
    //byte  PartInfoP0Num                // 1   // 1 = '1'
    //char  CarName[64];                 // 2   // 3
    //char  CarClassName[64];            // 66  // 67
    //char  TrackLocation[64];           // 130 // 131
    // 194 byte
    
    //===============================
    // D1 - Dashboard_1
    byte D1[29];
    //char  Dash_D1;                     // 0   // 0 = 'D'
    //byte  Dash_D1Num                   // 1   // 1 = '1'
    //byte TelemetryPacketNum;           // 2   // 2    
    //byte GameSessionState;             // 3   // 3    
    //byte CarFlags;                     // 4    // 110
    //float CurrentTime;                 // 5   // 20   
    //float Speed;                       // 9   // 120  
    //unsigned int Rpm;                  // 13  // 124  
    //byte GearNumGears;                 // 15  // 128  
    //byte BoostAmount;                  // 16  // 129  
    //float EngineSpeed;                 // 17  // 448  
    //float EngineTorque;                // 21  // 452  
    //byte TyreGrip[4];                  // 25  // 280  
    // 29 bytes
    
    //===============================
    // D2 - Dashboard_2
    byte D2[24];
    //char  Dash_D2;                     // 0   // 0 = 'D'
    //byte  Dash_D2Num                   // 1   // 1 = '2'
    //int OilTempCelsius;                // 2   // 100  
    //unsigned int OilPressureKPa;       // 4   // 102  
    //int WaterTempCelsius;              // 6   // 104  
    //unsigned int WaterPressureKpa;     // 8   // 106  
    //unsigned int FuelPressureKpa;      // 10   // 108  
    //float FuelLevel;                   // 12   // 116  
    //char EnforcedPitStopLap;           // 16   // 130  
    //byte CrashState;                   // 17   // 131  
    //float OdometerKM;                  // 18   // 132 
    //byte AeroDamage;                   // 22   // 456 
    //byte EngineDamage;                 // 23   // 457 
    // 24 bytes
    
    //===============================
    // D3 - Dashboard_3
    byte D3[14];
    //char  Dash_D3;                     // 0   // 0 = 'D'
    //byte  Dash_D3Num                   // 1   // 1 = '3'
    //float BestLapTime;                 // 2   // 12   
    //float LastLapTime;                 // 6   // 16   
    //float PersonalFastestLapTime;      // 10  // 40   
    //14 bytes
    
    //===============================
    // D0 - Dashboard_0 - Startup parameters - Send ONCE at start of race
    byte D0[6];
    //char  Dash_D0;                     // 0   // 0 = 'D'
    //byte  Dash_D0Num                   // 1   // 1 = '0'
    //byte LapsInEvent;                  // 2   // 11   
    //byte FuelCapacity;                 // 3   // 111  
    //unsigned int MaxRpm;               // 4   // 126  
    // 6 bytes
    
    //===============================
    // D9 - Dashboard_9 - OnChange - Send if data changes
    byte D9[13];
    //char  Dash_D9;                     // 0   // 0 = 'D'
    //byte  Dash_D9Num                   // 1   // 1 = '9'
    //byte BrakeDamage[4];               // 3   // 320  
    //byte SuspensionDamage[4];          // 7   // 324  
    //byte DPad;                         // 11  // 1366     
    //unsigned int JoyPad;               // 12   // 96   
    // 13bytes
    
    //===============================
    // S1 - Suspension - Send EVERY packet
    byte S1[82];
    //char  Dash_S1;                     // 0   // 0 = 'S'
    //byte  Dash_S1Num                   // 1   // 1 = '1'
    //float TyreHeightAboveGround[4];    // 2   // 284  
    //float WheelLocalPositionY[4];      // 18  // 376  
    //float RideHeight[4];               // 34  // 392  
    //float SuspensionTravel[4];         // 50  // 408  
    //float SuspensionVelocity[4];       // 66  // 424  
    // 82 bytes
    
    //===============================
    // M1 - Motion - Send EVERY packet (WHEN READY i.e. building new seat)
    byte M1[110];
    //char  Dash_M1;                     // 0   // 0 = 'M'
    //byte  Dash_M1Num                   // 1   // 1 = '1'
    //float Orientation[3];              // 2   // 136  
    //float LocalVelocity[3];            // 14  // 148  
    //float WorldVelocity[3];            // 26  // 160  
    //float AngularVelocity[3];          // 38  // 172  
    //float LocalAcceleration[3];        // 50  // 184  
    //float WorldAcceleration[3];        // 62  // 196  
    //float ExtentsCentre[3];            // 74  // 208  
    //byte Terrain[4];                   // 86  // 224  
    //float TyreSlipSpeed[4];            // 90  // 260  
    //float TyreY[4];                    // 106 // 228  
    // 110 bytes
    
    
    //====================================================
    // Left over fields from orig 'Wanted'
    // Unfiltered input
    //byte UnfilteredThrottle;             // 6    - 4
    //byte UnfilteredBrake;                // 7    - 5
    //byte UnfilteredSteering;             // 8    - 6
    //byte UnfilteredClutch;               // 9    - 7
    //byte RaceStateFlags;                 // 10   - 8
    // Flags
    //byte HighestFlag;                    // 98   - 28
    // Pit info
    //byte PitModeSchedule;             // 99   - 29
    // Car state
    //byte Brake;                       // 112  - 42
    //byte Throttle;                    // 113  - 43
    //byte Clutch;                      // 114  - 44
    //char Steering;                    // 115  - 45
    // Wheels / Tyres
    //byte TyreFlags[4];                // 220  - 152
    //float TyreRPS[4];                 // 244  - 176
    //float TyreLateralStiffness[4];    // 300  - 228
    //byte TyreWear[4];                 // 316  - 244
    //unsigned int AirPressure[4];      // 440  - 320
    // 339                                  // 1368 struct is padded to
    //===============================================================

    SO.... The code isnt done yet, but its going to...

    On ESP-

    If GameSessionState NOT = '1' (NOT on the main menu or a sub menu)
    read racestate/carflags...
    if on pitbox screen
    send PartInfo (for me, thats just displaying the car/track/class on an LCD - All I want)
    send D0 = Setup dash min/max values
    (ONLY NEED SENDING ONCE, so set a flag '0-sent-already' or similar)


    when carflags = 10
    start sending D1
    if sent 10x D1
    send D2
    if sent 50x D1
    send D3

    You get the idea....

    Keeps the serial stream very small compared to original....

Similar Threads

  1. [PC/XB1/PS4] vrHive - Dashes/Telemetry/Live Data/Arduino/Client-Server/+more
    By MikeyTT in forum Third-Party Apps & API Discussion
    Replies: 742
    Last Post: 21-11-2017, 18:26
  2. Arduino Dashboard
    By saibot852 in forum General Discussion
    Replies: 219
    Last Post: 04-09-2017, 04:41
  3. Import 3D model in game?
    By choptider in forum PC - Technical Help & Support
    Replies: 4
    Last Post: 25-11-2015, 03:54
  4. Logic3 TopDrive GT racing wheel not detected (Wifi dongle)
    By markieg in forum PC - Technical Help & Support
    Replies: 0
    Last Post: 09-10-2015, 12:12
  5. calling all arduino nuts
    By brooksy in forum General Discussion
    Replies: 2
    Last Post: 25-05-2015, 09:35

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •