Arduino digital servo qusetion :

hello!

i’m not good at english :sweat_smile: so… i ask for your understanding…

In the picture below, digital servo sounds bbi— and it turns down a little.

Are there problem with circuit or code?

and, are there difference between analog&digital servo code?

as i know it, servo motor can oprates at over-voltage battery

or is that problem with PWM? ㅠㅠ

servo : TS-621MG(4.8-6.0V)
battery 9V
arduino mega 2560

`#include <Servo.h>
Servo servomotor;
int pos = 0;

void setup() {
servomotor.attach(9);

void loop() {
for(pos = 0; pos < 180; pos++)
{
servomotor.write(pos);
delay(150);
}

for(pos = 180; pos > 0; pos–)
{
servomotor.write(pos);
delay(150);
}

servomotor.write(90);
delay(1000);
} `

You said that your servo’s operation limit between 4.8 and 6 volts but you are using your servo with 6 volts it may cause a problem.

1 Like

Can’t really read the specs of your 9V batteries but they are usually very poor to drive motors as they can’t supply lots of current in a sustainable way

1 Like

thanks for comment! how can i drop volatge with circuit part? what size of R(ohm)?

Those 9V batteries are completely unsatisfactory for powering servos, or the Arduino for that matter. They are designed to power low current devices such as smoke detectors and cannot supply the current required by servos for long

Consider using a series of AA batteries instead

1 Like

Greetings,
Can he/she use a 5v servo with a 9v battery?

1 Like

thanks for comment! how can i supply lots of current…? :sweat_smile:

thanks for comment! oh…AA batteries? I didn’t think of it at all. thank you!

It’s usually a bad idea to go outside the spec.
What will happen depends on the motor / servo control loop.

Dropping voltage by going through resistors is not great use of energy (heat dissipation) and you’ll limit the available current since U = R.I when the resistor is in series with the device consuming power.
Use a buck converter

Thanks for the answer.