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