PDA

View Full Version : [Discussion] Servo won't turn while accepting commands from an Arduino



ArtyTrost
08-25-2017, 01:47 PM
Hello everyone,


In my first post, I'm asking for your advice -


I'm attempting to turn a servo with my Arduino when it gets orders from a serial contribution, for this situation, my console. I have officially done this with engines and it works fine however when I attempt with my servo it doesn't move by any means. (an example from - http://www.powerjackmotion.com/product-category/electric-motor/servo-motor-range/ ) So far I have this written -


#include <SoftwareServo.h>
SoftwareServo myservo;
int movemotor;
void setup() {
Serial.begin(9600);
myservo.attach (10);
myservo.write(90);
}
void loop() {
movemotor = Serial.read();
if (movemotor = 111) {
for (int pos = 90; pos >=0; pos--) {
myservo.write(pos);
delay(15);
}
}
else if (movemotor = 99) {
for (int pos = 90; pos <= 180; pos++) {
myservo.write(pos);
delay(15);
}
}
}

I'm powering the servo remotely with a 9-volt battery and have made a point to associate its ground to that of the Arduino, however, can't see whatever else I fouled up.
Any better idea would be greatly appreciated.
Thanks in advance

jwatte
08-25-2017, 09:36 PM
I'm powering the servo remotely with a 9-volt battery

9-volt batteries are bad for two reasons:

1) The voltage 9V is way too high for what most RC servos expect. Most servos expect something in the 4.8V-6.0V (4S-5S NiMH) range, and "high voltage" RC servos can expect 6.8V-8.0V (expected to run on 2S LiPo.) There is some chance that hooking up a battery that's too high voltage can destroy the electronics of the servo.

2) The current available from a 9V battery is very low -- these are not strong batteries. Thus, if the servo is not a "micro" servo, the battery may not be able to source enough current to actually move the servo.

Another thing I have to ask -- did you hook ground from the Arduino to the black servo wire and the battery - terminal? If not, the servo will not see the voltage differential for the control signal from the Arduino.

ArtyTrost
08-26-2017, 05:24 AM
Hello Jwatte, Thanks for your reply and helping me.

So, How many volt batteries I have to use for this.

No, I didn't hook ground from the Arduino to the black servo wire and the battery terminal.

jwatte
08-26-2017, 02:49 PM
So, How many volt batteries I have to use for this.

I don't know! WHat does your servo need? What servo is it?


I didn't hook ground from the Arduino to the black servo wire and the battery terminal

If there is not a shared ground between Arduino, servo, and battery, then the signals from Arduino won't make it to the servo. Electrical signals always need two wires (typically, "signal" and "ground.")

ArtyTrost
10-21-2017, 09:23 AM
Thanks to all for helping me. A few days ago I got my solution. I have to change my battery.