Author Options:

how to initialize servo speed during startup using arduino? Answered

How do i initialize the speed of a servo during startup when using an arduino. I have noticed that when I attached my usb, my servo jumps to its default position at a very high rate of speed. How do I prevent this from happening?


Are we talking about a perfectly standard RC servo ? If we are, you can't change the "default speed" as it tries to find the position demanded on its inputs: they drive at top speed to there. Once the servo HAS homed, then you can increment the position command at whatever rate you want.

Thanks for the response steve. I think your right about that, coz no matter what I do, like even if I invoke servo.write command in arduino before I invoke attach statement to any of my servos it still goes to the default position at very high speed. I have been googling around to find any solutions but the most feasible one I saw was to put resistors to slow down the speed, but my question is will it make my speed constant, meaning I can't change it anymore in the arduino code? I use varspeed servo library by the way. Thanks again.

If its really critical, there are alternative servos which are programmable. What are you actually driving with the servo ?

I am just using a arduino/bluno, I guess the only way I could prevent it from happening is to position my bot such that all angles are as close as possible to default angle. But thanks for the tip on programmable servos, I'll try to check those out.

You can make your own servo, rather than rely on the off the shelf electronics. Use the position sensor on the servo, connect it to an analog in, and make a small amp to drive the motor from analog out. There is a code library for closing the control loop.

Now you can DEFINE how the motor moves perfectly.

By the way, just a question. If I make my own servo, how do I stop it on a position or make it hold its position?

That's what MAKES it a servo ! Your servo takes your desired position and makes it happen by measuring its current position and reducing the error to zero.

Wow, that would be my goal for a large bot. Anyway here is the video link on the status of the project.


2 years ago

You know programming, right ?

Here is the status of my project, just in case you would like to check it out.

Just a little bit. My program is written in visual basic, wherein I send serial commands to the arduino mcu and translate it from there where my servos move. I'm almost done with the project, but the only thing bugging me is the way the servos move at high speed to its defualt, 93 degrees position during start up. I have tried to invoke servo.write before the attach to pin statement but with no luck, still goes fast to default position. Someone has suggested to put resistors to slow down the speed, but do you think it would make the servo speed permanent, meaning that I can't change it anymore in anymore in the arduino code?

By checking the Arduino pages.
The libraries are well documented and forums actually offer support.
Of course there is alyways my good old friend Google, who is willing to answer many questions.