Arduino Uno R3 can't handle all my servo's and Motors

Hi there folks.

I’m having a bit of a pickle with my little Arduino, I’ve got two servos attached to pin 9 and 10 and i have two motor controllers attached to pin 5 and 6 (I’m using the pins as variable voltages to drive the motor controller pots) pins 5, 6, 9 and 10 are all pwm pins.
If i run the codes for both servos and for both motors separate it works fine, but when i put them together to run simultaneously the motors drive erratically, almost like they are just getting a full 5 volts or 0(full speed or off)
I’ve read that when you run the servo.h library it shuts off the pwm for pins 9 and 10, but the servos are connected to those pins and work fine on their own? also the motors are connected to pins 5 and 6 not 9 or 10 so why would it limit them?
I’ve also heard that the Arduino mega doesn’t have that limiting factor, and if that is the case then i will just buy and use a mega. I just want to confirm this so i don’t waste time and money on something i don’t need!
All servos and motors are powered externally so they don’t use any current from the Arduino, it is only a signal in case some people think its reaching a maximum current draw.
I will upload the code if need be but at the moment i think its a wiring/capability problem.

Let me know you you all think

Thanks

Hi Iman,

If that board requires an analogue voltage for control, then you’re comment about “almost like they are just getting a full 5 volts or 0” is exactly what is happening. With raw PWM, it is switching between the HIGH and LOW logic levels quickly, while adjusting the duty cycle to change the high/low time ratio.

If your driver chip requires analogue input signals then you will need to filter your PWM signal to create that analogue voltage. For info on how to do this, take a look at our Digital to Analogue Conversion with Raspberry Pi article. Whilst the software side is Pi specific, the circuit to support it is quite generic.

A slightly better alternative to this might be to use a PWM driver which operates on a SPI or I2C bus such as this Adafruit one. This will give you more precise, digital control over it, plus save on a bunch of external components.

Hi Iman,

In addition to suggestions from @Sam, can you post your code here (as lean as you can get it) and include any details about the motor controller you are using (a link would be fine).

Also, tell us how you are powering the servo’s - are they being powered from the Arduino 5V rail or something else? A schematic would be awesome, or even a sketch (wiring can turn into a word salad pretty quick).