This is a demo ESP32 application which takes temperature and humidity readings and broadcasts them live to clients using the WebSocket protocol.
The application also acts as a webserver, serving a frontend Svelte application, which provides a basic interface for viewing the temperature and humidity readings sent from the server, as well as controls to change the rate at which the server broadcasts updates.
Open the project using the PlatformIO VSCode Extension.
In the frontend directory:
npm install
npm run build
This will copy over the build artifacts to the backend/data directory, ready for upload to your ESP32.In the backend directory:
Create a secrets.h file inside the include directory and paste the following, substituting your WIFI SSID and password:
#define WIFI_SSID <Your WIFI SSID>
#define WIFI_PASSWORD <Your WIFI password>
In the PlatformIO Extension:
Click Upload Filesystem Image to upload the front-end code (Svelte app) to your ESP32's filesystem.
Click Upload and Monitor to upload the backend code to your ESP32, and start the application.
Your ESP32 will start the application which will:
secrets.h file Go to the local IP address in your web browser to start the front-end application.