if (flag==0)
{
myservo.write(141);
delay(2000);
myservo.write(51);
delay(2000);
// flag=1;
}
else
{
myservo.detach();
delay(2000);
}
}
The code works perfectly when using a USB cable.
The problem is that I want to use an external power supply (a 10V battery)
When I try to run the code with the battery, the motor does shit, going one way, then the other, not as I'm asking in the code.....
PaulS:
Yes, when I didn't have things wired properly. How DID you wire the power supply and the servo to the Arduino?
Wow that's a quick answer !
the Servo is a 3 wired basic servo : 5V, GND, command.
5V is connected to the 5V of my Arduino
GND... well to the GND
the command wire is on the second PWM on my Arduino
For the Power Supply, I have attached a jack output to my battery. The jack is implemented in the Arduino Uno
PaulS:
The Arduino is not intended to power a servo. They suck way too much current.
That's why you got the 10V power supply. It is THAT wiring that matters.
The thing is that my project only requires one servo....
It works like a charm when I connect it on USB to my computer... So I guess the Arduino is able to provide enough current for one single servo
So what should I do? i'm kinda lost right here. I understand I shouldn't use the Arduino to supply current to the servo, so I should use my battery instead?
The battery is 10V, should I pick the 10V and lower it with some voltage divider? ( Only have resistors right here...)
The battery is 10V, should I pick the 10V and lower it with some voltage divider? ( Only have resistors right here...)
The servo won't like 10V, so, yes, you'll need to lower it. Think about HOW a voltage divider accomplishes that task, though. The excess voltage is wasted as heat. The amount of heat depends on the voltage drop AND the current flowing.
hi, I am very happy to come across this forum, as i have a similar problem... I am working on creating a six servo robotic arm controlled by the leap Motion sensor for my final year project. I am a total amateur to arduino and writing sketches, having problems in all areas including
interfacing the leap Motion sensor to my arduino uno.
connecting the six servo motor to the servo shield.
getting the right sketch to run the setup.
powering the servo.
thanks