I have an ESP32 module. I want to send data to it using an Android app.

I tried using http but the delay is big especially since I want to send about 20 values per second with a delay between 50 to 100 ms.

So I am looking for a better way to do it.

  • 3
    \$\begingroup\$ How are you sending it exactly ? bluetooth? wi-fi? WHAT are you sending ? How big ? what app build ? how are you RECIEVING it ? SPI ? i2c ? there can be SOOO many variables that are not necessarily about the module itself that could influence the setup. \$\endgroup\$ – Obmerk Kronen Nov 14 '18 at 17:30
  • \$\begingroup\$ i am sending very small data just one asci character i tried wifi with http request \$\endgroup\$ – Ahmed Salman Nov 14 '18 at 17:48
  • \$\begingroup\$ http request it self takes time to be sent from the app So i am looking for a faster way to send without delay \$\endgroup\$ – Ahmed Salman Nov 14 '18 at 17:51
  • 2
    \$\begingroup\$ @AhmedSalman that doesn't sound like an electrical engineering problem but like an Android development problem. You've already mentioned one part of your stack – HTTP – which seems to be a very bad choice for low latency. It seems you haven't really researched much at all in the direction of what HTTP does. \$\endgroup\$ – Marcus Müller Nov 14 '18 at 19:05
  • \$\begingroup\$ I'm voting to close this question as off-topic because it is fundamentally about software-centric issues of network protocols and Android application development, and not about Electrical Engineering. If you had something that worked to a PC but not to the ESP32, then with full details provided that might just barely be on topic here; but the present question is not. Likely the subject belongs on stackoverflow, but the question is too incomplete to be answerable, so migrating it would be a violation of the policy against migrating unanswerable questions. \$\endgroup\$ – Chris Stratton Nov 14 '18 at 20:18

Use plain TCP sockets communication. Don't send the HTTP strings, send only byte. Let the connection open and reuse it to send the bytes. Check the state of the connection and when it disconnects reconnect.

Modify the receiving server side socket in app to receive only the bytes and keep the socket open.

Other option is to use UDP.

  • \$\begingroup\$ that's was really helpfull \$\endgroup\$ – Ahmed Salman Nov 15 '18 at 17:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.