This project involves firmware for an ESP32 connected to an 8-channel relay module. The relay module is utilized to control a Universal Robot as a digital input.
- Firmware built with Arduino and PlatformIO
- Web Application built with React and attached to ESP32
- API for controlling the relays
Dark Mode Preview | Light Mode Preview |
---|---|
-
Clone the repository
git clone
-
Create a new file named
secret.h
in thesrc
folder and add the following code:#pragma once #define WIFI_SSID "YOUR_WIFI_SSID" #define WIFI_PASSWORD "YOUR_WIFI_PASSWORD"
-
Build and upload the firmware to the ESP32
pio run -t upload
-
Build and upload web interface to ESP32 filesystem image
pio run -t uploadfs
Dependecies for web interface are installed automatically by PlatformIO when you build filesytem image. For more information about script, check
script
folder.
GET /ip
- Get the IP address of the ESP32GET /status
- Get the status all of the relaysPOST /relay/:id
- Set the state of the relay with the specified ID- Content-Type: application/x-www-form-urlencoded
- Body:
state
("on" or "off")
POST /relay/all
- Set state of all relays at once- Content-Type: application/x-www-form-urlencoded
- Bodu:
states
["on", "off", "on", "off", "on", "off", "on", "off"] --> just example
- Fix indexing mistake between the UI and the actual relay id
- Make it using websocket, so the page doesn't need to be refreshed to display real-time relay condition