Servo control

Hey everyone. I connected a servo motor to a breadboard and I power the breadboard with a breadboard power supply(5V) and the Arduino with the USB cable. Everything was ok in the beginning but now even if I write an empty loop the servo goes to 93 degrees. Does this mean that I managed to burn my Arduino somehow?

PS:I grounded arduino to the breadboard power supply GND.

Many of the tutorials show powering servos from the arduino. This is wrong. The 5v from the arduino should not be used to drive motors. Put your servo on its own power supply and give it common grounds.

First of all thanks for the reply :slight_smile:
I did not power the servo with the arduino.I powered it with a breadboard power supply and the ground was common.

You need to post the program you are using and you need to make a simple drawing showing all the connections and post a photo of the drawing.

...R

Hi Arduino community.

I have a servo (model:MG90S) and when I run my arduino code and connect it to power(5V) it goes to 92 "degrees". Does anyone know why this is happening? How can I stop it from going to that position? I tried to find questions like this one but it seems like I'm the only one struggling with this topic.

If you have 'attached' the servo object, then you are sending the servo a signal. If you want it to go to a particular position, write that value. If you do not write a position, the default of 1500 (or 90 degrees) is used.

edit - how are you determining the degrees?

What do you mean determining? How do I know that the degrees it goes to are 92? If I understood your question correctly I use the read() function. I type: myservo.read();

I know how to get it where I want. But when I give to the servo power it goes to 92 degrees and it goes straight to it. It doesn't go smoothly. My project is a robotic arm with 3 servos and every single one of them goes to 92 degrees which is not pretty and is bad for my construction. Any advice on how I could stop it from going to 92 degrees?

Thanks for the reply :)

Try this. Write to the servo before you attach. If it works the way I expect it to, it will them move to the position that you told it rather than the default position of 1500.

If I write myservo.write(degrees); outside of my void_loop(){} I get an error.As soon as it enters the loop it always tries to move the servo at 92 degrees. Even if I write at the top of the loop myservo.write(0); it will still try to reach 92 degrees but it will move to 0 degrees before it manages to go to 92 degrees.

Do all servos work like that? Do they go to 92 degrees when they start or is it just the model of my Servo? This is really tricky, isn't it?

outside of my void_loop(){}

it may surprise you, but we can't see your "void_loop(){} "(whatever it may be)

It may surprise you as well, but even if my loop is this:

void loop(){
}

...my servo will still go to 92 degrees. Irony is not appreciated. I believe that won't suprise you.Thanks for the answer though.

Private69: It may surprise you as well, but even if my loop is this:

Stop wasting everyone's time and just post the complete program.

...R

#include <Servo.h>

Servo Base_Servo;

void setup() {
    Base_Servo.attach(5);
}
void loop() {
}

I am trying to explain that even when I run the program that I just posted the servo goes to 92 degrees. All I’m asking is if there is a way to prevent this from happening. It doesn’t matter if the loop is empty or it has anything inside it. I run the program with empty loop and with code inside it and the result is the same. It goes to 92 degrees.

I am powering my servo with MB102 Breadboard Power Supply Module 3.3V/5V. I don't know if it has anything to do with it.

This is what I was suggesting.
I picked 1100 as the desired starting position, as opposed to the default starting position of 1500.

#include <Servo.h>

Servo Base_Servo;

void setup() {
  Base_Servo.writeMicroseconds(1100);
  Base_Servo.attach(5);
}
void loop() {
}