Advice on which pins to use

I am looking to use UNO R3, L298N Motor Driver and KY-040. I was wondering what pin selection would work best.
Would the same pin selection work on a Nano as well.
I would only be using one motor driver 'A' and one rotary encoder,
Thanks in advance.

My apology - I see that I have asked this previously.

What motor do You intend to use? L298N is a really old, stone age, driver that waists voltage and power. MOSFET drivers are better. In case of one way rotation a logic level N channel MOSFET is a better alternative.
To start make a sketch that runs the decoder.
Then make a sketch for the motor control, what ever it will be. Finally merge the experiences.

I have a number of L298N Motor Driver's so I have to use them.
My project is done - but looking at it I wonder if I could better it by using different pins on the UNO R3.

my current pin allocation is

L298 5,6,7 (ena in1 in2)
KY-040 2,3,4 (clk dt sw)

Those pins looks not good to me. D0 and D1 are used for both downloading code as well as the USB serial communication with the Pc, valuable in debugging.
Use D2 and/or D3for the encoder. Some decoders run on one interrupt capable pin, some might need 2 pins like that. When that works, almost all other pins are good for the motor control. Note which pins handle PWM if You want speed control.

Late here. I misread Your post. You're likely good with that. Note the PWM needs...

Thank you for that information
I will look into the PWM

The PWM capable pins of an UNO has a certain sign printed, like a wave...

Thank you should I use three one each for the driver.

You can PWM the En pin just conventional digital I/O for In3 resp. IN4. LOW + HIGH, or HIGH+LOW fir fwd resp. bwd.

Thank you kind Sir, we can consider this answered.

Sorry I didn't know the Nano and its pins, pin markings etc.... I'm an UNO guy...

No problem thanks for all your help
I am interested in knowing more about MOSFET.

Look for logic level N channel MOSFET. The gate source voltage for fully turned on is the key parameter. Switching the low side of loads using a serial gate resistor of some 180 Ohm and a gate to source resistor of some 10k they are both voltage and energy effective.

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