L298N Motor Driver - Stepper

This node lets you control a stepper motor, like the Nema 17 Bipolar Stepper Motor, with the L298N Motor Drive controller board.

Hardware Setup



There's a lot of wiring up to do to get this working. First lets go over the layout of the L298N:



Ports 1, 2, 13, and 14 are where you plug in the wires leading to the stepper motor.

The difficult part here is to figure out which of the 4 wires on your motor go to which port. There are two pairs of wires, you'll want to plug one pair into one side and the other pair into the other side. See this page for tables that show which color wire is which for your motor. Scroll down to the table for 4 wires, and find the row who's colors match the colors of the wires on your motor. The wires are labeled A+, A-, B+ and B-. Plug A+ and A- into ports 1 and 2, and B+ and B- into ports 13 and 14.

If you have trouble with figuring out the motor wiring, see
this Instructable for more help.

Ports 4 and 5 are where you attach the voltage and ground wires, respectively. This controller requires much more juice than can be supplied by an Arduino, so you'll want to plug a high voltage/amperage power source to these pins.

Pins 3, 7, and 12 are jumper locations. To use this controller with a stepper motor, keep the jumpers on on pins 7 and 12. If your voltage is < 12 volts also keep on the jumper on pin 3, otherwise remove it if you are using a high voltage source.

Pins 8, 9, 10, and 11 you will connect to your Arduino, for this example connect them to digital pins 8, 9, 10, and 11 respectively. If you connect these to other digital pins on your Arduino, you'll have to update the inputs on the node.


Using the Node



The Embrio node is fairly easy to use. The slightly transparent inputs are for design time settings only, you cannot connect to these inputs or change them at run time. You should be able to leave these at their defaults, unless you plugged your wires into other pins than 8, 9, 10, and 11, in which case you'll have to select those pins.

To move the stepper motor, change the Steps input value and fire the Do Steps trigger. The motor will move that many steps at the set Speed. For most Nema motors, at the default speed of 60, 200 steps will be 1 full revolution.

Supported Products

View discussion page on forum

To use this node in your Embrio project, either add it from the Library toolbar or copy the XML in the below box and paste it into a node screen.