logo elektroda
logo elektroda
X
logo elektroda

How to speed up data uploads via ESP8266 WiFi module with MPU9250?

kkdemonas 2178 4
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 15788607
    kkdemonas
    Level 1  
    Hello,
    i am in the middle of a project to send data from the MPU9250 module (accelerometer, gyroscope, magnetometer) to a computer via wifi using the ESP8266 WIFI module. The two systems are coupled together using the Atmega16A, the microcontroller of course receives data from the MPU9250 and transmits it directly to the ESP8266 and "programs" both modules (AT commands and register entries). The wifi module connects to the router>then to the computer and the data is received by a simple C# application that waits for the connection. Namely the problem is that the data sampling rate from the MPU is about 100Hz and the wifi module only sends 2-3 packets per second . For my project where I want to get real-time acceleration results on the PC it is far too slow (I don't want to buffer them). I would like to know if there is any way to speed up the module so that it runs at full speed? I have already sent data in continuous transmission mode where the effect was also unsatisfactory.
    Below is a list of AT commands I am sending to the ESP8266 and the main program loop (the program works without any problems on RS232/USB converter and data is received without "lag").

    Code: C / C++
    Log in, to see the code


    How to speed up data uploads via ESP8266 WiFi module with MPU9250?
    MPU9250
    How to speed up data uploads via ESP8266 WiFi module with MPU9250?
    ESP8266
    Thanks for your interest and apologies for the errors.
  • ADVERTISEMENT
  • #2 15805276
    piotr411
    Level 22  
    Maybe dispense with AT commands, program the ESP directly? Do the communication on a fast I2C interface? or dispense with the AVR altogether?
  • ADVERTISEMENT
  • #3 15806007
    tmf
    VIP Meritorious for electroda.pl
    @piotr411 I2C is a fast interface?:) Good. Here it is not the AVR that is the bottleneck, let alone the UART connecting it to the ESP. The problem is the way the data is sent. Probably the author sends the packet with an AT command, then waits for the module to confirm that the sending is correct. And this takes time. Configure the module to form an RS-WiFi bridge and just send bare data. You will achieve much higher speeds in this mode. Of course, it would be optimal to switch to direct ESP programming, e.g. using C and the provided API, but this is not necessarily needed.
  • ADVERTISEMENT
  • #4 15806139
    piotr411
    Level 22  
    That's what I wrote, to abandon AT and write the applications directly in ESP. If you were to stay AVR, it is better to use i2c rather than uart, because uart has a limitation of 255 bytes, i2c does not have this limitation. Occasionally when using the uart and not clearing the buffer, there are ESP resets.

    The choice of languages for ESP is greater than C. Especially Basic is practical if software updates are to be made in the meantime.
  • #5 15806321
    tmf
    VIP Meritorious for electroda.pl
    Nothing like making up problems for yourself. As I wrote, the easiest way is to switch the ESP with AT to RS-WiFi bridge mode and simply send the data. ESP will wrap it up in packets and send it itself.
    The choice of languages on the ESP is wider, just again - why complicate your life when, based on the original API, it is a few lines of code if one insists on porting the whole thing to the ESP, of course.
ADVERTISEMENT