I have been reading for several days now and can’t seem to find what I need. Perhaps my question is too basic. Currently, I am unable to get any predictable response from my setup. It just won’t do what I ask and seems to have a mind of it’s own.
What I have is an attempt to duplicate the Reaction Wheel Inverted Pendulum project. I am using an Emax GB4114 gimbal motor, ESP32 controller, AS5600 sensors. The motor is attached to the reaction wheel and both are suspended from the pendulum.
I also have the SimpleFOCStudio working (need help here too. IE, how to use it).
What my motor WILL do:
Loading the open_loop_velocity_example with voltage limits set to 4. (it got hot at six so being cautious). It will run both CW and CCW up to 15 rads/s. At values less than about 9, it is rough running and only begins to smooth out above 10. Values over 15 and it just stops and shakes. It will not start and any value over 3. To reach 15, I must start at 1 and increment by 1 until 15.
The open_loop_position_example. The motor will move…sorta. I tried values from -6 to +6, increments of 1. It will move a random distance in a random direction. positive values do not always create motion in the same direction, nor do negative values.
The angle control for magnetic sensor. The test probably could use more voltage. If I help it start, it seems to move correctly but jitters after reaching it’s target position.
Velocity control using encoder. This would run up to +/- 40 if I helped it start although values above 25 did not seem to change the speed.
I feel like I must get the motor to start reliably on it’s own in either direction and run relatively smooth with enough torque to make this experiment work. So starting with a basic script seems logical. Which one would be best or one from scratch? Since I cannot find very much information on how to use the Studio, I am unsure what it can and cannot do. Can it change modes and override what was programmed via the “control loop mode” window? If so, where should I start? Select PID also has four choices, which one. What does the jogging control do? It inserts and instruction of Target:xx … Does it’s function change with the control loop mode? It could mean move one rad or a velocity of one rad/s…I can’t tell.
Here is a simple code that might work as a test program (if the Studio can provide the what and how):
#include <SimpleFOC.h>
MagneticSensorI2C sensor = MagneticSensorI2C(AS5600_I2C);
// BLDC motor & driver instance
BLDCMotor motor = BLDCMotor(11,10.9,42);
BLDCDriver3PWM driver = BLDCDriver3PWM(16,17,18,19);
Commander command = Commander(Serial);
void doMotor(char* cmd) { command.motor(&motor, cmd); }
void setup() {
sensor.init();
motor.linkSensor(&sensor);
driver.voltage_power_supply = 14.8;
driver.init();
motor.linkDriver(&driver);
motor.voltage_limit = 6;
Serial.begin(115200);
motor.useMonitoring(Serial);
motor.init();
motor.initFOC();
command.add('M',doMotor,"motor");
motor.useMonitoring(Serial);
motor.monitor_downsample = 0;
}
void loop() {
motor.loopFOC();
motor.monitor();
command.run();
}