2025-12-11 8:12 AM
Hello,
I apologise in advance if my post lacks any important information, I am very new to working with these sorts of boards and have limited experience with motor control in general.
I am using a B-G431-ESC1 to drive a 24V hoverboard motor. I have profiled the motor and uploaded the firmware to it and it runs just fine on the motor pilot with FOC speed control. I had also used the potentiometer on the ESC to change the speed without issue.
I wanted to switch to using PWM signals to control the speed of the motor, and reuploaded the firmware to the board with the potentiometer option disabled and the Electronic Speed Control option enabled for the stage configuration.
Using an ESP32 I generate a 490Hz PWM signal and first send 1060us pulses to the ESC (verified with an oscilloscope). I then send a new PWM to the ESC where the signal is high for 1850us.
My expectation was that the initial 1060us PWM would arm the driver, and then the 1850us PWM would command the ESC to drive the motor close to its maximum speed, but the motor does not move. The motor does stiffen a little and is harder to rotate by hand, and if i do rotate it by hand quickly it sometimes continues to move at a constant speed. I have also connected the ESC to the esp whilst the ESC was connected to a motor pilot on a laptop, and the motor switches from "IDLE" to "RUN" as the esp sends the PWM signal.
I am writing here for some advice on what I must change to allow the PWM signal to work as I expected, with a variable PWM being able to control the speed of the motor. I would be very appreciative of any help that anyone may provide me :)
Many thanks.
motor workbench: Version: 6.4.1 Build: 250722.154358
STM32 cubeIDE: Version 2.0.0
STM32 cubeMX: Version 6.16.0
Solved! Go to Solution.
2025-12-16 7:11 AM
Hello,
Ah I see. I have it set up now with the STO-PLL as the main sensor and hall as auxiliary.
I made some changes that have ultimately allowed me to achieve the ESC control I was aiming for:
2025-12-11 10:17 AM - edited 2025-12-11 10:18 AM
I am not sure if it is Hall sensor based or sensor less. If it is hall sensor then proper placement angle is required. Apart from that the PWM signal what you are providing looks fine. The below diagram is from the user manual.
Maybe you can try disabling UART in case it is loading the CPU, it is just a guess.
2025-12-12 12:19 AM
Hello @rudyard,
Refer to application note for the ESC signal description.
Using the B-G431B-ESC1 board with MCSDK 6.4.1, ESC behaves as expected.
2025-12-12 4:23 AM
Hello,
Thank you for your reply :)
It is hall sensor based and I had the sensorless (Observer + PLL) as an auxiliary sensor, not sure if theres much difference to it but I figured it wouldn't hurt (maybe im wrong).
I had neglected to properly consider the hall sensor values, as I was unsure how to actually check these values. There is no datasheet I could find for this motor, but I believe it comes from a zimx HB1 hoverboard. Previously I had kept the default values of 120 for the "sensor displacement" and 300 for the "displacement electrical angle".
Not the most scientific method, but I tried different combinations of 120 and 60 for those respective values, and all but one combination caused an immediate speed feedback error, which was 120 and 60 for the "sensor displacement" and "displacement electrical angle" respectively.
It is now moving a lot faster and with a lot more torque.
In fact, it's stuck at its maximum speed and doesn't respond to changes to the speed reference in the motor pilot.
Adjusting the PI divisors slows down how quickly it reaches the maximum speed but doesn't actually make it respond to new speed references. This is without the use of the esp32, for now I am just using the potentiometer and the motor pilot UI.
2025-12-12 4:31 AM
Hello,
thank you for your reply :)
Are you referring to the note under figure 15 in the manual? I had thought that my signals were as the manual instructed, if a 1060us signal arms it with a minimum speed and then other signals within the 1060us to 1860us range adjust speed.
Apologies if that is not what you meant or if I have missed something in this section.
2025-12-12 4:56 AM
It is hall sensor based and I had the sensorless (Observer + PLL) as an auxiliary sensor, not sure if there much difference to it but I figured it wouldn't hurt (maybe im wrong).
Yes it will not be a problem. (I have never used though)
For profiling of the motor and hall sensor you can use the motor profiler software. There is documentation available of how to use the profiler in the MCSDK.
2025-12-12 5:16 AM
Hello @rudyard,
As mentioned in the "1. Features" chapter of the application note: Full reference design for electronic speed controller capable of both sensorless FOC and 6-step algorithm.
Try with the main sensor set to STO-PLL.
2025-12-12 5:40 AM
I tried just now to use the motor profiler for the hall sensors but the voltage dropped to around 4V repeatedly and the motor began making very loud sounds including a loud tone that raised in pitch. The lab technician where I am working is concerned and has asked me to sort out why that's happening before I continue.
However, when I switched to using the sensorless as the main sensor as @GMA had suggested and ran it in the regular pilot instead of the profiler, it worked a lot better, with the speed properly responding to input signals and being harder to stall by hand.
Would I be able to figure out the hall sensor displacement values another way? On the actual motor they appear to be about 60 degrees apart, and I counted 30 coils around the motor, which I had took to be 15 pole pairs.
2025-12-12 6:16 AM
Hello @rudyard,
It is not clear what you intend to do: profiling, electronic speed controller, or speed sensing with a sensor.
The electronic speed controller (ESC) is not compatible with the Profiler tool or speed sensing with a sensor.
The "pole pair" should be mentioned in the motor's datasheet. If not, a pole pair detection feature is available in the Profiler tool:
The sensor displacement value must be included in the motor datasheet. The placement electrical angle will be calculated using the Motor Profiler tool.
Refer to the Motor Profiler application note and the Hall sensor feedback processing chapters available through Workbench tool > About > Documentations > Documentation > User manual for more details.
2025-12-12 11:33 AM
Hello,
ah yes, sorry for being vague.
The end goal is to achieve electronic speed control of the motor. To achieve that, I wanted to use the hall sensors that come with this motor for feedback, and I wished to profile the hall sensors to ensure the firmware was configured correctly and able to provide accurate feedback to the FOC loop. I had looked into the hall sensors as @STuser2 had mentioned proper hall sensor placement was required and reminded me that I had neglected to do that, and because I had previously tried to run the motor with just the sensorless algorithm and had some issues.
I have been unable to find a spec sheet for this motor, I believe it comes from a zimx hoverboard, but the only manual I have found associated with that hoverboard is not very detailed and does not include information like the pole pairs and the hall sensor angles, etc...
I completely missed the option to detect pole pairs, so thank you.
I have attached a picture of the motor with some labels of the parts of it as I understand.
I know the transistors are transistors as I have looked up the component accoriding to the labels on them and I find a transistor. I believe the hall sensors are what I have labelled due to the wires they are connected to, as I have probed the points where they connect to the board in the motor with the wire connections using a multimeter. I counted 30 coils on the magnet, so I believed there to be 15 pole pairs. Also using that, there seems to be about 5 coils between the two hall sensors I labelled, so 360 * 5 / 30 = 60 degrees. Not sure if that actually tracks but just thought Id share my thinking in case it reveals another mistake on my end.
I unfortunately do not have access to the motor at the moment so it will be a few days before I can work on it again.
I thank you both for your help so far :)