Custom driver board with DRV8305

See the board motor made by Dragor works very well! He did a great job! Feel very surprised, refer to his schematic diagram, draw a piece! Using the tle5102be1000 encoder, encoder ABZ can work normally, the program is the first version of Dragor code, but the motor did not respond, do not know what is the problem? The operation process is shown in the following figure. Please solve it! thank you!
0001|502x500


2 Likes

Oh WOW! you built your own version of the Janus Controller - Brushless Driver (Based on the DRV8305 and ESP32)

I’m glad you found everything useful :slight_smile:

I’m not sure I understand what is your problem. Is your encoder working properly but the motor did nothing? if so you might just have a voltageLimit too small. Your motor seems like a gimbal motor, you might be able to try with a voltageLimit of around 5V or higher. If this doesn’t work I’ll try to update the code since the library has been updated to fully support the ESP32 and a bunch of new features.

1 Like

I’m confused by your 5th parameter to BLDCMotor() - in my version of library this is the enable pin - but you’re passing a float value? it should be an integer?

Regards from Vienna,

Richard

This was an oooold version of the library where I implemented that fifth parameter to be the same as motor.voltage_sensor_align, this has since been changed.

@David_ Gonzalez

Your version is the best! Learn a lot from your post! Thank you very much.

I will draw your current MOS to the previous version, or a adapter board! Before the encoder works, the motor has no reaction at all. Now the problem is basically solved, and there is no good welding! I’ll try a new library again!

Just one question I don’t understand. The current feedback from ADC port. Why is the last one just 0?

@runger

about 5th parameter to BLDCMotor()

I understand this way because it is 6 mos, with 3ppwm, low MOS is directly activated!

I don’t know what I understand, right?

Give this code a try, this uses the most recent version of the library. Make sure you’re using the correct pins:

Replace line 129 with motor.initFOC();

If you’re using an Encoder with AB signals comment out lines 66 and 33, and un-comment lines 45, 46 and 69.

If you’re using an SPI magnetic encoder just make sure what CSn pin you’re using is correct.

Forget about this parameter, it won’t be used on the new version of the library.

My guess is you’re calling the wrong GPIO in your code or something is not soldered properly.

@David_ Gonzalez

Thank you very much!

I have time to test! Maybe it’s a welding problem!

@David_Gonzalez)

I tested your code and found that mot: not available! And the encoder is still not supported. I took a look at the manual of the Tle5012b encoder. There are still differences between the code and ma730 as5147, such as frequency, tle5012b is 1MHz, PPR is not detailed, and ma730 is 16mhz. It is estimated that the encoder will be abandoned temporarily. At present, it can’t work normally. Try as5047p if you have time!

I see what you mean. I see that the sensor you’re using has incremental signal. I would try what I suggested earlier with this new code:

Have you tried to spin your motor open loop? maybe this might be a step to do before trying closed-loop with position feedback.

@David_ Gonzalez

Open loop test OK! In order to work, to suspend a period of time! Thank you for knowing!

@feng

Great! This is a step in the right direction :slight_smile:

What do you mean by “suspend a period of time”?

@David_Gonzalez
I just don’t have time. I’m back now. I can do it!

@David_Gonzalez
Thank you for your guidance! Before mot: not available! The motor is like a vibration motor, I don’t know what the problem is! The original parameter is not set, right! Now the motor can be position controlled, uncomment“ Serial.println (e); ”If you can monitor the position of the encoder, there is a problem. For example, if I input 3, but the printed angle is 3.11, and then input 6, the motor will not move at this time. If you input 20, the printed angle is 20.00, and then input 3, you don’t need to move the motor by hand,… You have encountered similar problems before Questions? Please guide me! thank you!

Hey @feng

It sound to me that you have to tune the PI and P controller.
It would be of help if you could attach a video of your motor so I can see closer what’s happening.

1111
@David_Gonzalez
Thank you for your reply!

I’m sorry I didn’t reply you in time after I went out for a few days!

Try to adjust the parameters of PI and P, but the effect is not good。
The parameters are as follows:
float ki = 0.00012; //0.075;0.0015 0.0001
float ti = 25 ;//
float lpFilter = 0.00;//0.000
float kp = 25; //

float suppleVoltage=8;
float voltage_sensorVoltage=8;
float voltageRamp = 25;
float voltageLimit = 8;//0.4
float velocityLimit = 2000;//2000

Hey @feng,

I’m not sure I understand the problem. Will the motor sometimes move to the position you input and sometimes it won’t move?

@David_Gonzalez
Thanks a lot!
Your understanding is right. Sometimes the input position, the motor does not move, you need to help it by hand, occasionally the input position will reach the specified position according to the value. Sometimes I wonder if the PI control and P control do not match. Adjust the value when you are free, and try to see if it can be improved。

How big is the winding resistance of your motor? To me it looks like it wants to move but doesn’t have enough strength to start moving.

Are you sure everything is set up correctly?
Number of pole pairs, the encoder is working properly, the align voltage is strong enough, the voltage limit is big enough, your PID parameters are correct (I can’t help you here, the values will be very different depending on the motor and sensor).

Try to spin the motor in voltage mode and see how that goes. Change this line:

    motor.controller = ControlType::angle;

to

   motor.controller = ControlType::voltage;

Write the target voltage in the console and start from 0.1, 0.2, 0.3, etc until it starts moving. Then find a nice voltage where you can stop the rotor from moving and the current draw isn’t too big (if you can’t monitor the current draw, check the temperature of the FETs) this voltage will be your voltage limit and your sensor align voltage.

Check out the new firmware of the Dagor-Brushless-Controller/D021F022.ino at master · byDagor/Dagor-Brushless-Controller (github.com) if you wish to use SimpleFOC V2. Make sure you swap the ESP32’s pins to the correct ones on your board.

Hey@ David_Gonzalez

Thank you for your guidance!

I can’t find the fault of my board! No matter how the test, the most basic Open-loop test motor does not move! Maybe we need to weld a new plate and test it again!

Hi @feng - I’ve read through all the comments in this thread. It is difficult to understand what you are saying. Probably because english is not your first language.

Earlier - I thought you said that open loop was working but in your last post you say it isn’t working. Has openloop ever worked? What has changed?

Note that the initFOC() and loopFOC() functions are not required for open loop and are likely to result in openloop not working. I often forget to remove/add these functions when switching controlTypes.

Hopefully we can help you get results!!
Perhaps you can post your basic openloop code so we can see pins, etc.

Owen