Hello everyone,
I’m using a BLDC motor and trying to control it with SimpleFOC and an Arduino uno in open-loop mode. Below, I’ll provide the motor’s datasheet and the code I used.
While running a test spin, I noticed white condensation forming inside the motor (since it’s made of plastic, it was clearly visible), and it heated up significantly. The power supplied was much lower than the rated power—I only wanted to check if the wiring was correct.
Now, I’m wondering:
-
- Is my motor damaged?
-
- Is there an issue with the code?
-
- Did I make a mistake with the power supply?
Please help me figure this out! Any advice would be greatly appreciated.
Thanks in advance!
// Open loop motor control example
#include <SimpleFOC.h>
// BLDC motor & driver instance
// BLDCMotor( pp number , phase resistance, KV rating)
BLDCMotor motor = BLDCMotor(11 , 12.5, 100);
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&motor.target, cmd); }
void doLimitCurrent(char* cmd) { command.scalar(&motor.current_limit, cmd); }
void setup() {
// driver config
// power supply voltage [V]
driver.voltage_power_supply = 12;
driver.init();
// link the motor and the driver
motor.linkDriver(&driver);
// limiting motor current (provided resistance)
motor.current_limit = 0.5; // [Amps]
// open loop control config
motor.controller = MotionControlType::velocity_openloop;
// init motor hardware
motor.init();
motor.initFOC();
// add target command T
command.add('T', doTarget, "target velocity");
command.add('C', doLimitCurrent, "current limit");
Serial.begin(9600);
Serial.println("Motor ready!");
Serial.println("Set target velocity [rad/s]");
_delay(1000);
}
void loop() {
motor.loopFOC();
// open loop velocity movement
// using motor.current_limit and motor.velocity_limit
motor.move();
// user communication
command.run();
}
Datasheet
Adapter