Mentors: poking around the VEX Forum is a good thing if you have the time. Even a little bit here and there is helpful to build up your knowledge base. Surf away – read something that’s relevant to your team, and follow links that users offer to other threads; you will expand your understanding, and hence your team’s understanding, tremendously. That’s how I learned about this term, “slew rate.” Turns out all the cool kids are doing it.
VEX Motor “Circuit Breakers”
When your program turns on a motor from a standstill up to full power (in autonomous, or via a joystick/button), a large spike of current is travelling to the motor to try to make that happen all at once. So?
Well, the circuit-breaker that’s inside the VEX 2-wire motor is a combination thermostat & resistor called a PTC (Positive Temperature Coefficient) component. The photo at right shows the actual DC motor that’s inside the black-and-green VEX motor we’re used to seeing; this is what’s actually driving your robot, and if you have an old broken motor, you can keep taking the insides apart until you reach this item and see it for yourself. The PTC is the little yellow tab on top of the motor in the photo at right. Current flows through it on the way to the motor, and heats the PTC as it does. If the heat generated exceeds the heat lost to the surrounding environment, the PTC doo-dad keeps heating up, causing its resistance to increase, which in turn causes MORE heating. As you can see, this creates a vicious cycle. Less current and less voltage make their way through to the motor itself. (Description courtesy of the awesome jpearman on the VEX Forum.)
The PTC is actually a safety device that prevents the motor itself from overheating and becoming damaged. Once the PTC exceeds a certain temperature, it breaks the circuit/stops the flow of electricity into the motor, and the motor stops working. When the PTC cools sufficiently, it will re-connect the circuit, once again allowing current to flow to the motor.
Here’s the major downsides to tripping the PTCs:
- Once it’s tripped, your motor is completely out of commission for at least 3-5 seconds.
- After that 3-5 seconds, the motor is HIGHLY susceptible to tripping again, because it has not completely cooled back to its room-temperature state. So in the middle of a match, you can only use the affected motor in a reduced way, probably for the remainder of the match.
- The PTC doesn’t fully cool to its room-temperature state, and the motor doesn’t return to full-capacity for over 30 MINUTES! Here’s the results from the jpearman thread linked above (paraphrased).
Testing a brand-new, never-been-tripped PTC component only (not attached to a VEX motor) with a 4 amp current:.
- Brand new: 59 seconds to trip at 4 amps
- After a 1-minute resting time, 29 seconds to trip it again
- 5-minute rest time, 40 seconds to trip
- 30 minutes rest time, 42 seconds to trip
Once you trip that PTC, even after you wait a HALF HOUR, the component still does not have the capacity that it did before the first test, tripping after 42 seconds of use instead of running for almost a full minute. Think about being at a competition, and how much time your team has between matches, and what they do with the robot in between matches (practice field, testing in the pits, skills challenge). There’s probably no time of the day except for the lunch break where the robot is sitting unused for a half hour. What this means for competition robots is that you DO NOT want to trip these babies.
So, how to do that?
Use a Slew Rate Controller in Your Programming
When you want your motors to turn on at full power (or if they are under heavy load), you can modify your programming so that instead of just setting, say, motor5 = 127 power, you get from 0 to 127 power in measured increments so that the current flowing through the PTC is nice and steady, and does not create any spikes. The current increasing quickly without the motor moving is what’s the killer here, and what you’re trying to avoid. This programming method, called “slew rate,” also happens to be gentler on your motor’s internal gears, so you should expect to see some better performance and maybe some longer life from them too.
In the “while you’re at it” category, you don’t have to only use this slew rate controller only when you’re going from 0 to 127 power; you can do it for all motor powers, and on your joystick controls too. This functionality gets set up in your program as user functions with a repeating timer (easyC) or as a background task (RobotC), so once it’s set up, its not really any extra work to use it instead of a standard motor block all over the place.
The entire VEX community bows down, once again, to the feet of the rockstar jpearman, who has written and posted code on the VEX Forum for how to do this in easyC (amazing!); it starts at about the 7th or 8th comment down the page linked here, and you can read all of the code right there in the post, and don’t need to download a zip file just to see what it’s supposed to do. jpearman, the VEX world owes you many debts of gratitude, but this is easyC manna from heaven.
jpearman also has RobotC code thoroughly explained, with a file available to download at the bottom of the post. The VEXMEN team then has a helpful explanation on their website on exactly how to implement jpearman’s RobotC code into a competition program.
It’s not magic
All that said, the slew rate controller is not magic, and doesn’t download any fairy dust into your cortex. It cannot make up for an inferior robot design, or a a lovely design that is just underpowered. VEX motors are puny, and no amount of magic-unicorn programming will make them give more than they’ve got. This magic-unicorn programming WILL, however, help you get the most you can out of those puny VEX motors, but sadly no more.
No Time Like the Present!
For novice teams, adding this functionality does mean that your programming group will need to spend a bit of time on this and will need some mentor assistance; it will be well worth it if your robot doesn’t stall in the middle of matches! And once you get this working this season, you can use it indefinitely in seasons to come. Your programmers will be taking the next (giant) step beyond dragging-and-dropping motor modules and joystick blocks. I’d also add that now (April) is a great time to start your programming team on this new project, because (a) no one is in a rush right now, (b) you probably have a complete, functional robot sitting in your lab available for use, and (c) there are probably not any other people also clamoring to use said robot, which cannot be said for any time in competition season.
We will be switching to RobotC for whatever comes after Starstruck, and we will be on that steep learning curve to the RobotC sky (with me about 3 steps up the escalator from my kids), and we will definitely be implementing slew rate control in all of our programming going forward.