ESP32 and ESC for spinning a homemade brushless mtoor

I build a brushless motor and i have conected all the coild togeter as i saw diagrams online. To control it i wanted to use an ESC, but i got a cheap one and i dont know how to use it. I tryed with claude and chatgpt but i cnt get it to power a single coil. The esc only puls 0.051A from my sorce and the motor stays still. Some ideas would help.




alos here is some code, i measure 2.2 V when i sent 111000
`const int ESC_PIN = 16;

void setup() {
Serial.begin(115200);
ledcAttach(ESC_PIN, 50, 17);
Serial.println("Trimite valoarea de minim:");
}

void loop() {
if (Serial.available()) {
long val = Serial.parseInt();
if (val > 0) {
ledcWrite(ESC_PIN, val);
Serial.print("Scris: ");
Serial.println(val);
}
}
}`

How do You expect us to know?

You need to improve the content in the post. Please read and use this: How to get the best out of this forum - Development Tools / IDE 1.x - Arduino Forum

Im sorry but i am kinda is a scramble for time right now, this is why the post is not soo profesional.

You being short of time doesn't help us. The better You document the project and the trouble, the faster and better the replies come.

Tell us or show us how you built the armature for the motor! If not designed for a 3-phase motor it won't run no matter how you fiddle with it.

That is cool but what is it, what are the electrical specifications. In order to make it run we will need the following. Please note your 3-pole/3-wire brushless DC motor cannot run directly from DC connected directly to the wires. The driver must electronically switch the three motor phases in sequence.

Basic requirements:

DC power supply or battery sized for the motor
3-phase bridge driver, usually 6 MOSFETs
Commutation control, either:
- sensorless back-EMF detection, or
- Hall sensors / encoder feedback
PWM current or speed control
Flyback/body-diode and transient handling
Current limiting, because startup/stall current can be high

For an Arduino or other processors, they do NOT drive the motor directly. It only sends a control signal to the ESC or motor driver. The driver supplies the motor current.

The motor is the one in the first image and i have fallowed a diagram i found online :

I have conected the end of each coil togeter just like in the example, and the start of each coil to one of the esc's wires.

I own a power supply and i used a generic esc. In order to emit a PWM signal i used an esp32 but i dont know if i did the coding right.

update i managed to make to esc work but now the motor does not spin it just vibrates. Here is also the code i used.

//#include<Servo.h>
#include <ESP32Servo.h>
#define ESC_PIN 2

Servo esc;

void setup() 
{
  esc.attach(ESC_PIN,  1000, 2000);
  esc.write(180);
  delay(5000);
  esc.write(0);
  delay(2000);
  esc.write(180);  
}

void loop() 
{
}

the forums dont allow me to upload a video

That is a simplistic illustration for explaining how brushless motors work and for an outrunner type, not the type you made. A real BLDC motor will have many more stator poles. The ESC you have is probably designed for a motor with many more poles and one that requires high current. I doubt that it will work with your simplistic 3 pole design.

What is the resistance of one motor winding?

Yes, that shows the stationary field coils. How did you make the armature, the rotating part?

Hi, @doli205

Can you please post a link to specs/data of the ESC?

Tom.... :smiley: :+1: :coffee: :australia:

Yall, i have finished and it works, thank you for all the help you provided. In the future i might update you on how i fixed it.

I would have liked to know the specs too but the site where i bought them from only said it operates up to 30A and its control by 5v PWM. Here is the site if you want wo know.

Again, i managed to make it work, but if you want to know, this is the diagram i fallowed, and i made the rotor by sticking 5mm by 2mm circular magnets on a 3d printed shaft, using super glue.

You are right sorry for that, the better ilustration is the one i atached in response to Paul_KD7HB's post. The resistance of each coil is about 2 ohms so each phaze has about 4 or 5 ohms

Thank you for the explanation.

You'll first have to setup the esc: power it on, PWM to 2000us, wait till the motor beeps, PWM to 1000us, wait till it beeps, unplug the power, Now you can use it for your RC signal (1000-2000us). But it needs at least a 2s LiPo or ~ 8.4V to do anything. Without a manual you cannot configure the timings etc. ... so chances are that the motor will not rotate bust just humm.

Yeth.

Here's a sketch that guides you through calibration:

#include <Servo.h>

#define MAX_SIGNAL 2000
#define MIN_SIGNAL 1000  // 700 ?
#define MOTOR_PIN 7

Servo motor;

void setup() {
  Serial.begin(9600);
  Serial.println("ESC Calibration Dance.");

  motor.attach(MOTOR_PIN);
}

void loop()
{
  Serial.println("Start (again) the calibrate dance for ESC.");


  Serial.println("Turn OFF power source."); keywait();

  Serial.println("Now writing maximum output.");
  motor.writeMicroseconds(MAX_SIGNAL);
  Serial.println("Turn ON power source."); keywait();
  
  Serial.println("Now to write minimum output"); keywait();
  motor.writeMicroseconds(MIN_SIGNAL);
}

// Wait for human
void keywait()
{
  Serial.println(" So press any key.");

  while (!Serial.available())
    ;
  Serial.read();
}

a7

Oh, I forgot: the arduino must send 1000us ppm when the ESC+arduino are powerd up, otherwise the ESC will go into a fault state and do nothing (best case) or go into setup mode (not so good).