Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run a webserver through GPRS using ESP32 #790

Open
lg007 opened this issue May 12, 2024 · 1 comment
Open

How to run a webserver through GPRS using ESP32 #790

lg007 opened this issue May 12, 2024 · 1 comment

Comments

@lg007
Copy link

lg007 commented May 12, 2024

[x ] I have read the Troubleshooting section of the ReadMe

What type of issues is this?

[ ] Request to support a new module

[ ] Bug or problem compiling the library
[ ] Bug or issue with library functionality (ie, sending data over TCP/IP)
[x ] Question or request for help

What are you working with?

Modem: SIM800L
Main processor board: ESP32
TinyGSM version: 0.11.7
Code:

Scenario, steps to reproduce

I have a SIM card with a private APN. I would like to setup a webserver on port 80 through GPRS using the ESP32 (this webserver would be accesible only from those other endpoints that are within the private APN).
I have tried the simple webserver library for ESP32 and also the ESPAsyncWebSrv. Unfortunatelly both crashed after issuing the server.begin() command. Of course before starting the webserver I also waited until the gprs connection was started. Could anyone give me some hints on what am I doing wrong?
(This setup works well with other GRPS endpoints that run linux, like a raspberry with a SIM800L modem, so there is no problem with the APN setup)

@Waterlooboy1997
Copy link

I don't usually comment much on git but i spent the better half of over a week trying to achieve a similar setup with a sim7600G. All way beyond my head but there is no simple way to interface the webservers built around WiFi to the network stack without serious deep diving. ESPIDF has some libs that could interface with the lower level TCP/IP libs like PPOS but I had no luck.

The best solution I achieved was starting up both an AsyncWebServer and a TCP/IP client with TinyGSM. I would then HTTP req from my PC -> ESP through a callback server hosted on AWS. Once the ESP received the request there still needs to be a method of passing this through to the Asyncwebservers stack. My rough work around was to initialize a HTTPClient and then scripted a listener on the TinyGSM ESP client side to passthrough incoming data to the HTTPClient, client function then bundles the HTTP path, params etc. then sends this to the local Asyncwebserver. The HTTPClient then forwarded the response from the Asyncwebserver back to the TinyGSM client back to my AWS server back to my PC. Worked fine for small web pages but struggled with handling any large datasets or libraries used in HTML. OTA was not working either.

In summary an easier solution I found was to use the TinyGSM client to listen to a port hosted on AWS EC2 instance. The AWS hosted a webserver/webpage which acts as a transparent passthrough to the ESP by only needing to send simple commands over 4G, this then triggered the ESP to do something much like how you would use the AsyncWebServer and ESP to talk to each other. ESP then sends back simple responses which is parsed by the AWS server and updated on the webpage. Also works in massively reducing data overhead,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants