New ESP8266_AT_WebServer library supporting Teensy boards running ESP8266 AT shields

khoih-prog

Well-known member
https://github.com/khoih-prog/ESP8266_AT_WebServer

This is simple yet complete WebServer library for `AVR, Teensy, etc.` boards running `ESP8266 AT-command` shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32.

The library supports
1. WiFi Client, STA and AP mode
2. TCP Server and Client
3. UDP Server and Client
4. HTTP Server and Client
5. HTTP GET and POST requests, provides argument parsing, handles one client at a time.
 
This is exactly what I've been looking for! I'm using a Teensy 4.0 with the Ai-Thinker ESP-01 WIFi shield. I was able to install and compile the library and the WebServerAP example with no problems (using PlatformIO + VsCode).

But...the program crashes during startup. With a little tracing, I think I've isolated the problem to the ESP8266_AT_Class::localIP() function, but I'm not 100% certain. I tried to report this issue on the Github repository, but it was archived about a week ago.

I'm hoping that the author (OP on this thread) will respond, as I haven't yet found another way to contact him. Anyone have any ideas? Thanks
 
Sorry, please go back to use v1.6.0
The new versions v1.7.0 and v1.7.1 will be removed or fixed.

Code:
Starting HelloServer on TEENSY 4.0 with ESP32-AT & ESP8266_AT_WebServer Library
ESP8266_AT_WebServer v1.6.0
[ESP_AT] Using ESP32-AT Command
WiFi shield init done
Connecting to WPA SSID: HueNet
WebServer is @ 192.168.2.155
HTTP server started @ 192.168.2.155
timedRead timeout = 1000
timedRead timeout = 1000
timedRead timeout = 1000
 
Thanks very much! I was just browsing through some of the other examples, and I noticed this:
Code:
 // TODO, WizFi360 can't use crashing localIP()

So maybe I was on the right track. I'll try v1.6.0 and let you know how it goes.
 
Just be sure to use external 3.3V supply for AT-shield. 3.3V from T4.0 can't supply enough power to the shield.

Just testing now and OK

Code:
Starting AdvancedWebServer on TEENSY 4.0 with ESP32-AT & ESP8266_AT_WebServer Library
ESP8266_AT_WebServer v1.6.0
[ESP_AT] Using ESP32-AT Command
WiFi shield init done
Connecting to WPA SSID: HueNet
HTTP server started @ 192.168.2.155, Port = 80
.timedRead timeout = 1000


Selection_271.jpg
 
OK! Now I get:
Code:
Starting WebServerAP on TEENSY 4.0 with ESP8266-AT & ESP8266_AT_WebServer Library
ESP8266_AT_WebServer v1.6.0
[ESP_AT] Use ES8266-AT Command
WiFi shield init done
Attempting to start AP with SSID = EFD_NET and PW = 12345678
Access point started @ channel 2
AP IP Address = 192.168.120.1
SSID: EFD_NET, PASS: 12345678
WebServer started @ 192.168.120.1
To see this page in action, open a browser to http://192.168.120.1
and
Screen Shot 2023-02-03 at 6.33.26 PM.png

I am using the 3.3v supply from the T4. The PJRC data sheet says that it can supply up to 250mA, and the data sheet for the ESP-01 (but not sure its exactly the right one) says that the highest (typical) power requirement (in one mode) is 215mA. I'll only be using the WiFi interface intermittently, so hopefully I can get away with it. I'll check to see if there's a way to constrain it to the lower-power modes, since speed isn't that important for my application. I use T4s to control LED lighting for large art installations, and I want a WiFi interface to occasionally adjust settings/modes.

Thanks SO MUCH for your help. BTW, you appear to be amazingly productive. Wow.
 
Hi! I hope you don't mind if I ask a few more questions:

1. When testing the WebServerAP example, I see that server.handleClient() consumes about 2.5 seconds of CPU time (in two ~1.2 second chunks) each time that the simple web page is refreshed. I measured this with an elapsedMillis timer around the call. Why does this take so long, and what's the bottleneck? This is really going to limit the utility of the WebServer if it prevents my code from running for that long.

2. I'm very confused about all the different libraries and modes that are available, many of them authored by you. For example, what's the difference between ESP8266_AT_WebServer (what I'm using now) and WiFiWebServer, which seems very similar?

3. ESP8266_AT_WebServer doesn't require a separate library for the wifi module/shield, but it looks like WiFiWebServer does require a separate library, and supports both the ESP_AT_Lib library (yours) and the WiFiEspAT library. Why, and what's the difference?

4. What's the difference between AdvancedWebServer and WebServer/WebServerAP? Am I correct that AdvancedWebServer can be modified slightly to use Soft-AP mode?

Sorry for all the questions. I haven't yet found a community/forum that is actively using the ESP-01 the way I want to. Otherwise I wouldn't bother you. Thanks!
 
Back
Top