2020-03-05 02:36 AM
Hi,
I am using the NUCLEO-F302R8 and X-NUCLEO-IHM08M1 to drive a BLDC motor with hall sensors (placed 120 degrees apart) and incremental encoders (1024 per revolution). I have noticed that MCWB allows the option to use both the sensors, but when I go to generate the project it complains about he pin being the same which I have solved simply by using different pins for the encoders. Now the issue is that they both use the same timer (TIM2) and there is no option that allows to use different timer for either of the sensors.
I am aiming to control the motor at very low speeds, this is not possible by using hall sensors only as the motor stops with a feedback error at speeds lower than 1000 RPM. If I try using only the incremental encoders the motor doesn't spin at all, the motor draws a significant amount of current but the rotor is just locked.
Is there anyone who had the same or similar problem and possible had found a solution to it?I'd appreciate any help.
Kind Regards
Manpreet
2020-03-26 12:52 PM
2020-03-27 02:01 AM
Hi Jouko,
Thanks for your reply. I have read the content you suggested but I has overcome that issue already, My filter had a 10k ohm resistor with a 10pF capacitor which I increased to 1nF and the hall sensors started working as the noise was cleared. Increasing the capacitor further causes a distortion in the signal that's why I have stopped the capacitor value at 1nF. I am able to spin the motor with hall sensors but not at speeds lower than 800/100 RPM, I have noticed that the PID values affect this as well so I have tried tuning the PID values and achieved a good rotation as low as 700 RPM. Because I am developing this for a robotics project I require it to have a good torque control at lower speeds as well, now my understanding is that incremental sensors should help to smooth this rotation so I was trying to get both of the sensors working.
In the link you have suggested me you mentioned that you successfully achieved the rotation with hall sensors, at what speed do you drive the motor? and what PID values are you using? I have attached mine.
Thanks again for your reply, appreciate you effort.
Kind Regards
Manpreet
2020-03-27 10:08 AM
I can run my motor around 50-100 RPM up to 800RPM. My bus voltage of 70 volts voltage limits the high RPM range. It's a big motor and has 23 pole pairs so the hall sensor gets readings quite often per revolution. What kind of motor are you using? I remember having read (not sure though) that MC software by default has capability to extend the HALL sensor pulse reading to ~150ms interval. It automatically changes scalers to better resolution when RPM increases. So if you have a motor which gives only one pulse per revolution to hall sensor, you still could run the motor with rotational speed > 1/150ms = 6.6 1/s = 400 1/min = 400 RPM
Sure you HALL sensors give more pulses per revolution than one?
"incremental encoders (1024 per revolution)"
=> If you have such a high resolution encoder, you should use it.. I don't know how to configure it as I don't have inc. encoder.
I run the motor in torque mode. It's more reasonable as I plan to use it in EBike solution. My PID Gains are Kp=2000 and Ki=1000 and Iq/Id PID Gains are Kp=2120 and Ki=900 but you have different motor so these won't probably help you at all.
Did you try the motor profiler? There's available profiler configuration for you boards. If you haven't tried the profiler, go for it. It gives a starting set of parameters for your motor configuration.
Good luck.
2020-03-27 10:28 AM
Hi,
I have got a maxon 48V 7pole pair 1.18A nominal speed 6300 RPM. I have tried the motor profiler and the value I get from there are don't work that good. I have just received the NUCLEO-F072RB board which is meant use both of the sensors. But obviously my life can't be so simple as the new board doesn't seem to work. I have generated a project and everytime it fails on the SystemClock_Config(); function. I have then tried to generate the simplest project possible using cubeMX and the same happens with that, then I thought the new board might be faulty so I ordered another one which does the same thing. All this is just making me crazy, any suggestion?
Thanks your your reply! looking forward to hearing from you 🙂
Kind regards
Manpreet
2020-03-27 11:01 AM
Really? You have the latest MCWB version 5.4.3? Do you make things as suggested? First open the MCWB, and take the closest example project and save it somewhere else. For your case probably "NUCLEO-F303RE + IHM08M1 + Shimano motor, 3 shunt, sensorless" is the best one to start with.
Change you CPU to F302RB. Do your homework comparing the NUCLEO schematic with F303. Verify oscillator setups (and what they actually are at the board) Connect the motor phases to evaluation baord. Check manual for correct jumpers etc.
At first leave the project unconfigured at "Speed sensing" -> sensorless mode. Because then you just need pin config for the PWM. HALL/Encoder cannot mess it up yet.
Work out some reasonable setup for your motor, at least Pole pairs. Hopefully you can measure Rs, Ls and get some rational values for them? The profiler does reasonably good work here..
=> Generate code. I have G431 and before it did not have support in CubeIDE. I had to use SW4STM32 compiler. But after MCWB 5.4.3, it succesfully creates project for CubeIDE too. BTW: make sure you have the latest versions of MCWB, Cube and the compiler you are using (STM32CubeIDE?)
Make sure it compiles. It definitely should not crash at clock config function..
Try to start your motor. It probably fails, and then you have to tune the Start-up parameters at MCWB "Firmware Drive management".
Thats something I struggled within.
2020-03-30 10:33 AM
Hi,
I just don't think the NUCLEO-F072RB is meant to be used for motor control. I bought the NUCLEO-F303RE and this works fine with hall sensors but eventhough it has pins available for incremental sensors the firmware doesn't seem to like it. If I use hall sensors as main feedback sensor and incremental sensors as auxiliary sensor the firmware is generated by the MCWB but the build fails with the following error.
Therefore I assumed incremental sensors must be the main sensor and hall sensors to backup if needed. This way the build is completed successfully but when I try starting the motor nothing happens (no current used) . If I use the incremental sensor as the ONLY feedback sensor the motor only makes noise without achieving any rotation and it draws a lot of current.
Can you suggest anything?
Kind Regards
Manpreet Singh
2020-03-31 08:35 AM
Hi,
I have managed to solve the issue. I have created a project with incremental encoders and reduced the length of cables and turned off the unecessary electronic equipment nearby. Doing this reduced the amount of noise, and the motor started rotating but not properly and to optimise the rotation I have tuned the PID controller for the speed. I can now drive my motor at 300 RPM and keep a really good torque control, I am confident that if I need to drive the motor any slower I would only need to fine tune the PIDs.
Thanks for your help, appreciate your effort in trying.
Kind Regards
Manpreet Singh
2020-05-04 01:44 AM
Hello,
let me add basic question related to this. Is there an example how to chainge from main position sensor (like hall sensors) to auxiliary sensor (like e.g. observer) during operation?
Thanks
2021-06-27 11:01 PM
The question has been moved from the "Motor Control Hardware" section to the "STM32 Motor Control" section (the question is about the STM32 MC SDK).
Best regards