Home        Store        Docs        Blog

Basic ESC Control Issues


I am working on a DIY ROV. I had written the code to control my ESCs around the old basic esc, but because BR no longer carries them, I had to use the new ones. Because I am using a servo PWM controller (https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi/overview) to control them, the stop signal is 390, max forward is 619 and max reverse is 160 for the old ESC. The new ones have the same stop signal but they reset as soon as they hit 225 or 580 pwm. I have to then resend a stop signal for them to work again. I would settle for this, but because the PWM controller only uses integer values I would lose a lot of precision.
If I try to use the new ESCs with 1500 as the stop, they initialize with 1500 and then move for a few seconds and beep repeatedly as soon as I give them a value apart from 1500. They then will not respond to new values inputted. (I think it is the same issue as Thrusters moving without command but with RPI not arduino) Is this a coding bug, a flaw in the pwm controller or ESC?
Also, on the old ESC, a stop value would just deactivate the motor and let the motor spin until it stopped. On the new ESC a stop value will engage the magnets on the motor, causing it to violently jerk when it is instantly forced to stop. I am worried this jerking will harm the motor or my ROV. Can I change this to be like the old ESC?

Note: my python code is very long so I will not be able to show all of it, here is the initialization and output sections. The rest is the other motors controls and button inputs.

pwm.set_pwm(11,0,1500) #outputs stop to pwm output 11

val = converter(val) #converts val (joystick input) into values ranging from 1100 to 1900
pwm.set_pwm(11, 0 val) #outputs val to motor on pwm output 11

I used this code (replicating the arduino tutorial but on RPi) to test the ESC further:
pwm.set_pwm(11,0,1500) #stop
while True:

The esc beeped low then high pitched a few times then the motor spun slowly for a few seconds. after that it did nothing.
When I ran the program again, it just beeped low then high pitched with variable times between repeatedly.

(Jacob) #2

Can you make a video showing what happens when you run this code? It sounds like the pwm output is not stable, a logic analyzer (10$ on ebay) will help to diagnose the situation (and many more in your future, invest!). The new escs have regenerative braking, this can not be turned off. You can slow the motors down in software by ramping down the control signal over some period of time.


I could not upload the video, but this is what the esc does.

  • I run the program
  • 1 second later the ESC beeps low pitched
  • 1 second later the ESC beeps high pitched
  • about a half of a second later it beeps low again
  • 1 second later it beeps high again
  • 1 second later it beeps low, and then does nothing

The ESC goes through the exact same beep cycle when it has gone over 580 using 390 as the stop.

This is the exact code I ran. Maybe the Frequency is off?