Alright, I know very little about what I am currently asking about, but here is the gist of it:

I want to build a cnc machine out of some old floppy drives. I purchased a couple L293D dual H-bridge ICs to drive the stepper motors, and I want to interface with grbl. The problem I seem to be having in designing a proper circuit for this is the circuits for driving stepper motors with the L293D all involve two inputs, one for each direction, and grbl seems to only use one Arduino pin for direction for each axis.

So what I've thought up is using a pnp and an npn transistor to act as a kind of two way switch, when I apply voltage one goes on, other goes off, and vice versa, so that basically 1's and 0's are controlling which way the motor will spin, and the "step pulse" will provide the actual motor power to move it in that direction.

My question is: will this work, or is what I said complete non-sense? I only understand pnp and npn transistors to be something like a "usually on" or "usually off" logic switch, basically, so that's where I've come up with that... Kinda like how an H-bridge works in the first place.

Thanks for taking the time, the diagrams I'm looking at are:

grbl to Arduino pins: http://www.electrodragon.com/w/images/e/e7/Grbl_Pin_Layout.png

L293D driving a stepper motor: http://arduino.cc/en/uploads/Reference/bipolar_stepper_two_pins2.png


2 Answers 2


I think what you're really after is an IO expander: http://www.digikey.com/product-detail/en/SX1505I087TRT/SX1505I087CT-ND/2272323

It's a relatively simple digital device. The Arduino would communicate with the IO expander over some standard communication protocol (typically I2C or SPI), and the IO expander wiggles pins on behalf of the controller.

Instead of using 12 pins on the Arduino to directly control the H bridges, the Arduino uses 2 pins (in the case of I2C) to communicate with the IO expander, and the IO expander directly controls the pins. The Arduino would say "Okay Mr. IO Expander. Turn on your pin2 and switch off your pin8", and the IO expander would set those pins accordingly.

  • \$\begingroup\$ Stepper motors are usually driven at 20 - 50kHz, are you sure that these I2C IO extenders are fast enough? EDIT: silly me, there are enough "low frequency" pins, like direction, enable etc. \$\endgroup\$ Commented Feb 4, 2015 at 17:49
  • \$\begingroup\$ WOW, didn't know about these things, and I am glad to know of their existence-- I'll definitely look to implement these somehow in my design. \$\endgroup\$
    – eyashin
    Commented Feb 5, 2015 at 5:22
  • \$\begingroup\$ @eyashin Just make sure you can switch the outputs fast enough for you application. Some are designed for only low speed (like controlling LEDs on a status light), but others have a bit of logic behind them, and can drive PWM without constant input from the uC. \$\endgroup\$
    – CurtisHx
    Commented Feb 5, 2015 at 14:01

I think that you are using the wrong chip to drive the stepper motor. The style of driver chip that you should be using already has step and direction inputs and will connect directly to the Arduino board running GRBL.

Although there are MANY such devices currently available, I'm fond of TI’s DRV8825. It's good for about 1.5A per phase with a maximum of 45V supply rail. It has provision to reduce the coil current to as low as required for your particular motor.

This chip can be difficult to work with by itself because of the tight lead spacing and underside heat pad. However, it is available already mounted to a PCB with all of the extra components needed to make it work. Simply connect the board to your controller, the stepper motor, and supply voltage and you are set to go.

One such supplier is Pololu: DRV8825 and they offer a 5-pack of driver modules at a discounted price.

Also check out Geckodrive for larger (but more expensive) driver modules.

  • \$\begingroup\$ Yes, this looks like completely the right thing to be interfacing with GRBL, for the final iteration of this project I think I will go with some real stepper motor drivers. Thank you for pointing me in the right direction! \$\endgroup\$
    – eyashin
    Commented Feb 5, 2015 at 5:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.