PWM calibration for TalonSRX via Arduino

Obviously this is not relevant to Legal motor control, but instead for making use of our TalonSRX motor controllers for an off season project. We want to control the TalonSRX with encoder feedback via Arduino Mega. We can make the motor move with PWM using the servo class but calibration always fails even with a full signal. We are following the guide from the manual but it blinks red every time and gives up. We are forcing full POS and NEG values and when I drive it normally with the factory calibration it’s only 5 “servo degrees” off. Is this good enough?

What’s the frequency of your signal? It says on the manual that the minimum is 10 hz with a max of roughly 350hz

So by default it seems like the Arduinos Servo PWM is around 450hz. This would make sense why it seems like I’m not getting a proper signal range. I’m gonna play around with this more, but as it stands I think you’re absolutely right about why the calibration is failing.

I do have control, just not the ability to calibrate my perfect middle, so if I can’t adjust this I guess the upside is with PID control this doesn’t really matter too much. Just keep adjusting the value until I achieve the desired RPM.

Thank you!

Can’t you use the writeMicroseconds method to use the values that work?

The values that the roborio uses are documented here: PWMTalonSRX (WPILib API 2023.4.3)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.