The basic Electronic Speed Controller with only PWM input for speed control and 3 phase output connected to BLDC motor has no Hall effect sensor feedback input from the motor. The feedback tells which state the motor is in to the esc and esc is adjusting speed. This is called closed loop control. Some of BLDC motors has another 5 cables and these cables are for this sensor (VCC, GND, A, B, C). We don’t have any special cables so feedback for now.
When we send full throtle to the ESC, it starts to change phases very quickly as it should but this is not very effiecient if the motor is stopped. We should increate the speed in smaller steps so the ESC will be shooting phases slower and we will get higher torque so the motor will have more force to start rotating.
How to limit this acceleration while you are hitting full throtle on the controller?
- Use pulseIn(pin, HIGH, timeout = 5000) that returns microseconds.
- This value is in range 1000 to 2000 microseconds as a standard esc/servo pwm control.
- Let’s use servo.writeMicroseconds(value) for output
- Set constant variable CHANGE_IN_ONE_LOOP to 10 for example.
- Let have variable currentMicros initialized to 1000 as minimum of pwm.
- Assume a loop function with 100 milliseconds delay.
- At the begin of the loop, read pulseIn value.
- Get delta value as pulseIn – currentMicros which will be positive or negative if accelerating or deccelerating.
- Set currentMicros to currentMicros + delta * CHANGE….LOOP and write it via servo function
This is an example of implementation. It could be definitelly done better.