

Unplug the wire from the IN1 breadboard row and the motor should stop.Plug the other end of the wire into the row on the breadboard where IN1 is connected - the first motor ( M1) should start to spin in one direction.Plug another red (male-to-male) jumper wire into the 12V row or rail on the breadboard.Double check that the wheels are not touching the support wheel holding up the test rig.Turn on the power supply or put the batteries inĪt this point, if your L298N board has an indicator light it should be on and the motors should not be moving.If you are using a variable power supply, preset it to 6V.Connect a black wire from your power source to the GND connector on the L298N.Connect a red wire from your power source to the node or rail on the breadboard wired to the 12V L298N input.If you are using a battery pack that can deliver at least 6V, leave the batteries out for now.If you are using a power supply leave it off or unplugged for the now.Plug the other end into its own row (node) or rail on the breadboard.Connect a male-to-male jumper wire to the 12V input on the L298N.Connect the 12V power input to the breadboard Repeat for IN2 through IN4, spacing out the wires on the breadboard in their own rows.Plug the male-end of the jumper into the breadboard on its own row (node).Attach the female-end of a jumper wire to IN1 ( INPUT 1) on the L298N board.Wire the input pins to the breadboardįor this step you will need four (4) different colored female-to-male jumper wires. Depending on the board the wiring will determine if both motors operate in the same direction when expected. Connect the red wire from the second motor ( M2) to OUT4īecause the motors are direct current, it doesn't really matter if you wire the red and black wires in reverse.Connect the red wire from the first motor ( M1) to OUT1 on the L298N board.On the board that I have the motor connectors on each side are labeled OUT1 though OUT4. Verify the ENA and ENB jumpers are set, so the motors will run without the need for a PWM signal.That is the equivalent of sending a signal to operate at no speed. If you leave the jumpers off, and do not provide a PWM signal, then the signal will be LOW.
#L298N MOTOR DRIVER REVERSE DIRECTION FULL#
It's like sending a PWM signal that is always HIGH - full speed. To do that you have to put the jumpers on ENA and ENB to pull both PWM pins HIGH.

There are two ways to drive the two DC motors on an L298N board: But I'm also not planning to use more than 12 volts. In this example I'm not planning to use the regulator. So if you are planning to use more than 12 volts to power the motors, remove the jumper. The L298N can be powered from 5V to 35V (depending on the specification).īut it is important to note that if you power it with more than 12 volts the onboard 5V voltage regulator will be damaged. But in case they are missing or not set, you should verify their placement before proceeding. This type of board is usually shipped with three jumpers already in place. These instructions are based on the silkscreen of the board that I have. Attach an M2.5 standoff with two flat ends underneath.Hold the screw in place with your finger.From the top of the board, put an M2.5 screw through a hole on the corner of the board.But it reduces the chance of shorting if you place the board on metal or spill something on to the work surface. Make sure the wheels aren't touching the supporting wheel.Make sure that the wires are closer to the middle.Use the standoffs to hold the two motors together.If you have a 3D printer, clamp, helping hands or some spare parts you can design something a bit more stable. This is a quick way of putting together a rig that won't roll away while testing. You can buy the parts for this article by following my affiliate links to either Amazon or AliExpress: Part
#L298N MOTOR DRIVER REVERSE DIRECTION HOW TO#
I'll provide a quick demo program so you can see how to run the motors through a predefined sequence. In the second part I will show you how to quickly wire up the driver to an Arduino.

It should also give you ideas for very simple robot projects. This will give you a better understanding of how a motor driver works. In the first part I will show you how to control the driver without the need for a computer. Most motorized toys and many robot chassis kits use simple DC motors. In this tutorial I cover how to drive two DC (direct current) motors using an L298N motor driver.
