Building a Simple Website Server from an ESP8226

TAGS: electronics; software; website; webserver; ESP8266; Arduino

Why I Did This

I wanted to see if I could monitor and control a small microcontroller from a privately owned web server and website that is hosted on that same microcontroller.
One of the beauties of having Wi-Fi on a tiny microcontroller is that you can monitor and control the sensors from a separate smartphone or computer display (so no need to hook up an LCD, and you get to view the information remotely). Another cool thing is that some smart developers created libraries for the Arduino/Esp compatible microcontrollers that allow a person to host html code so you can view it from the web.

My BME280 sensor attached to an ESP8266 Wifi microcontroller.

Design Walkthrough

Parts: esp8266; BME280

I just wanted to test something actively produced from the website, so I hooked up a BME280 (Temperature / Humidity / Baro Pressure / Altitude sensor) to the controller and had it constantly updated the website with its readings. The Random Nerd Tutorials website had a very detailed example on how to do this. Basically, I had to install the BME280, and link webserver related libraries on Arduino IDE to an example sketch that included both functions and html code. Then upload to the board, and open the local IP on my browser.

Random Nerd Tutorials is a great resource for learning about web server and ESP8266 setups.

A nice simple display of normalized temperatures, humidity, and pressure, on top.
The bottom is when I breathed on it (and humidity rose).

Lessons Learned and Future Changes

Can it be expanded? If I add an SD card module to the microcontroller, could I host a high-quality website? I was also reading about file systems with Arduinos like SPIFFS and LittleFS which seemed to treat the controller as a folder holder for files like html, picture, js files (so I don’t have to hardcode them into the Arduino sketch).
Public? No thanks. I could set this up to be accessible from the public web by forwarding my ports to this device, but I’d rather use a safer method by going to a private service. Maybe there is ESP software for doing that?

References

RandomNerdTutorials tutorial: https://randomnerdtutorials.com/esp8266-nodemcu-web-server-sent-events-sse/

Home Page

Let's go to the start page.

Featured Articles

Let's see what I've experienced lately.

Archived Articles

Let's see ALL of what I've experienced.