So I have two different continuous servo motors, a HSR-1425CR and a Parallax continuous rotation.
I am trying to get just one to work with my arduino pro mini, but no matter what size of pulse I give them, or whre I set the pot on the Parallax, they only spin in one direction. I have tried any pulse size from 0.8 ms to 5.5 ms, mostly trying around the 1.5ms range, but still it spins only in one direction. I have powered the servo with a 9v battery through a 5v voltage regulator, and am sending the pulse with a peak to peak voltage of about 5v from the microcontroller.
I have programed the arduino to output the following:
for (int i = 0; i<=200; i++)
{
digitialWrite(servopin, HIGH);
delay(1.25);
digitalWrite(servopin, LOW);
delay(18.75);
}
which should turn it one direction,
for (int i = 0; i<=200; i++)
{
digitialWrite(servopin, HIGH);
delay(1.5);
digitalWrite(servopin, LOW);
delay(18.5);
}
which should not spin it, and
for (int i = 0; i<=200; i++)
{
digitialWrite(servopin, HIGH);
delay(1.75);
digitalWrite(servopin, LOW);
delay(18.25);
}
which should spin it the opposite direction.
but it just spins one way at a constant speed for all three.
I think that I would probably take some time and establish that the digitalWrite() function will really change the state of the pin you are trying to change, and that the delay() function is actually accurate and provides the amount of delay yopu have requested. the simplest way I can think of to do both tasks would be to connect an LED to the pin you have driving the servo and write a loop that sets the pin high for 500ms and low for 500ms. then count the number of times the LED flashes in say 1 minute’s time to see if you are really getting 500ms delays.
I connected the microcontroller to an oscilloscope, and it is outputting the correct voltage and siginals (if I request 1.5 ms high and 18.5 ms low, I get that). But still the servo only turns in the one direction. I have tried to vary the duty cycle, but it always just turns in one direction at a constant speed.
the arduino microcontroller is a pro mini - I dont see a specific part number or anything.
if it looks correct on a scope then I’d probably go for another servo to eliminate the possibility the servo didn’t get modified correctly. a replacement servo to test with doesn’t have to be continuous rotation though, a normal servo should go for the 0 degree position at 1.5ms pulse in 20ms frame. another way to test the servo would be to put it in a standard r/c receiver and see if you can control it’s operation from a radio.
Just a hunch, but try checking to see if the ground is connected from the board to the servo. If the ground is not making a good connection then weird things can happen…
acutally yeah that was the issue…I was powering the microcontroller from a 9v battery, and the servo by a second 9v…so I created a common ground (connecting the two negitive sides of the batteries) and it works perfectly.
Thanks!!!