Hi
I am trying to drive 2 x 12 volts motors.
I need the motors to move independent of each other and controlled by a joystick.
ie Motor 1 is driving forward/backward, motor 2 is stationary or vice-versa
I have adapted code from dronebots and other places but these are for robot cars etc, where the motors move together to drive or steer.
Before I go further into this.
Is the L298N the right piece of equipment to use?
If not what can be utilised code or hardware.
Cheers
Hello,
You have not mentioned the type of your motor, I assume, that you have two DC motors.
Yes, L298 is capable of driving independently two DC motors.
See this pdf:
https://www.hestore.hu/prod_getfile.php?id=1355
Excerpt from the pdf:
"Fig 6 shows a bidirectional DC motor control Schematic Diagram for which only one bridge is needed."
L298 has 4 outputs, you have to use only 2 for one dc motor.
I do not know if L298 can provide enough current for your motors.
Péter
Hi Peter
Thanks for your reply
I am using 2 x 12v dc geared motors.
The L298 I have is being supplied 13.4 volts dc for the motors and is utlising the dc current to supply the 5vdc for the control circuit.
The sketch I have continues to try to drive both motors at once, either both forward/backward etc.
I was questioning whether the L298 is the correct hardware to allow the motors to be activated one at a time not both together
If the L298 is suitable then I will continue to work with the sketch to break down the instructions for individual motors.
Regards
Greg
Hi Greg,
Yes, it is capable. It can provide 2 amps (at maximum) per motor (probably with only appropriate cooling).
See the specs:
https://www.hestore.hu/prod_getfile.php?id=1355
Fig 6 shows, that you even can stop the motor when the inputs are equals or allow them free-running based on the ENABLE input.
There are two ENABLE pins of the L298N.
In other words: L298 is a dual H bridge and one H bridge is enough to control a DC motor.
See here what an H bridge is:
https://en.wikipedia.org/wiki/H-bridge
See here a built motor driver with L298 on ALiexpress (I have used similar ones in the past):
https://www.aliexpress.com/item/4000046656442.html
or a cheaper one (I also used these items, however, it can easily be burned without appropriate cooling if the motors are too big):
https://www.aliexpress.com/item/4000781763273.html
It lacks the motor enable inputs, but usable and very cheap.
Cheers
Péter