Following a discussion I had with David Hughes recently, I have chosen to publish my project so that all of you here can benefit from it.
This project is an extension of Rui & Sara’s excellent tutorials:
- ESP32 Web Server with BME280 – Advanced Weather Station
- ESP32 Web Server using SPIFFS (SPI Flash File System)
- ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE
It focuses on the possibility of updating the firmware of an ESP32 through a WiFi connection. That is to say, without the need to be connected to the microcontroller by a USB cable.
It includes two completely independent applications that can be downloaded and run in turn on the ESP32. Each of these applications implements a web server to expose a user interface to interact with the ESP32 from a browser on a mobile phone or computer.
I have chosen here to propose two applications that are relatively simple to implement so as not to add complexity to the central issue at hand:
- The first application allows a simple LED to be switched on or off.
- The second one allows to display the measurements of an environmental sensor.
The approach I followed is nevertheless slightly different from the one proposed in Rui & Sara’s tutorials. Indeed, I used here WebSockets to optimize the data exchanges between the ESP32 and the web browser. This protocol is much more efficient than a simple web server, and I thought it might be of interest to more than one here.
You can take a look at this video to get a preview of the result I got.
You’ll find my source code on GitHub and all the implementation details if you’re interested.
Many thanks to Rui & Sara for their articles, which enabled me to complete this personal project today. I started my adventure in electronics only a few months ago and, thanks to them, I discovered an really exciting field.
Thank you so much for creating this tutorial. This will be very useful for all of our readers and also for us!
I would also like to thank you for your valuable contributions and devotion here on the forum – always with great content and great explanations. Not many people take the time to help others like you do.
Thank you so much.
Good evening Sara,
Thank you for your very kind and inspiring message.
Actually, it’s me who thanks you and Rui very much for everything you do for this community. Your site is a gold mine for people like me. I have some programming experience, but I’m really quite new to the field of electronics and microcontrollers. During my research, I stumbled upon your tutorials while I was looking for information on the ESP32… and I’ve been using it ever since! Every day I’m looking for new content to be released! You’re doing a really great job, covering a lot of areas. And what I like most of all about you is your generous dedication to share your research, your experiments, your results with us, and all this in a simple and very effective way. For this, I thank you very much. I have learned thousands of things from your tutorials, which quickly guide us to the essentials.
My interventions on the forum are only a very modest contribution to thank you in my own way. I, in turn, try to help people when I can. However, I hope I don’t tell too many nonsense 🙂
I’ve learned a lot here, and it seems only natural to me to participate and light the way for those who try to follow you, with my little lantern.
As the saying goes: “alone we go faster, but together we go further.”
Coming back to my “tutorial” (and that’s a big word next to what you and Rui are doing), I initially wanted to write something more detailed, but David (who is at the origin of this request) seemed a bit in a hurry to move forward on his own project, and unfortunately I don’t have as much time as I would like to do things better in a snap… So, I preferred to publish my code quickly, giving some hints about the project structure and my technical choices. And I think my code is clear enough to be understood by all those who will have read your tutorials on the same topics beforehand. I just wanted to bring a little interesting variation with WebSockets, as well as the use of the AsyncElegantOTA library to simplify the implementation of the OTA web update part (my initial goal was to simplify things as much as possible for David).
Your message really made me happy… and I thank you again. I will gladly continue to help out here when I can. And above all, rest assured that I will continue to come and learn with you!