Doorlock.. Proplem with the servo motor

delete it or make it 9,min,max....which one ?

I covered that in post #9.

ok i wiil try

If you do change that line to
myservo.attach(9);
You get 90° travel from the servo. Tested.

tested on the new code?

Please answer that question.

Yes, with the only change being to the servo attach function in setup().

iam powering the servo from the 5v pin in the arduino

it is know working and the angle increased but still i want to in crease it more

void ServoClose()
{
    myservo.write(0);  
}

void ServoOpen()
{
    myservo.write(90);  
}

Think about it. You can't go lower than 0 so you will have to increase the 90.

I am surprised that that has not caused you problems. The Arduino is not a power supply. Power the servo with a power source that is capable of at least 1A at the rated servo voltage. A 4 AA cell battery pack (6V) works well. Or a cell phone charger that is rated 5V @ 1A (minimum) will work.

Ok i will try increasing the 90...

Now about the power suppliy can you explain more..... Do i need to power the servo with an external 5v power supply? If it is yes... Then it will keep moving because it is not affected to the arduino

No. The power will be supplied by the external power supply whilst the control will still be supplied by the Arduino

How

How is that unclear? I have said so at least twice.

The control signal is still coming from the Arduino. Connect the ecternal supply + to the servo +, connect the external supply ground to the servo ground and the Arduino ground and the servo signal pin to pin 9 of the Arduino.

Because the data line for the servo will be connected to the Arduino as it is now and the common GND connections of the Arduino and servo will provide a reference against which the control signal can be measured to control the servo

So ground of the servo + ground of the power supply all in the ground of the arduino?

And it need 5v power right?

Yes, the grounds all connect together.

What is the servo rated for? Usually 4.8V to 6V so 5V will be fine as long as the 5V will supply the required current.

here is an image showing the connection

Ok i will try this and i will try increasing the 90

I really appreciate your help :heart: