How to drive a stepper motor with your Arduino Mega using a TMC5130-EVAL

Only a few wires including an SPI port are required to control TMC5130-EVAL with your Arduino. Here are the few steps required to get started.


If your Arduino  is a 5V type you have to resolder one resistor on the TMC5130-EVAL from position R3 to R8. This sets the logic level of the TMC5130 to +5V. While by default the resistor is soldered to the “right-hand” position, you have to move it to the “left-hand” position for 5V operation.

Extract from TMC5130-EVAL schematic
Illustration 1 – Extract from TMC5130-EVAL schematic


Illustration 2 – Position of the logic level resistor on the TMC5130-EVAL board


The wiring is very simple. You will need 8 jumper wires. To make the wiring more easy you can print out the TMC5130-EVAL_Pinning.pdf and cut out the template to mount it on the connector header of the TMC5130-EVAL (As seen on illustration 4). As a reference you can use the TMC5130-Eval_v15_01_Schematic.pdf. Here you’ll find the signals that are on each pin. The configuration is documented in the comment section of the Arduino code.

Pinheader of TMC5130-EVAL
Illustration 3 – Pinheader of TMC5130-EVAL


Illustration 4 – TMC5130 wired up with Arduino Mega 2560

Cable colors of illustration 4
+5V –> red
GND –> blue
SDO –> yellow
SDI –> orange
SCK –> white
CSN –> grey
DRV_ENN –> black
CLK16 –> green

Arduino Code

The Arduino Code below does not need any additional libraries. The SPI library comes with the Arduino IDE. The program initializes the TMC5130 and executes a simple move to position cycle. It will rotate a 200 full step motor 10 revolutions to the one and 10 revolutions to the other direction depending on the wiring of the stepper motor. Please use either the TMC5130 datasheet or the TMCL IDE as a reference for the different registers.


The Arduino and TMC5130 zip file includes the pinning template, the TMC5130-EVAL schematic and the Arduino project.

Related Pages

One Comment

  • Lars Jaskulski Reply

    The next guide will explain howto use your Raspberry Pi 2 or 3 to communicate with the TMC5130-EVAL and turn the motor with a certain speed in velocity mode by the end of this week.

Leave a Reply

Your email address will not be published. Required fields are marked *