ESP SPIFFS Basic Web Control Page

This template gives you an out of the box ESP8266/8285/32 Wifi Client, and webserver, which is configured to serve a page from the ESP allowing control of an LED, or in this example an RF Electric socket.

 

No coding is needed to run the example beyond the WiFi Credentials for your network, and only the example hardware is below (the RF socket can be replaced with an LED for example with a few edits).

 

This is also detailed on Instructables: https://www.instructables.com/id/Arduino-Power-Plug-Web-Control/

Parts:

ESP32 / ESP8266

RF Tx Module (433Mhz)

RF Socket (433Mhz)

Libraries:

RCSwitch

 

Connections:

ESP 32 Connection Example

NOTE: Set the RF Socket to Group 1, Socket 1 (depending on whether you plan to edit the example)

Software

Download the Template project from here.

Install the RCSwitch Library onto your machine.  Edit the library.properties file to include "esp32" in the list of architectures.

Upload the files to the SPIFFS using the vMicro > Publish Server Data Files (SPIFFS) button with the relevant board selected.

Edit the Wifi credentials and upload Software to ESP.

 

NOTE - The serial monitor will output some basic information about the connection status, and the requests / responses being sent

 

Load a web browser on your PC and navigate to http://esp32/, the below page should be presented:

ESP App Running in Browser

 

The page request from the browser causes the ESP32 to load the relevant file from the SPIFFS filesystem, and send it back to the browser.

 

If you press the ON / OFF buttons it will:

Browser sends the HTTP Request from the page to the ESP32

ESP32 will process this and transmit the RF message to the socket

ESP32 then replies back to HTTP request with the Response similar to above.

 

The software can easily be extended in any number of ways, this is just to get you started quickly with a web server and page, served from the ESP itself, to perform a useful purpose.