2

I am currently working on a robotics project that requires 16 PWM outputs to control 16 servos. Is it possible to use Arduino Uno's digital pins as PWM output pins through code?

If it is not possible, what microcontrollers do you suggest to use on such a project?

asked Jan 29, 2018 at 14:29
2
  • 6
    "The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega." Commented Jan 29, 2018 at 14:32
  • 3
    You can get a PCA9685 servo controller card to multiplex 16 servos through I2C. e.g.: adafruit.com/product/815 Commented Jan 29, 2018 at 14:35

2 Answers 2

2

Only specific Digital Pins marked with ~PWM can generate a PWM signal. In the case of arduino Uno the pins 3,5,6,9,10,11 are all hardware PWM driven, and are marked on the Uno with a ~ or something. Others can be driven with software PWM(though I wouldn't recommend it). As the Arduino Uno uses the ATMEGA328P, the number of pins is same with other boards using same processor.

On the other hand if you want to run 16pins for PWM, its best if you use Arduino MEGA 2560 because its processor supports more than 6 Hardware pins for PWM. Also you get the advantage of a higher memory storage for your code

answered Feb 9, 2018 at 3:18
0

PWM is not used to control servos. Servos need a pulse that is 1 to 2 ms wide, with 1.5 ms wide being the center position, that occur every 20 ms (50 Hz).

A 2560 has enough timers and the library to control up to 48 servos.

Edgar Bonet
45.1k4 gold badges42 silver badges81 bronze badges
answered Feb 7, 2018 at 22:26
1
  • 1
    It is a form of PWM, though not the PWM generated by analogWrite(). Commented Feb 8, 2018 at 8:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.