in this video I will explain step by step how to control a brushless DC motor using ESP32 and Arduino IDE.
Buy the motor, ESC :
On maxynos.net website:
https://maxynos.net/products/maxynos-...
https://maxynos.net/products/maxynos-...
or on Amazon US:
https://www.amazon.com/2318-Planetary...
https://www.amazon.com/dp/B0FPWNBR88
Full Tutorial below:
Arduino Projects hub
https://projecthub.arduino.cc/moath_m...
or
Hackester.io
https://www.hackster.io/momanee/advan...
Code:
#include the ESP32Servo.h library and make sure its downloaded already
Servo esc;
int escPin = 4; // Choose any PWM-capable pin
void setup() {
esc.setPeriodHertz(80); esc.attach(escPin, 1000, 2000); // Min and Max pulse width in microseconds
esc.writeMicroseconds(1500); // Neutral (Stop)
delay(2000); // Wait to arm ESC
}
void loop() {
// Forward
esc.writeMicroseconds(2000);
delay(1000);
// Stop (1500us)
esc.writeMicroseconds(1500);
delay(120);
// Reverse
esc.writeMicroseconds(1000);
delay(1000);
// Stop (1500us)
esc.writeMicroseconds(1500);
delay(120);
}