A2212/13t BLDC motor and problems

Hi everyone.

Im trying to use A2212/13t BLDC motor for test. Just bought in local store availiable motor for test.

I ordered pcb and soldered components myself.

When im trying to use velosity_magnetic-sensor sketch, motor starts make squeaky noise. At the same time L6234PD heats as hell.

Maybe my problem in this small bldc motor? Should i change something in code?

You should post your code here.

You may be asking too much from your l6234. That motor is 1000kv so probably has low resistance. I suspect you’ll be way over current limits, hence your heat. Can you measure winding resistance?
I think gimbal motors are recommended for the shield:

i use examples from simple foc lib

Yep, this motor have only 1 ohm resistance.

I’ve tried to use 12v line of ATX power supply. It starts to move, but after couple of seconds power supply goes in protection mode and turns off.

Maybe i could use resisters before motor phases? I know motor wont work normal, but just for testing.

Hey @Sok

Resistors won’t really work because you would need a really high current ones and it’s tricky to design these circuit right.

Here is a post from another discussion that can help you for testing. Try to run the example with limited voltage circuit. Try to limit the current under 1A to start with.

Cant get good data from sensor/can't turn the motor

So basically if your motor has 1ohm try to limit the voltage to 1V. Your motor will still have plenty of power, you’ll see. You can even limit it to 0.5V or so.

I understood my mistake with the motor. This shield works with motors which have ~10ohm resistance. So i will buy some gimbal motor in a local store and try to test it.

Now im confused because i ordered these motors from aliexpress to test them:

And it looks like they wont work with simple FOC shield. But they will work with boards which have DRV8301/DRV8302 driver.

I just watched your video and didnt notice that your shield works only with ~10ohm resistance motors. Can i ask you to add some warning in the description of the video about this? Just like: before ordering this shield, make sure your motors have ~10ohm resistance. Maybe im stupid and i needed to check all documentation before ordering components for this shield. But still, i can see the information about motors only in the description of simpleFOC library, which i honestly read only after i finished soldering all components.

Also maybe somebody can explain me why this L6234 fits only ~10ohm resistance motors. And why can DRV8301 move any of them?

The l6234 is unusual/amazing in that it can handle a fair amount of current 1A (up to peak of 5A if you can keep it cool enough) without external mosfets! Conceptually i think of the l6234 as drv8301 but with an additional 6 mosfets (3 half bridges) hidden inside the silicon. So to get the equivalent you’ll want a drv8301 + 6 external mosfets. Having external mosfets means they can be more easily cooled and rated differently/higher.
If you use a bench power supply (or were super careful without one) you’d probably be able to get your 1ohm motor to spin under no load but it’s torque would be 10% of its potental. I’ve run 1.3ohm motors with the shield.
Lets say i took your motor plugged it up to 12v power supply and set a current limit to 1A and used the simplefoc shield without being careful in software (i.e not setting voltage limit to 0.5 to 1V). If what you ask the motor to do e.g run at 300rpm requires 12v then using I=V/R you’ll be pulling 12/1 i.e 12A! (not sure if calc is quite that simple but it’s close).
How does the limiting bench powersupply help? It would gracefully ‘brown out’. The current would be limited to 1A but the supply voltage would fade to 1 or 2 volts. The l6234d would probably switch off (it needs about 6v to operate) but you wouldn’t have hurt the shield. So now you should go back to your software and put in equivalent software guards (voltage limit of 1 or 2v) and try again.
If you used a dumb power supply or battery, that l6234 would be facing a whole world of pain, 12Ax12v. I.e 144W. Remember how hot a 100w light bulb got? The l6234 has some protection, it might be ok but its a gamble.
I bought a 150W variable bench supply for less than $100 and it is awesome. I’ve got the 6 presets set for 3.3 , 5, 9,12,18, 24V and use it all the time

The documentation that came with the above was terrible. Lots of other 150W variable PSUs out there but i wanted the presets.

Thx for your explanations, @Owen_Williams.

I just bought small 2112 gimbal motor with ~20ohm resistance. And this motor act like the previous one. L6234 doesnt heats anymore, but motor still dont turn and makes squeaky noise. When i put power on arduino, motor turns to the left, then to the right, and after this it starts to make squeaky noise. When i put some velosity values, noise changes a bit.

First i thought that my power supply can be a problem. I just use 19V power supply from laptop with DC/DC stepdown LX9006. But nothing changed when i switched it on 18650 battery with 4V.

I tried to change PI, ramp_voltage values in code, but it didnt help.

Maybe this squeaky noise comes from high/low PWM frequency? But i cant find any values in code to change it.

Which magnetic sensor are you using? I2c or spi? How confident are you that the sensor reading is being read properly?

What i like to do is to start with ‘voltage mode’ and set voltage to zero (with motor.move(0) and then call motor.monitor() straight after. It’ll print out “voltage angle velocity” with each loop. Then manually rotate motor 360degees. I’d then expect to see angle (second column) to change to 2*PI. If it doesn’t then go back and look at your sensor setup. If it does then continue in voltage mode changing values in motor.move() from -2v to +2v and see if motor turns in both directions. The advantage of voltage mode is that it doesn’t use PI tuning so is easier to debug hardware/connection issues.
If all that works then it’s a problem with your tuning

I use AS5047D-ATSM magnetic sensor with spi. I checked it in magnetic_sensor_spi_example. My sensor really didnt work in voltage mode, because in sketch there is MagneticSensorSPI sensor = MagneticSensorSPI(10, 16384, 0x3FFF);

And in magnetic_sensor_spi_example its MagneticSensorSPI sensor = MagneticSensorSPI(10, 14, 0x3FFF);

I changed this value and sensor started to work in voltage mode. After rotating motor on 360 degrees, sensor shows ~6.3 points, which is close to 2*PI.

But it didnt help. Motor still doesnt rotate and makes this noise. I’ve noticed only one difference: when i slide my sensor away, motor starts to shake and it looks like it tries to rotate. When i align magnet with sensor back, noise comeback and rotor stay without moving.

And another observation: while initialization, motor turns to the left and right pretty normally. But after FOC algorithm starts to work, motor doesnt turn and makes this noise.

I really start to think that there is some problem with frequency in FOC algorithm.

P.S. all of this i did in voltage sketch(mode) and changed only motor.move() command.

Maybe problem could be in Arduino UNO from China? Like it works different and calculate another frequency or something.

Just a hunch but can you try flipping two of the motor wires around. This will cause the motor to swap direction. Motor and sensor direction need to be the same.

I tried to change wires, it didnt help.

I just had experiments with find_pole_pairs sketch. When i run it, motor should rotate slowly. Instead of this im getting moves from left to the right. It means my board making wrong signal and somewhere i made a mistake while soldering this.

I think you are very close to getting this working!

Before you check your soldering, howabout you try an open loop test. @Antun_Skuric has provided code here:
Cant get good data from sensor/can't turn the motor
Update: pole pairs is quite similar to the above code, it may behave the same!

Wow! Open loop code rotate motor!

So it means my board works fine? And problem could be in code or sensor?

Your motor is working. Might want to change openloop to move in opposite direction by changing:
target_angle -= 0.001;

After I would move back to find_pole_pairs. It should be working as the code is similar! We need to work out why its not working, it should at least spin.
Check that you’ve set the right supply
motor.voltage_power_supply = 12;

Are you using this version of the code:

Can you describe what you see physically happening to motor and what the output says on the Serial

Yeah, it changing direction.

find_pole_pairs doesnt work.

i’ve set right supply. its 12V

Yep, i use this sketch

My serial write something like this:

Estimated PP : -270
PP = Electrical angle / Encoder angle
687.55/-2.55 = -269.75

PP number cannot be negative

  • Try changing the search_voltage value or motor/sensor configuration.
    Pole pairs (PP) estimator

So, there is big difference between Electrical angle and Encoder angle

I can see how motor rotates on a very small angle and go back. It rotates 3 times if there is 3*M_PI value. After this it starts to make squeaky noise.

Hey @Sok ,

Thanks for the heads up for the library examples, I was not aware that I didn’t refactor the code well enough. I’ve updated the master branch examples.

If you are getting negative angle in each run, one of your problems can be that the motor and sensor orientation is inversed. That should be solved by inverting two motor wires for example, as @Owen_Williams already suggested.

But you have something else as a problem as well which we did not identify yet.
What is the MCU you are using?
What is the library version you are using?
Which pins are you using?

So you have two odd things there.

  1. your encoder angle is negative (opposite) to motor angle. On its own I’d say swap motor cables round, but you also have:
  2. A very small encode angle. I’m wondering whether your 14bit is correct. Some very similarly named encoders are 10, 11 or 12 bit.