TMC2130 with Arduino
How to wire a TMC2130 SPI Stepper Driver to an Arduino
I purchased a “BigTreeTech” TMC2130 V3.0 stepper driver and had difficulty wiring it to an Arduino. The primary use for the TMC2130 stepper driver is for 3D printers, so the existing documentation focuses on dropping a TMC2130 driver to an existing 3D printer controller. I wanted to use the driver directly with an Arduino, and apparently this is the road less traveled.
I’ll share the wiring details that I learned here, in case they may be useful to someone else’s project.
Warning: Power supply sequence is important!
Rule: 24V First and Last
The TMC2130 is picky about the order that power is supplied to it (source: Watterot). The motor power supply must be turned on before the VCC (VIO) power supply is connected. When powering down, the VCC (VIO) must be turned off before the motor power supply. Practically, this means that the 24V power supply must be turned on before the Arduino is connected to USB power, and then the USB power must be removed before turning off the 24V power supply. Motor power must be “first on, last off.” This is tricky because it’s easy to forget that the Arduino is connected to your PC (which provides 5V power) when debugging.
If you get the sequence wrong, you risk burning up the TMC2130 and your Arduino!
There is a workaround using a Schottky Diode between the VCC (VIO) and VM (Motor power) supplies, but I haven’t tested it.
The TMC2130 SPI driver is fairly simple to wire up – there’s just a lot of connections. On the above chart, the green labels are Arduino connections. With the exception of 5V and GND, the Arduino connections can be made to any digital pin. I found it easier to use software SPI, but if you use hardware SPI you’ll have to connect to the hardware SPI pins on your Arduino.
- SPI: The TMC 2130 uses four-wire SPI (MISO, CS, SCK, MOSI). I used software SPI because it is slightly easier. The SPI connection is generally only used on powerup to initialize the driver.
- Motor Wiring: The TMC2130 is designed to be used with a four-wire bipolar stepper. The only “trick” is to make sure that you know which motor wires correspond to the motor coils, or your stepper will just vibrate instead of turning.
- Motor Power Supply: 24V is preferable, but 12V should work too. The TMC2130 performs better with higher voltage.
Teemuatlut on Github has made an excellent Arduino library for using a TMC2130 called TMCStepper. You can download the library from within the Arduino IDE by using Tools –> “Manage Libraries” and searching for TMCStepper. I used the example called “Simple” to get my TMC2130 running for the first time. There are several useful examples available.
The TMC2130 SPI variant from BigTreeTech is tricky to breadboard because it doesn’t fit neatly into a breadboard – the “diag” pins prevent you from spanning the center of the breadboard. As a workaround, I used two eight pin female stacking headers. These headers are the same as are used to create an Arduino shield, and the extra-long pins raise TMC2130 board above the breadboard enough to avoid interference with the diag pins.
Here are the useful sources I used to make this guide:
- Julian Hespenheide has a very useful guide for wiring a TMC2130 that is configured for “standalone” step-direction wiring.
- BigTreeTech on Github has some useful documentation for the TMC2130 driver.
- Watterot (creator of the SilentStepStick) has a useful FAQ, particularly for information about proper power sequence.
- Teemuatlut on Github has a great Arduino library for the TMC2130 (and other TMC drivers) called TMCStepper.