Web Server for project

I've been trying to think of a way to connect my IoT devices to a web server and, although I know quite a few ways to do it, the problem is.. I know quite a few ways to do it. So, I'm not sure which option to pick.

I do not want to use the Arduino cloud.

Should I create a web server on my original datalogging device and have my other IoT devices communicate through that? Or take another Arduino Nano ESP32 and create a web server on that board so I have a master/slave system that can be online 24/7 even if all of the devices other than the server device are off?

Also, I'm not sure what the best library would be to use for web sockets on Arduino if I use web sockets.

Can I create an adequate GUI in the Arduino IDE that doesn't look like it's from 2005? Most examples I've seen have historic GUI's and any one with a slightly more modern GUI, the video has been in another language. I can create a nice looking GUI in python but I'm not sure if I should just do it on the ESP32 and Arduino IDE instead, just to keep the software consistent.

I'm just trying to do a bit of research before I commit to the project. Any help would be appreciated. Thank you!

HTML + CSS is all you need for a nice GUI. And then javascript + jquery for to load off stuff to the browser. The rest is up to you, it's not different from any other web application.

It's mainly just communication that I'm stuck on. I've made GUI's in the past in HTML and CSS, but I didn't have to communicate with any devices other than my own PC. I'm thinking of maybe using http to create the server and ESPnow to have the ESP32's communicate with one another. Can I just put the HTML and CSS files into Arduino?

Search the examples for littlefs + webserver. On the communication part: the easiest way is to use jquery + websockets and send plaintext messages, then it's almost like using serial.

The esp-idf uses esp_http_server and supports both sockets and http. Other libraries only support either websockets or http so then you would need 2 libraries.

Communication depends on what you are doing. I think using NOW when you have
websockets/http is kind of redundant if the devices are all clients anyways. So they can talk to each other via the server. Depends on what you trying to do.

I recommend watching this youtuber Mo_thunderz for some ideas.

Yes, the css, javascript and html files are stored on the server. Most times those 3 files are combined into one html file which is served, depends on size. When a client connects for the first time you want to serve those files. That is the http part. After that clients can communicate via websockets.

I've been watching Mo Thunderz for the last hour or two and it's really helped with my understanding. His videos are very informative; if only his titles were as detailed as the videos, then I would have came across his videos a while ago!

It's a good starting point to learn how to combine esp32's with web technologies. Opens up a whole new world but it is also a lot more to learn.

Only problem is the fact that Arduino has many, many problems with me for some reason. The code that Mo Thunderz writes and compiles in his video has about 15 compilation errors for me.. not to mention that one of my files (bits/error_constants.h) wasn't even downloaded during the original installation process, which caused more issues.

What version of the espressif-arduino framework are you using. His code was written for version 2.0.xx if you are using the latest version of espressif-arduino which is a new major release it will, most likely, have issues.

I have no clue lol. I need to check. Now I got to try fix these errors. I'll most likely be on the latest version

Are you using platformio or arduino or something else ?

I would recommend finding your version first before trying to fix errors
because if its a versioning problem you're not going to fix that.

If using platformio the arduino version is printed out each time you build your program.
I have not used arduino ide for a while but I am sure it outputs that info somewhere.

I've got the Arduino Nano ESP32, which is using the Arduino ESP32 boards package. It's version 2.0.13. I have ESP32 by Espressif downloaded too, which is on version 3.0.1

The ESP32 by Espressif version 3.0.1 is probably your problem. Mo thunderz code was written against version 2.0.xx

So you are going to have to install and use a previous version of ESP32 by Espressif (version 2.0.xx). At least then your mo thunderz code will be compatible with the framework.

When software version goes a whole number up it is not guaranteed to work with code that was written for the previous version ie. version 2.x.x

You can ignore versioning until it becomes a problem then you will want to understand it.
At least thats how I dealt with it,, lol.

Just when I thought things were going well. Are there any examples for v3.0.1? Most videos I've found online are at least a year old, which is why I've been getting errors.

It is now a problem therefore I now want to understand it. I'm following in your footsteps!

Easiest thing to do is to roll back to version 2.x.xx

Version 3 is fine for anyone not using 3rd party libraries since those libraries might have to be modified for use with ver 3.

Mo_thunderz uses at least 2 third party libraries for websockets and json. So rolling back to ver 2 is the way to go for now IMO.

I'll need to try a few different versions. Just tried version 2.0.0 and there was no support for the nano ESP32

You need Arduino-ESP32 version 2.0.10 or above.
That is when support for your board was added to the framework.

Edit: Put this in your code If you need to find what version of esp arduino your running with :

 #include "esp_arduino_version.h"
  Serial.print("ESP_ARDUINO_VERSION = ");
  Serial.println(ESP_ARDUINO_VERSION);

Use the most recent v2: 2.0.17 last time I checked.

My serial output:

ESP_ARDUINO_VERSION = 196609

Edit: I downloaded version 2.0.17 and it works! Everything works! I just need to change the code now to my specifications as I already understand most of it. Only problem is I'll need to check that the older version of the board package is compatible with my project too

I tried and it just said "The system could not find the path specified"

Edit: I'll let you know what it says once I copy my bits/error_constants.h file into the 2.0.17 version, for some reason it never installs and I always need to do it manually for the ESP32S3 packages

I got it working once I created the error constants header file!