BLDC clicking/ticking/cogging

Hello all! I have been lookin around for an answer to this problem but could not find anything that helped so I am making this post.

I just want to say now I am a total noob, I have never really worked with motors before so I am a bit lost. I have very limited tools so im not sure how much data I can get.

Context: I am working on a robot and needed motors. I have most of it built but I cant get any motion because of the problem. I have got cycloidal drives that give a 1:13 reduction for each motor. I plan on running this with a IK model on python.

The problem is using positional controls with this BLDC motor. It just the same with the gearbox and any with load. It works fine with velocity mode.

I am using two simpleFocs V1 with a Arduino uno.
The motor is a MN6007 KV160.
I have a 12V 20A psu.

I have used example code with some minor edits attached below.


#include <SimpleFOC.h>

// BLDC motor & driver instance
//BLDCMotor motor = BLDCMotor(11, 10.5, 120);
BLDCMotor motor = BLDCMotor(11, (0.227, 160));
//BLDCDriver3PWM driver = BLDCDriver3PWM(3, 5, 11, 7);
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 10, 6, 8);

// encoder instance
Encoder encoder = Encoder(3, 2, 2048);

// Interrupt routine intialisation
// channel A and B callbacks
void doA(){encoder.handleA();}
void doB(){encoder.handleB();}

// commander interface
Commander command = Commander(Serial);
void onMotor(char* cmd){ command.motor(&motor, cmd); }

void setup() {
  // initialize encoder sensor hardware
  encoder.init();
  encoder.enableInterrupts(doA, doB);
  // link the motor to the sensor
  //motor.linkSensor(&encoder);

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 12;
  
  // link driver
  motor.linkDriver(&driver);
  driver.init();

  // choose FOC modulation
  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
  // set control loop type to be used
  motor.controller = MotionControlType::angle_openloop;//_openloop

  // monitoring port
  Serial.begin(115200);
  // comment out if not needed
  motor.useMonitoring(Serial);

  // initialise motor
  motor.init();
  // align encoder and start FOC
  motor.initFOC();
  
  // define the motor id
  command.add('A', onMotor, "motor");

  // Run user commands to configure and the motor (find the full command list in docs.simplefoc.com)
  Serial.println(F("Motor commands sketch | Initial motion control > torque/voltage : target 2V."));

  _delay(1000);
}


void loop() {
  // iterative setting FOC phase voltage
  motor.loopFOC();

  // iterative function setting the outter loop target
  // velocity, position or voltage
  // if tatget not set in parameter uses motor.target variable
  motor.move();
  

  //Serial.print(encoder.getAngle());
  //Serial.print("\n");

  // user communication
  command.run();
}

Thanks a ton for your time!

Hi @WireMonkey,

It sounds like an exciting project! Motor control can be a bit hard at first, but once you get familiar with the equipment and jargon you will find it easy, and it is very rewarding. We’re here to help, so with a bit of patience I am sure you will achieve your goals!

The code you posted doesn’t look quite right:

  1. You have an encoder set up - is it working? If the encoder is working, then you should use MotionControlType::angle and not angle_openloop. Open loop modes are for when you don’t have a sensor.
  2. When using open-loop, you don’t call loopFOC() - just call move().
  3. When using closed-loop, you have to call loopFOC() and move(). So your code is a bit of a mix of open-loop and closed-loop modes.
  4. For a robot, you should probably use closed loop control. Open loop is appropriate only for light loads and situations that are not very dynamic. If the motor skips any commutation steps (due to stalling, heavy load, sudden load changes or other reasons), then in open-loop mode the controller has no idea about it. The position will simply be wrong from that point onwards. In closed-loop, the position is always maintained because of the encoder. Closed loop is also much more efficient, and can achieve higher torques.
  5. 20A is a lot more than the SimpleFOC V1 can handle, and the motor has low resistance of 0.2Ω. You should set driver.voltage_limit=1.0 or similar - 1V / 0.2Ω = 5A, which is the board’s limit. Maybe even a lower value would be better. Since the limit is so much lower than the power supply, it would actually be better to use a lower voltage PSU if you can. If you can run it at 5V or 6V, that would be closer to the limit you’re setting.
1 Like

The motor in the video has no encoder, I just used it to demonstrate the problem. The second motor does have AMT 103-V encoder and it does work, I have used the encoder example to test this.

I have applied the edits to the code for the open loop and I get a different result. Without the cycloidal drive the motor does run really smooth however with the cy-drive or any load it stalls and or vibrates.

As for the psu, what should I look for if I was to have many focs/drives? Say 4 to 8? I was going to use a Odrive however they are a bit out of the budget.

Also the help means a lot!

Seems to me the driver overcurrent / overtemperature protection kicks in and cuts the power mosfet section off, then waits a few milliseconds to reset and clear the warning, tries again, cuts out, etc.

As Richard said, you need a much more powerful driver and mcu to drive the motor. Cyclo drives are notoriously inefficient and you waste all the power to overcome the cyclo friction, and stall the system.

Look for a minimum of 30A continuous / 50A peak driver and a 60 MHz or better mcu.

You also need to upgrade your psu to a 12v/50A because the new driver will smoke you current one.

At that power levels you will need extra thick wires , forced cooling, etc.

1 Like

Yea that adds up, there was heat building up from the boards.

Are there are any drivers + MCUs in particular you would recommend?
Something like this right : SmartDriveDuo Smart Dual Channel 30A Motor Driver - RobotShop

I think I can rig up a basic cooling system. Would I be able to run on my current cables for short periods of time, say 5 minutes give or take?

That’s a DC brushed motor driver, you need a BLDC motor driver. I’ve never heard of the robotshop website, but looking into it, these are probably what you need:

However I have absolutely no idea if they would work with SimpleFOC, or what MCU is needed to drive them.

I cannot see the video you posted, it’s asking me for a google login.

For the MCU, you need a more modern 32 bit MCU.

Your cables need to be minimum 2mm diameter, I would suggest 3mm or better, with really good plugs or bolt boots. 12v/30A is pushing 400W, that’s a lot of power.

Please spend some time doing research, there are many posts on this board discussing drivers and MCUs to find out what you need. Read older posts, many others had the same questions as yours.

Cheers,
Valentine

I fully agree with Valentine’s analysis of the issue…

But I will say the following: it’s worth trying with closed-loop. It really is much better at producing torque under load, esp. at low speeds, so what is stalling now, might move under closed loop control.

Adding a heat-sink to the drivers can increase the effective current you can use, or increase the length of time you can run before over-heating.

Ultimately, for a motor with 0.2Ω resistance, current control will enable to use the motor better - right now you have to set a voltage limit to limit the current, but with current control (and current sensing) you could work at higher voltage and directly limit the current.

In terms of driver board availability, it’s awful right now.

Check the forum - there is a very recent thread here:

Perhaps @StefanH is prepared to share his design / share prototyping costs?
There is also @Valentine’s “HackJammer” and “Mosquito” designs, search them on this forum.
And there are several other designs you will find in the forum.

In terms of straight-out buying a driver, there are ODrive (but expensive, as you note). There is the B-G431B-ESC from ST-Micro, if you can get some. There are some models on AliExpress (search: SimpleFOC).
I don’t know what else to say at the moment… the semiconductor shortage has made it very difficult…

One thing you should ultimately consider is switching to a faster MCU. The ATMega (Arduino Uno) is only a 8-but MCU, and really a bit too slow for FOC motor control, especially if you want to do some comms and motion control tasks on the MCU as well… Something like a ST-Micro Nucleo 64 G474 board or Adafruit Metro M4 board can work with Arduino Framework and SimpleFOC, fits on the SimpleFOC shields, and has far more power…

2 Likes

I would be happy to include anyone interested in the prototyping run. For this very first run I’d be happy to just share the board costs evenly and find some way to ship it for a decent price to anyone interested.

1 Like

I might be able to chip in around the 25th. How much would I need to chip in?
Also btw epic board.

@WireMonkey

You also may want to try this thread, it could be helpful.

1 Like

Ok so I need to upgrade my MCU, install thicker cables, swap out my driver boards to one of the above and get a new PSU?

Also @Valentine love the board!

Im new to all this forum stuff so I just want to know if it would be worth opening a thread on my project? I see that there is a application category.

Just want to say again thanks for the quick responses and info.

Thank you. I’ve said this before, in the extreme case you cannot find a suitable driver, I already have some development very high power driver boards I have designed for myself that are availabe, if you are in US, it is possible to ship you one at cost, however, this is in the extreme case you exhaust all other options. I’m not really in the business of selling boards. Shipping outside US is not an option, it’s way too slow or expensive and takes me too much time, unless you are willing to pay.

Feel free to open a new thread, though this one is fine, too.

Cheers,
Valentine

1 Like

I bought a decent batch of ESP32-S3FN8 MCUs off Alibaba, seemingly the last in stock world-wide. I hope the supplier comes through, should know around the weekend. If they do I’ll get a final quote and place an order, so in a week roughly. Costs should be around $60-70 per board. Every extra board made will reduce that (PCB total amount for the order will only double going from 10 to 250 boards, for example). Do note that my board is a dual driver affair, meant to drive two motors, so you might have some unused parts if you only need one channel. Shouldn’t be an issue other than costs though. Or take Valentine up on his offer.

@WireMonkey

I have one fully integrated version of the v1.0 HackJammer for $72 which I can give it to you for $50 since it’s an older version, one v2.0 for $60, and one extra-high power stage driver only 40V/300A/1200A (no MCU) for $75. Mine are already manufactured, I only have to ship them.

Fully integrated means you don’t need an MCU, it’s fully plug-n-play like @StefanH except mine is using an STM MCU.

Shipping would be extra.

Whatever works for you, but see if you can work it out with others before me.

Cheers,
Valentine

PS mine are all with current sense.

Might be a problem there, I’m in the UK. Thanks for the offer though!

This is what I need in fact, right now I’m using two SimpleFocs V1.

Yes, shipping to UK is about $40, not sure it’s worth the money to ship a $60 board for $40.

Anyhow, if everything else fails, let me know.

Good luck with your project and please post pictures/videos of your progress for others to learn.

Cheers,
Valentine

1 Like

I will give this a try tomorrow. Will post the results asap.

Ok bit late on the test but yea no dice with the closed loop + encoder. Did see better movement with the c-drive however the load is still a problem. Gonna go with the upgrades when I have the money.