I'm trying to create a simple cnc machine/3d printer/plotter that uses 3 stepper motors for the x, y and z axes. Does anyone know how to connect the three to a single Raspberry Pi (Model B+). A lot of tutorials online do this with an Arduino, but I have a Raspberry Pi thats collecting dust and wanted to make use of it.

Any help is appreciated.

  • I suggest you find an Arduino example and investigate if you could do exactly the same with the Pi. If you have a problem you can then ask a targeted question. – joan Nov 14 '16 at 22:02
  • Thats the thing, I don't know if it would work with the Raspberry Pi, I'm not very good at this. – RomanK Nov 14 '16 at 22:04
  • The reason you don't see more RPi CNC machines is that, having a full operating system, the Pi isn't particularly well suited to the task. Nitpicky timing is not its forte, and that's exactly what you need for CNC machines. joan, who left the first comment, has a hell of a lot more experience working with the specifics of the Pi's GPIO pins than I do and may have some useful solutions, but it's probably going to be easier to use an Arduino. – goobering Nov 14 '16 at 22:10
  • @goobering Would it be better to buy an Arduino or an attachment to a Raspberry Pi to achieve this? Thanks for the help. – RomanK Nov 14 '16 at 22:14
  • 1
    Unless you are prepared to put in some serious learning effort it will be far simpler to buy a pre-assembled 3D printer. – joan Nov 14 '16 at 22:26

I have not used this one from Adafruit, but I have used their arduino one. and it works fine. https://learn.adafruit.com/adafruit-dc-and-stepper-motor-hat-for-raspberry-pi/overview

Per the article you can stack these motor hats for multiple stepper motors, since they are I2C.

"In fact, you can even stack multiple Motor HATs, up to 32 of them, for controlling up to 64 stepper motors or 128 DC motors - just remember to purchase and solder in a stacking header instead of the one we include."


You can build a driver circuit to amplify signals and protect your RPi. I have good experience with ICs L297 and L297. Search for “l297 l298 stepper motor driver” and you will find a lot of information (videos, tutorials).

  • A quick question, would it be easier to connect stepper motor drivers to a Rasberry Pi via usb? And have the pi control the stepper motors through usb. Thanks for your help. – RomanK Nov 16 '16 at 21:34
  • I think it is the most difficult solution to this problem, because you need some kind of microcontroller which will receive commands over USB and then translate it to signals for the motor. Also you will need a USB driver. The easiest way would be to buy any kind of stepper motor shield/driver. – Anton Heck Nov 17 '16 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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