Going to jaycar to get some ferrites and a large capacitor to put across the power of the servo. Hopefully this will work, otherwise I'm stuffed
BH72:
If there is no shield involved then TS has 12 broken servos, a power issue, or a cooked MEGA because the code above allows for nothing except the 90 degree position to be set...
I don't suspect a cooked mega because everything else works, and it also has the problem on both my arduino unos
I bought a mini servo for testing purposes, however I'm not at home at the moment so I can't test it.
I'll update you guys to tell you if it works. I'm hoping this new servo doesn't have the same issue because otherwise I know it's a servo issue...
Something that is missing so far is the code you loaded on the arduino to operate the servos. How about posting the complete code using code tags.
zoomkat:
Something that is missing so far is the code you loaded on the arduino to operate the servos. How about posting the complete code using code tags.
Will do when I get home
I used zoomkat's serial servo code:
//zoomkat 7-30-10 serial servo test
//type servo position 0 to 180 in serial monitor
// Powering a servo from the arduino usually *DOES NOT WORK*.
String readString;
#include <Servo.h>
Servo myservo; // create servo object to control a servo
void setup() {
Serial.begin(9600);
myservo.attach(9);
Serial.println("servo-test"); // so I can keep track of what is loaded
}
void loop() {
while (Serial.available()) {
char c = Serial.read(); //gets one byte from serial buffer
readString += c; //makes the String readString
delay(2); //slow looping to allow buffer to fill with next character
}
if (readString.length() >0) {
Serial.println(readString); //so you can see the captured String
int n = readString.toInt(); //convert readString into a number
Serial.println(n); //so you can see the integer
myservo.write(n);
readString="";
}
}
with a new mini servo and the same problem is occuring.
except the arm moves slower because the servo is a slower servo.
same problem, I dunno.
pls halp meh
K, so we've narrowed the problem down to either Arduino or connection, that's for sure. definitely not a servo problem because the exact same thin happens with other, more expensive servos. I tested it with a GWServo Mini STD / Mini BB and the same problem occurs
Try disconnecting everything but the 6V battery and the servo.
Isaac96:
Try disconnecting everything but the 6V battery and the servo.
nothing but the servo, arduino and 6v battery have been here the whole time
Update: even my arduino Unos cant control one servo via serial.
Does the uno work with the code I posted earlier?
BH72:
Does the uno work with the code I posted earlier?
nope. exactly the same as the mega
Is your battery OK? Measure the voltage while the servo is running.
Isaac96:
Is your battery OK? Measure the voltage while the servo is running.
while servo is running, it moves between 4.6-5.5 volts
Recheck the servo wire connections. The servo has three wires with the general colors of 1) black/brown which is the ground wire, 2) red/orange which is the center power wire, and 3) yellow/white which is the signal wire. Make sure they are connected like the attached pix. It is getting down to you have most likely have miswired the servo, or you do not have a proper ground between the arduino, battery, and servo. Also, in the code I posted the number received by the arduino is sent back to the serial monitor. Do you see the sent value returned to the serial monitor?
zoomkat:
Something that is missing so far is the code you loaded on the arduino to operate the servos. How about posting the complete code using code tags.
Well zk somewhere up in that thread he said that at my suggestion he did a sketch with nothing but servo.attach() and the problem showed itself... Seems it gives the problem with knob from the IDE examples.
@OP did you try the sketch someone posted earlier which didn't use the servo library but used a "longhand" method of pulsing the servo with digitalWrite() and delayMicrosecond()?
zoomkat:
Recheck the servo wire connections. The servo has three wires with the general colors of 1) black/brown which is the ground wire, 2) red/orange which is the center power wire, and 3) yellow/white which is the signal wire. Make sure they are connected like the attached pix. It is getting down to you have most likely have miswired the servo, or you do not have a proper ground between the arduino, battery, and servo. Also, in the code I posted the number received by the arduino is sent back to the serial monitor. Do you see the sent value returned to the serial monitor?
you're gonna tire that file out zoomkat...
but yes, it is wired correctly. even my father, an electrician, sees no fault.
by now i should state my entire project:
I'm building a 1:1 scale humanoid robot for a school science fair. it recieves a voltage from flex sensors and the arduino maps that from around 500-600 to 0-180
the arduino then sends that data to the robot which sets the servos to that position. 8 servos are needed to be controlled at once.
also, would it work if i detached the servo like this:
#include <Servo.h>
int flex = 0;
Servo myservo;
void setup() {
}
void loop() {
flex = analogRead(A0);
myservo.attach(9);
myservo.write(constrain(map(flex, 500, 600, 0, 180), 0, 180));
myservo.detach();
}
yeah Jimbo i tried that method. it bounced between approx 90 degrees slowly getting smaller, like, the first time it would go 90 degrees to 0, then 85 to 0, then 60 to 0 then try to go past 0
yeah Jimbo i tried that method
All I can think of is to suggest you move heaven and earth to get your hands on a 'scope for an hour... maybe your Dad's work or one of his colleagues has one. Or your school (nothing in the lab?), or one of the faculty?
You need to verify the pulse is being sent correctly, as in the 'scope trace I posted earlier (Reply #24).
JimboZA:
You need to verify the pulse is being sent correctly,(Reply #24).
actually, I think it is. the GWServo is working well now... really hope this isn't a servo issue.. i dotn want to have to get new servos
ShadowGaming:
actually, I think it is. the GWServo is working well now
Is that the servo you bought for testing, reply #44?