Full speed for a Parallax CR servo powered by 5 V is typically a little over 50 RPM, so 50% speed would be about 25 RPM. We can use these numbers to calculate roughly how far the wheel should turn.
Keep in mind that 1.25 revolutions is an approximate value. It will vary with how fresh your batteries are, and even which direction the servo turns. So long as each servo turns somewhere in the 1.1 to 1.6 revolutions range, you’re in good shape.
As with the center signal from the previous activity, the brief high times still repeat every 20 ms. The difference is that for 50% of full speed counterclockwise, the brief high signals last for 1.55 ms instead of 1.50 ms. For clockwise, instead of the high times lasting 0.05 ms longer than the 1.50 ms center signal, they last 1.45 ms, which is 0.05 ms shorter.
This graph is called a transfer function. It shows typical servo speed vs. pulse duration. The pulse durations are in terms of μs (millionths of a second) instead of ms (thousandths of a second). So, instead of 1.5 ms, the graph shows 1500 μs.
- Find 50 on the x axis.
- Follow the vertical line up from on the x axis to where it intersects the graph.
- Imagine a level line from that point to the y axis. It should intersect just at a value of just over 25 RPM.
- Repeat this for x axis values of -200, -100, -75, -50, -25, 0, 25, 50, 75, 100, and 200.
- Make a list of y axis RPM speeds you’d expect for each x axis % of full speed value.
Those percent-of-full-speed x axis values actually describe how many microseconds above or below 1.5 ms each control pulse lasts. The graph shows the servo rotational velocity response in terms of RPM. The graph speeds do not exactly match % full speed, but it’s close enough to use as a way of thinking about how the numbers from -100 to 0 to 100 correspond result in certain servo speeds.
Now, let’s test the right wheel.
- Turn the SumoBot around so that you are viewing its right wheel. (It should still be face down on the table.)
- Change all the PIN settings from 27 to 26. Make sure to change all three!
- Click Load & Run (Save code to EEPROM) to load the program into your SumoBot.
- Verify that the left wheel rotates counterclockwise for 3 seconds, then clockwise for 3 seconds, and then stops.
- Optionally, press/release the SumoBot board’s reset (RST) button to start restart the program from the beginning and see the wheel motions again.
- Test one of the servos at different speeds: -200, -100, -75, -50, -25, 25, 50, 75, 100, and 200. Observe the wheel speed at each setting.
Each servo is unique. Even though 100 is approximately 100% of full speed, it varies from one servo to the next. A speed of 200 essentially ensures that the servo will turn at top speed.