Hey I am new here, I am not that great with arduino.
I am trying to control two motors with the L298N Dual H-Bridge Motor Driver. It doesn't seen to work.
Here's how I connected it.
Pins 7,6,3 and 2 of the arduino are connected to IN1,IN2,IN3 and IN4 respectively.
I got one motor connecting each side of the motor driver. I got one battery supply(8*AA), the positive side is connected to vcc and the ground is connected to GND. I also connected the GND of the arduino to the GND of the motor driver.
When I run the program. Nothing happens. I might be missing something or doing something silly
PS making the IN pins all high in fact applies the brake. You need to make the pair for a motor high / low or low / high for it to turn in each direction.
Hi Mazzz,
Setting all the pins HIGH does NOT make the motors work?? you need one pin HIGH the other LOW, the other motor needs the pins connected in reverse to this so one motor spins CW and the other CCW (as it's on the other side of the chassis). Also as Jimbo says you have'ent done anything with the ENABLE inputs these usually need to be set HIGH to ENABLE each motor.
If you control pins are not PWM pins, then you can use the ENABLE pins for this too, I usually combined both on one PWM pin.
The L298 is a little old hat now, but works, but you will lose about 2v on the output. Something based on the DRV883/35 is much better, for speed etc.
Thanks for the reply guys. Good advice. Manage to get them both working!
One more question not sure if i should make a new thread for it but let me know.
Is it possible to connect four motors and control each motor. I want to make a car which will have four wheels and each wheel will be controlled by a motor. Backwards and forwards is simple, but turning left and right is an issue. Anyway pass this?
Hi Mazzz,
Turning is simple just drive one motor forwards the other in reverse. ie. Turning left, left motor in reverse, right motor forward, it's as simple as that!! Perhaps not so with 4 wheels/motors...
If you want 4 motors you need two motor shields?? I have never buid a 4 wheeler as I don't see any advantage and driving it might be a proglem, having said that there are a lot of 4WD buggies around.
If you had a better motor shield then perhaps you could drive both left motors on one channel and the right on the other, but you would need something better then the L298/293 something that can deliver a few Amps..