This project demonstrates controlling a DC motor using an ESP32 microcontroller and a web interface. It is built using the PlatformIO development environment, providing a simple way to manage libraries and dependencies for your project.
- PlatformIO installed in your preferred code editor or IDE.
- ESP32 board added to your PlatformIO environment.
- Required libraries added to your
platformio.ini
file: WiFi, WiFiClient, WebServer, DNSServer, Update.
- Rudder Motor Control Pins:
motorPin1 (25)
: Input pin for motor channel A.motorPin2 (26)
: Input pin for motor channel B.
Set your WiFi SSID and Password in the following lines of the code:
const char *ssid = "your_SSID_here";
const char *password = "your_PASSWORD_here";
root.html
: Root page.manualControl.html
: Page for manual motor control.settings.html
: Settings page.
- Open the project in your preferred PlatformIO-compatible code editor.
- Build and upload the code to the ESP32 board.
- Access the web interface using the ESP32's IP address.
/
: Root endpoint./manual
: Manual control endpoint./settings
: Settings endpoint./update
: Firmware update endpoint.
The motor can be controlled manually through the /manualControl
endpoint using POST requests with the motor
parameter:
motor=forwards
: Move the motor forwards.motor=stop
: Stop the motor.
Firmware updates can be performed by sending a POST request to the /update
endpoint with the firmware binary file. The ESP32 will automatically restart after the update.
- WiFi.h - WiFi library for ESP32.
- WebServer.h - Web server library for ESP32.
- DNSServer.h - DNS server library for ESP32.
- Update.h - Firmware update library for ESP32.
- Ensure proper hardware connections.
- Use appropriate safety measures while handling the motor.