Go Down

Topic: How many servos with one Arduino (Read 1 time) previous topic - next topic

Brean

Hi,

how many servo motors can I control with only one arduino board?
I've seen there is one PWM but are there some more PINs I can use to send out a PWM signal
(I am planning to build a small robot who has 8 servos)

Grumpy_Mike

You do not use PWM to control a servo, you use the servo library, this will allow you to have 12 servo signals.

johnwasser

http://arduino.cc/en/Reference/Servo

"The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins. On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12."
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

DuaneB

I also have two libraries that will get you 18 servos using 18 pins or 20 servos using just two pins.

Have a look for serial servos here - rcarduino.blogspot.com

Duane B

Brean

cool, thank you all very much! I am still quite new to the electronics-part of this, so how do I find out, which PINs I can use/where can I find a detailed documentation of the PIN assignment?
The curcuit in the Arduino sweep example only uses PIN 9.
I also want to use a JY-MCU Arduino Bluetooth Wireless Serial Port Module, which will need some PINs (I do not know which ones)

johnwasser

You can hang a servo off any of the 20 data pins (D0-13,A0-5).

Pins 0 and 1 are the hardware serial port so they are usually best left for serial I/O.

Pins 2 and 3 are external interrupt pins that are sometimes useful.

Pins 10, 11, 12, and 13 are the SPI interface used for the Ethernet Shield and other SPI devices.

Pins A4 and A5 are the I2C interface used for other devices.

Of course if you use analog inputs you can't use those same pins for servo outputs.

For eight servos I'd use pins 2 through 9 if I didn't need interrupts or 4 through 11 if I needed interrupts and not SPI. Or 4-9 and A0-1 if I needed both interrupts and SPI.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

MarkT


cool, thank you all very much! I am still quite new to the electronics-part of this, so how do I find out, which PINs I can use/where can I find a detailed documentation of the PIN assignment?


The datasheet for the actual chip is the source of all this information, but the Arduino source code summarises some
of this in the comments.  Remember you have the source code, read it and learn!
[ I won't respond to messages, use the forum please ]

Brean


Go Up