Connecting 6 DC N20 motors with encoders to Arduino UNO

I am working on a project that requires 6 6v Dc motors to run independently. These motors have attached encoders, motor link here:

I am using L298n motors drivers to control 2 motors each. At the moment I am still testing the idea so only have 1 motor and 1 motor driver. My concern is that using just 1 motor is already using up 5 digital pins on my UNO. The 5 being used are displayed below.

L298N to Arduino:
EnA > Pin 9
In1 > Pin 8
In2 > Pin 7

Encoder to Arduino:
C1 > Pin 3
C2 > Pin 2
(C1 & C2 are where the encoder data is outputted)

The issue I see is that I read that the encoder outputs (C1 & C2) need to be connected to pins 2 and 3 as they are interrupt pins. However I’m not sure if I am using them as interrupt pins as I haven’t stated that they are interrupt pins in the code and the motor is working perfectly and providing all necessary data from the encoder.

Basically I am asking whether I have enough pins to attach 5 more motors with the same setup to my Arduino? I don’t care about the motors speed so PWM isn’t relevant I just need the encoder information and for the motor to change directions. Is there a better way of wiring it up? E.g connecting all motor driver ENA&B pins together? If I don’t have enough pins then do I need a second Arduino or a MEGA?

I am new to all of this so any help would be amazing! Let me know if you need any more information.

Thanks,
Ben

I do not do well with word problems. It is best to post an annotated schematic showing how you have wired it, including all power, ground, and power supplies. Remember we cannot see what you have and probably speak different language and/or dialect. is (C1 & C2) capacitors?

The Arduino Uno does not have enough pins or processor power to handle 6 motors and 6 encoders. Two motors with encoders might be a reasonable expectation.

The Pro Mini and the Classic Nano have the same capabilities as the Uno in a much smaller package, and it would make sense to use three or more of them for your project.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.