|
Programming tips Limiting the Voltage From Your Speed Controllers Sometimes it is impractical to run a separate 12v or 18v battery for the drive motors when the main supply is 24v. One easy way around this is to limit the output of the speed controllers to your drive motors. If you're using an IFI Robot Controller you can limit the maximum (full forward) and minimum (full reverse) pwm outputs to your speed conrollers.The input from the joystick is converted to a digital number that ranges from 0 to 255. When the joystick is in the middle position, the value is at 127. Normally the output to your speed controllers is equal to the input from your joystick. So the speed controller sees 0 as full reverse, 127 as neutral, and 255 as full forward. If we can limit these numbers to values that stay closer to 127, we can limit the current that the speed controller outputs to the motor. First get the default code from IFI. Then declare a constant for the limits. Place the following line of code near the top of the program, just before the variables section: LIMIT CON 80 Then add the following lines just before the "SEROUT" command. PWM1 = PWM1 MIN LIMIT MAX (255-LIMIT) Now upload your program, run the robot with the wheels off the ground, and measure the voltage at the motors when the joysticks are full forward or full reverse. If you need to increase or decrease the voltage, just go back and change the constant "LIMIT" from 80 to another number. Tweak this limit until you have good driveability while keeping your motors cool. |
| Back |