Hi, first of all thank you so much for creating SimpleFOC. We started from zero and learned a lot from the resources provided, as well as from this forum. And we are still learning…
Our application is for knee exoskeleton for post-operation rehab. There will be times where the motor needs to lift the leg (angle mode) or the patient moves the leg independently (torque mode). Thus, backdrivability and the ability to change from mode to mode is important. Initially, we just use a small BLDC motor to get used to simplefoc, learn the codes to change in between modes etc. and we successfully did that. Our hardware: Arduino Mega + DRV8301 + AS5600 Magnetic encoder.
Then we bought a harmonic drive with custom-made motor from China, because we thought harmonic drive can increase the torque and able to be back-driven, suitable for our case. The harmonic drive has 1:50 reduction ratio. So with the new motor, we know we need to re-calibrate, finding PID and whatnot. This is where we faced the problem. The motor gets very hot, and draws 10A current in open-loop. Here is the video:
This is the motor spec (i tried to attach file but new user can only upload one):
rated voltage: 24V, rated current: 8A, rated peak current: 20A, rated power: 135W, no. of poles: 6
This is our code:
#include <SimpleFOC.h>
#define INH_A 9
#define INH_B 10
#define INH_C 11
#define EN_GATE 8
#define M_PWM 6
#define M_OC 5
#define OC_ADJ 7
BLDCMotor motor = BLDCMotor(5);
BLDCDriver3PWM driver = BLDCDriver3PWM(INH_A, INH_B, INH_C, EN_GATE);
MagneticSensorI2C sensor = MagneticSensorI2C(0x36, 12, 0x0E, 4);
float target = 10.0;
void serialloop() {
static String received_chars;
while (Serial.available()) {
char inChar = (char)Serial.read();
received_chars += inChar;
if (inChar == '\n') {
target = received_chars.toFloat();
Serial.print("Target = ");
Serial.println(target);
received_chars = "";
}
}
}
void setup() {
Serial.begin(115200);
delay(1000);
sensor.init();
pinMode(M_OC, OUTPUT);
digitalWrite(M_OC, LOW);
pinMode(M_PWM, OUTPUT);
digitalWrite(M_PWM, HIGH);
pinMode(OC_ADJ, OUTPUT);
digitalWrite(OC_ADJ, HIGH);
driver.voltage_power_supply = 18;
driver.init();
motor.linkDriver(&driver);
motor.voltage_limit = 5;
motor.velocity_limit = 100;
motor.voltage_sensor_align = 1;
motor.linkSensor(&sensor);
motor.torque_controller = TorqueControlType::voltage;
motor.controller = MotionControlType::torque;
motor.useMonitoring(Serial);
motor.init();
motor.initFOC();
Serial.println("setup");
}
void loop() {
serialloop();
motor.loopFOC();
motor.move(target);
motor.monitor();
}
Also, we’re really disappointed to know that the harmonic drive has really high backdrive torque… the user won’t be able to move the leg independently. so we cannot use it for our knee exoskeleton =(… If anyone can suggest a better gear suitable for our case, that would be wonderful. Thanks in advance!