Dual VNH3SP30 for stepper motor

I was looking at getting a stepper motor that lists 3A/phase in the specs and was wondering if the Dual VNH3SP30 Motor Driver Carrier MD03A could be used to drive a stepper motor. I will be using the Arduino UNO to control the stepper. I am currently using a small stepper from Adafruit to set up my LCD and keypad to control a stepper before buying a much more expensive motor. I don’t have very much programming knowledge so I am hoping that if I can use this driver I will be able to just replace the little driver I have without any (or at least very little) code changes. I have seen many people just say to build an H-bridge with discrete components but there are just so many different designs I have found I don’t know where to begin for that. If this won’t work I will just have to start looking better at a DIY H-bridge to build. Thank you for any help.


You can generally use two H-bridges to get some basic bipolar stepper motor control, so in that sense you might be able to do something with the dual VNH2SP30 board if you know what you’re doing, but those drivers are not designed for stepper motors and they do not offer current limiting. Switching times might affect your maximum speed, and you likely won’t be able to do any microstepping. I do not expect this or any other basic H-bridge solution to be easy to use or a drop-in replacement for your current driver, and I would definitely not recommend you build your own H-bridge for this kind of thing. What driver are you using right now?

- Ben

Right now I am just using the L293D IC on a breadboard wired up exactly like the diagram on the MotorKnob arduino page. I didn’t really think it would be a very easy swap, but I was hoping. I currently don’t have any need for microstepping so that is not an issue.

We have a programmable robot controller that uses the dual VNH2SP30 board for its motor drivers: the Orangutan X2. The Pololu AVR library makes this board easier to program, and the library includes a sample program for controlling a single bipolar stepper motor with the two motor channels:

#include <pololu/orangutan.h>

 * stepper-motor1: for the Orangutan LV, SV, SVP, X2, Baby-O.
 * This sample program lets you control a stepper motor using the motor driver
 * outputs of any Orangutan robot controller.  The two outputs of motor channel one
 * should connect to one stepper motor coil and the two outputs of motor channel two
 * should connect to the other stepper motor coil.  The one_step() function takes
 * changes the motor driver state to the next step in the specified direction, and
 * it supports full stepping, half stepping, or quarter stepping.  The motor driver
 * outputs are PWMed to keep the total current constant, which keeps the torque
 * approximately constant from step to step.  Half stepping adds steps between each
 * of the full steps, and quarter stepping adds steps between each of the half steps.
 * If your stepper motor has 200 steps per revolution, you have 200 full steps/rev,
 * 400 half steps/rev, and 800 quarter steps/rev. Using quarter stepping gives you
 * more resolution and can produce smoother movement, but it probably won't work well
 * for rapid rotation as the PWM frequency used to achieve the quarter steps is only
 * 10 kHz.  If the step period is the same order of magnitude as the PWM period,
 * this method of quarter stepping shouldn't be used.
 * The multistep() function is a blocking function that repeatedly calls one_step()
 * with loop delays between steps to achieve the desired rotation speed.  You could
 * modify this example to call one_step() at a specified interval from a timer
 * interrupt, which would allow your main program to continue running while the
 * stepper motor is turning.
 * The stepper motor coils must be energized for it to maintain its holding torque.
 * If you want to save power and don't need holding torque to keep the stepper
 * motor in place, you can call the stepper_off() function.
 * https://www.pololu.com/docs/0J20
 * https://www.pololu.com
 * https://forum.pololu.com

#define QUARTER_STEP	1
#define HALF_STEP		2
#define FULL_STEP		4

unsigned char stepMode = FULL_STEP;

// Advances the stepper motor by one step either clockwise or counterclockwise
// with the direction specified by the argument dir (0 or 1).  The size of the
// step depends on stepMode and can either be a full step, a half step, or a
// quarter step.  Full stepping is produced by repeating a four-state cycle
// in which both coils are always energized to carry the same magnitude of current
// but the direction of the current is sequentially switched.  Running through the
// four-state cycle in the reverse order reverses the direction of rotation.  The
// general equation for coil current should be as follows:
// coil 1 current = I * sin(a)
// coil 2 current = I * cos(a)
// When full stepping, the four states are: 
// forwards: a = 0, 90, 180, 270 degrees
// reverse:  a = 0, 270, 180, 90 degrees
// half stepping comes from: a = 0, 45, 90, 135, 180, 225, 270, 315 degrees
// quarter stepping comes from a = the 16 multiples of 22.5 from 22.5 to 360 deg
void one_step(unsigned char dir)
	// this static variable lets us remember what step we're on so we
	// can change to the appropriate next state in the sequence
	static unsigned char step = 0;

	// compute the next step based on the direction argument dir
	// and the step mode.  Full stepping skips half and quarter steps,
	// and half stepping skips quarter steps.  Quarter stepping cycles
	// through all 16 steps.
	if (dir == 1)
		step += stepMode;
		step -= stepMode;

	switch (step & 15)
		case 0:	// full step (both coils energized at 71%)
			set_motors(180, 180);
		case 1:	// quarter step (coil 1 at 38% and coil 2 at 92%)
			set_motors(98, 236);
		case 2: // half step (coil 1 at 0% and coil 2 at 100%)
			set_motors(0, 255);
		case 3: // quarter step
			set_motors(-98, 236);
		case 4: // full step
			set_motors(-180, 180);
		case 5: // quarter step
			set_motors(-236, 98);
		case 6: // half step
			set_motors(-255, 0);
		case 7: // quarter step
			set_motors(-236, -98);
		case 8: // full step
			set_motors(-180, -180);
		case 9: // quarter step
			set_motors(-98, -236);
		case 10: // half step
			set_motors(0, -255);
		case 11: // quarter step
			set_motors(98, -236);
		case 12: // full step
			set_motors(180, -180);
		case 13: // quarter step
			set_motors(236, -98);
		case 14: // half step
			set_motors(255, 0);
		case 15: // quarter step
			set_motors(236, 98);

// This is a blocking function that repeatedly takes a single step and then
// delays for step_delay_us microseconds.  When it finishes, the stepper motor
// coils will continued to be energized according to the final step so that
// the stepper motor maintains its position and holding torque.  The maximum
// time per step possible with this function is 65.535 ms.
void multistep(int steps, unsigned int step_delay_us)
	unsigned char dir = 1;
	if (steps < 0)
		dir = 0;
		steps = -steps;

	while (steps--)

// Stop delivering current to the stepper motor coils.  This will conserve
// power, but the holding torque will be zero after this function is called.
void stepper_off()
	set_motors(0, 0);

int main()
	while (1)
		if (stepMode == FULL_STEP)
			stepMode = HALF_STEP;
			stepMode = FULL_STEP;
		multistep(400, 5000);
		unsigned char i;
		for (i = 0; i < 4; i++)
			multistep(-100, 2000);

This might be the simplest way for you to have something that pretty much does what you want out of the box, assuming you feel comfortable enough changing main() to call multistep() the way you want. As I said before, however, I do not expect basic H-bridges designed for DC motors to be particularly good at driving stepper motors compared to drivers made specifically for stepper motors. Also, you will need to use a motor voltage that produces the appropriate stepper motor current. If it takes more than 16 V to get 3 A, you will not be able to get the full stepper motor current using these drivers because they have a voltage limit of 16 V.

- Ben

Thanks for the help. I have been looking around a bunch and found the RuggedCircuits rugged motor driver that will work if I double it up. Again, thank you for your help.