www.servomagazine.com/index.php?/magazine/article/march2011_MrRoboto
the servo arm 60 degrees. You can then find the speed to
move a full circle (after you have performed the
“continuous rotation” surgery) or 360 degrees. I have given
the speeds the servos will move at 4.8V since that is closer
to the 5V that you might be powering the servos at. If you
want a faster speed, use 6V and they go about 20% faster.
To find the time it takes a servo to spin a full circle
(approximately), multiply the speed given above by 6 ( 6 x
60 = 360 degrees). This will give you seconds per rotation.
To find rotations per second, take the inverse of that. In
other words:
) 6 ( 1 / ∗ = speed Second Rotations
This is only half of your question, however. How fast
will your robot go? That depends on the diameter of your
wheel. Assuming that your servo is strong enough to move
your robot (which is ANOTHER topic), the speed of your
robot will be the Rotations per Second times your wheel
rollout. “What is wheel rollout?” you ask? Wheel rollout is
the distance travelled by a single rotation of your wheel.
This is the perimeter of the circle described by your wheel
which is:
d Dπ =
where D is the distance travelled (in the units you chose)
and d is the diameter of the wheel (in those same units).
Example: If we were to use a Lynxmotion “Sticky Servo
Tire” of 2. 75 inches diameter, then the wheel rollout will be
roughly 8. 64 inches. To put it all together then, we’ll use
this wheel with the Hitec HS311 hobby servo to get:
sec / 58. 7 ) 6 19. 0 ( 1 64. 8 in =× ×
most of us use about three speeds for our robots (off, slow,
fast), this should be all you need for controlling the speed
of your robot.
Q. I want to use a bend sensor to control the movement of a servo. I’m using an Arduino; how do I do that?
— RoboBob
A. RoboBob, reading a bend sensor on an Arduino has been done a few times; Google for some of them. It is basically just reading a resistor divider and the
details of setting up the ADC registers.
I think that I’ll approach this question on a broader
scale. You want to control a servo using a bend sensor
(always a fun project). A servo shows the jitter created by
an imperfect world through that bend sensor pretty easily.
Let’s do a little more here and show you how to create a
basic sliding window filter for your sensor that will really
help reduce that jitter.
I have a project that I’ve been wanting to start for a
while now that will do well to illustrate this concept. I’m
going to hack an ancient Nintendo Power Glove to use as
an R/C car controller for my son. I doubt that I’m inventing
a better mousetrap, but it sure will look cool. The Power
Glove has bend sensors in it already so I’ve got what I need
to get started. I’ve measured these sensors, and they range
between 70K and 400K ohms while bending. Reading the
ATMEGA328 datasheet, we see that the ideal input
impedance is 10K or less. But, since this is a slowly
changing signal and I don’t need great precision I’ll punch
ahead anyway and see how it works.
To handle this project, I’ll just use the Arduino Pro 328
from our first question, since I already have it on the
bench! I’ll use a bend sensor from my Power Glove and a
which is a comfortable table top
speed. If you want to go faster,
use a faster servo, bigger
wheels (within reason), or
higher voltage (also within
reason).
Listing 1: Input a new filter value.
void FilterInput(int in)
/*
put in a new reading
*/
{int n;
if (((in - bendFilter.res) > bendFilter.jmp) ||
((bendFilter.res - in) > bendFilter.jmp)) {
bendFilter.n = 0; // clear and start over
}if (bendFilter.n == FSIZE) {
for (n=0; n<FSIZE-1; n++) {
bendFilter.window[n] = bendFilter.window[n+1];// Slide the window
}
bendFilter.window[FSIZE-1] = in;
}
else {
bendFilter.window[bendFilter.n] = in; // Fill array
bendFilter.n++;}
}
SERVO 03.2011 15