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 (Overview | Adafruit 16-Channel PWM/Servo HAT & Bonnet for Raspberry Pi | Adafruit Learning System) 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.
#initialization
pwm.set_pwm(11,0,1500) #outputs stop to pwm output 11
time.sleep(3)
#control
val = converter(val) #converts val (joystick input) into values ranging from 1100 to 1900
print(val)
pwm.set_pwm(11, 0 val) #outputs val to motor on pwm output 11
Edit:
I used this code (replicating the arduino tutorial but on RPi) to test the ESC further:
pwm.set_pwm(11,0,1500) #stop
time.sleep(5)
while True:
pwm.set_pwm(11,0,1700)
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.