Struggling to make it work


I am struggling to make the position control code work on my motor.
I have followed the position example, but I am currently using a BLDC motor from not the recommended one. Please find the datasheet here

Regarding the encoder, I am using the one from the tutorial - [AMT 103 encoder]

The motor and encoder objects are as follows.
BLDCMotor motor = BLDCMotor(9, 10, 11, 4);
Encoder encoder = Encoder(2, 3, 2048);

I have tried with both 12V and 24V power supply with no success.

When I upload the code on the arduino uno and initialise an angle, the motor does not move at all. However, I can read encoder values properly. Any recommendation would be more than appreciated.
Many thanks.

Best regards,

Are you using the simplefoc shield from the shop? If so, have you checked the solder pads?

It comes with default conductive ink across some of the pads. Can’t remember if they match the values you have put in your bldcmotor constructor.

Might be worth providing your code

I’m a little confused by your motor. It looks like a stepper motor which usually has 4 cables. We tend to use a 3 phase bldc motors.
The simplefoc library doesn’t currently support 2 phase motors but perhaps it could!

Hey @Evangelos ,

I am not sure if you using the SimpleFOCShield but in this code:

You need to provide the enable pin of the shield either 7 or 8. This can be the reason why nothing happens :smiley:

I’ve looked at the data sheet. Apologies. Yep they are 3 phase. These motors have very low resistance (from 1.28ohm to 0.3 ohm depending on size). I wouldn’t recommend using the shield with this motor unless you have a powersupply where you can limit current to <1.5A

Thank you all for your help, advice and quick responses. I am currently using the L6234 breakout with an Arduino, but looking at the FOC shield documentation I can see it is not rated for this motor winding resistance.

You can try to follow the voltage limiting approach described in this discussion:

It will maybe give you a way to at least spin the motor and test the basic functionalities.

Make sure to limit the current under 1Amp to start with. Check the motor resistance R and set the voltage limit:

voltage_max = 1*R; // 1 Amp * Phase resistance

Then just use the sketch from the post and change the limit values to the voltage_max