Servo Motor Position Control with potentiometer

hello
i have a project about position control. In my project, servo must turn 5 10 15 20 25 30 35 40 45 50 55 60 degrees. When Motor turns 5 degrees then coming 0 position (e.g 5 0 10 0 15 0) angels adjustment with pot. if you have similar example, can you share me?

thank you

I'm not 100% sure what you mean, but in any case, have you looked at this tutorial?

And what have you tried so far?

Firstly, i am sorry for bad english. i will use 10k pot and angle change by potentiometer. for example, digital value 200 and motor have to run 5 degree clockwise after this, motor must come first position (0 degree). it's my first project at arduino board. :smiley:

Well first of all try that knob tutorial... then think about how to get it back to 0 each time

your example tutorial http://arduino.cc/en/Tutorial/Knob is so basic. i used pic series for position control it's easy but i don't have an idea for turn back 0 position so i search example code

but i don't have an idea for turn back 0 position so i search example code

Generally you rotate the pot knob the opposite direction.

zoomkat:

but i don't have an idea for turn back 0 position so i search example code

Generally you rotate the pot knob the opposite direction.

Yeah but In think he means, once it's "parked" at the X degree position as dictated by the pot, it must go back to 0 by itself. That, of course, will leave the pot still sitting at the position calling for X degrees so not sure what OP expects to happen then.....

Then its better to use an encorder. But 1 work around that i could think of if he turn thr pot to 0 if every time he what to move the servo

yes i tried code and it's working good thanks but sometimes, there is a vibration on servo. How can i correct that? PID is useful for this mistake?

thank you for your answer :slight_smile:

sometimes, there is a vibration on servo

Does the servo have its own power supply or is it from the Arduino 5v? Lots of "funnies" go away when a servo has its own power.

power supply is coming from arduino board.( 5v)

Try it with its own power, it might make a difference.... see my pic attached

ilker58:
power supply is coming from arduino board.( 5v)

Bad!