a newbie would like to use a servo

Hello,
I received my arduino board a week ago and i also have a servo motor nearby. Now i really would like to start playing with all of this but i don't really know how to start.
I've found there http://wiring.org.co/reference/electronics/servo.html a schematic for using a servo with the wiring board and there http://wiring.org.co/learning/examples/driving_servo.html some code to rotate the motor.
Can i use this code with the arduino IDE ? or what should i modify ?

Best regards,

JeanJacques :slight_smile:

I've found this http://www.tigoe.net/pcomp/code/archives/arduino/000741.shtml but i'm not sure how to plug the servo to the arduino board is there somone who has already made some schemtaics for this ?

best regards,

JJ

hi,

(just take the wiring from wiring and the code from arduino)

as i understand, a standard servo motor has three pins.

-> Vdd (power)
-> Ground
-> control pulse

the easiest way (READ THE NOTE AT THE END) would be to connect Vdd to 5V out on arduino and ground to ground. (assuming that your servo is ok with 5V. check the manual! )

-> now your servo gets power but will not move yet. you will have to send "pulses" to it, which tell motor in which direction it should move.

so the third pin (control pulses) from your servo goes to a digital out of your arduino. lets call it servoPin, like in the code.

a pulse means a signal which is determined by its length. between pulses there is a small pause (20ms in the code example).

let's say pulses(power HIGH) are dashes (-) and pauses(power LOW) are dots(.):

if you pulse .-.-.-.-.-.-.-.-.-.- your servo motor will move to the left.

if you pulse .----.----.----.----.----.----. on servoPin your motor will turn to the right.

if you pulse .----.----.----.-.-.-.-.-.-.-. your servo will first move to right and then to left.

it's a quite simple concept: short pulse->left , long pulse->right

the exact timing depends on your servo.

NOTE:

motors tend to draw a lot of current just before starting to move. YOU SHOULD NOT take the Power directly from arduino, since this behaviour could interfere with the internal computing on your board.
you can do so for testing purposes on your own risk as i don't think that this could do much harm to the board. you just can't be sure that it will work properly.

if you're taking power from an external source, just make sure that both grounds (arduino and external source) are both connected to your motor.

and as always: someone please correct me if i'm wrong :slight_smile:

best, kuk