Reaction wheel inverted pendulum

Hello, I am trying to make a reaction wheel pendulum but I have some issues.

I have the below parts:

  • SimpleFOCShield V2.0.4 (power up the Shield with 12 volt)
  • MPU6050 connected with I2C
  • AS5600 connected in analog A1 pin
  • Gimbal GBM2804H-100T motor
  • and some 3d printed parts as showed in the picture.

First, I started with testing the sensor and I found the min and max values as 16 and 682, respectively. Then, I tried to run the ‘open_loop_velocity_example’ but the motor jiggle in small values and if I try to set the motor target velocity [rad/s] above of 15 many times needs help by hand to start. The ‘open_loop_position_example’ doesn’t work properly, it oscillating again and stop in wrong place. Finally when I try to run the ‘find_pole_pairs_number’ the motor jiggle and the answer is everytime wrong. Have you got any idea for what may goes wrong?

Thank you in advance,
Aristotle

Can you post your code?

Thanks for the prompt reply. This is the code of the open loop that I run, it is the example with some minor changes:

// Open loop motor control example
#include <SimpleFOC.h>

// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(7);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);

// Stepper motor & driver instance
//StepperMotor motor = StepperMotor(50);
//StepperDriver4PWM driver = StepperDriver4PWM(9, 5, 10, 6, 8);

//target variable
float target_velocity = 0;

// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
void doLimit(char* cmd) { command.scalar(&motor.voltage_limit, cmd); }

void setup() {

// driver config
// power supply voltage [V]
driver.voltage_power_supply = 12;
// limit the maximal dc voltage the driver can set
// as a protection measure for the low-resistance motors
// this value is fixed on startup
driver.voltage_limit = 6;
driver.init();
// link the motor and the driver
motor.linkDriver(&driver);

// limiting motor movements
// limit the voltage to be set to the motor
// start very low for high resistance motors
// currnet = resistance*voltage, so try to be well under 1Amp
motor.voltage_limit = 3; // [V]

// open loop control config
motor.controller = MotionControlType::velocity_openloop;

// init motor hardware
motor.init();

// add target command T
command.add(‘T’, doTarget, “target velocity”);
command.add(‘L’, doLimit, “voltage limit”);

Serial.begin(115200);
Serial.println(“Motor ready!”);
Serial.println(“Set target velocity [rad/s]”);
_delay(1000);
}

void loop() {

// open loop velocity movement
// using motor.voltage_limit and motor.velocity_limit
motor.move(target_velocity);

// user communication
command.run();
}

anyone, any thought?

Can you try disconnecting your IMU/gyro and the encoder, and see if it works?
I.e just the three wires for the BLDC should be connected. In open loop, you barely have to have anything configured for it to work correctly, so I think your setup should be fine.

Can you double check the motor is installed correctly (i.e. measure resistance from a pair of screw terminals) and that there are no breaks in the motor?

Thanks,
Matei

Hy @Aristospl, I would like to know if you solved your problem because I am trying to make a reaction wheel pendulum based on IM6050 sensor and struggling a lot to set it correctly.

If you found a way I would be interested to get an exemple of your code?

Thank you in advance,