i am a complete newbie in electronics but i'm a bit familiar with C. i am building a machine that requires 5 little engines (12V 2.5in brushed CIM motors) & motor drivers (i need to adjust each motor's speed). i've got an arduino UNO which i think is too small to control that many motors. i would like to know if the setup i want was feasible to your opinion and which ardunio would i need to do that ? i guess an Arduino Mega ?

also, i came accross this tutorial : https://howtomechatronics.com/tutorials/arduino/arduino-dc-motor-control-tutorial-l298n-pwm-h-bridge/ it explains how to configure an arduino with a driver & two motors.

in fact i want to prepare the same kind of thing but with 5 motors that i can control independently.

which hardware would you recommend to do such a thing please ?

many thanks ! regards

  • Yes, with an UNO and a few of those L298 modules you should be able to control 5 motors independently, no problems. Try the tutorial you gave the URL for and you'll see how to use more than 1 motor driver.
    – MichaelT
    Nov 4, 2019 at 21:20
  • thanks. However i see that these drivers can control 2 engines, so i would need three of them. can i connect all three on a UNO ? will i have enough ports etc. ? also, isnt there a better solution (like having 1 driver that can control up to 5 engines ?)
    – olivierg
    Nov 5, 2019 at 19:34

1 Answer 1


You should have just enough I/O with UNO, so long as you don't want to connect any other hardware/sensors. Since this is unlikely, it would be better to use another board like Mega, but I'll provide solutions anyway in case you want to try them out:

  • Option 1: For 5 motors controlled with L298N boards you'll need 15 output pins, 5 of which should be PWM. Fortunately, there are 5 PWM outputs on the Arduino UNO on PORTB and PORTD. The remaining 10 outputs need only be digital (PORTB has 1 and PORTD has 5). You can use DDRC and PORTC commands to change function of the analog inputs labeled A0-A5, making them digital output, thereby gaining 6 more digital output pins for a total of 12 (more than the minimum 10 needed).
  • Option 2: It is possible to use other PWM motor drivers that reduce number of pins required. Examples are DRV8838 (link to supplier) and DRV8833 (link to supplier) where 2 wires are needed per motor channel. As a bonus, these drivers are also significantly more compact than L298N.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.