Introduction: Upgrading RAMPS 1.4 With TMC2130 Stepper Drivers
Tired of the constant noise your printer is making. Upgrading your RAMPS 1.4 (or most any AT Mega based controllers) with the TMC2130 stepper motors might do the trick.
In this instructable I will not go into the technical babble of PSI, Master/Slave and clock speeds. If you're interested in that I refer you to https://toms3d.org/2017/12/09/tmc2130-guide/ or https://ru-clip.com/video/sPvTB3irCxQ/how-to-make-... or https://hackaday.com/2016/09/30/3d-printering-trin...
Also if anything in this instructable seems unclear, check with those sites.To their credit, I've used them mainly as the source for my upgrade.
Here are some of the advantages I've been reading about:
- Super quiet operation
- Ability to configure via software
- Proper alignment of controller which allows for proper cooling of the driver chips
- Possibility of homing X and Y without End stops (diagnosis allows for the software to recognize the axis bumping into things). (this in a later instructable)
- Potentially with future updates of Marlin the ability to act on missed steps during printing (like Prusa I3 MK3 can do today).
What it boils down to is that these new stepper drivers can be controlled via software and can run in an ultra silents mode (with 256 micro steps). With these new stepper drivers you no longer need to adjust the little pot meters on the driver but instead can tell it via g-codes at how many amps/volts to run.
When buying these steppers online be cautious about how they are delivered. Most of them (on amazon.com) already have all pins soldered to them which is a problem as 4 of the pins are pointing the wrong way.
I've ordered the steppers directly from the US distributor (Filastruder.com) and they come with pins but not soldered on.
In this instructable I will start with the bare stepper driver, solder the pins and create a wiring harness that connects all the right pins on the steppers to the proper pins on the RAMPS 1.4 board.
This instructable will be for the RAMPS 1.4 board but many derivatives use the exact same pin configurations (I will try this out on my KFB 2.0 board).
Step 1: Things Needed
The following items are pre-requisite to this project:
TMC2130 Stepper Driver: $13.99 per stepper from Filastruder (the official US Distributor) https://www.filastruder.com/products/silentstepsti...
In this project I'm replacing all 4 drivers but you could just replace X and Y as they do most of the work
Ramps 1.4 Board (or RAMPS 1.4 Compatible): (if you buy a kit will will get the A4988 drivers that you will be replacing but the price might still be right): $29.99 http://amzn.to/2FqmN51
Soldering Iron/Station: $39.70 http://amzn.to/2FYTgwU
Some fine solder: $9.98 http://amzn.to/2FgkwKe
Marlin Firmware: Free: http://marlinfw.org/ (I'm using version 1.1.8)
wire to connect SPI pins. I'm using old Stepper Wiring as it suits the problem (4 main pins on each driver): $10.59 for 10 http://amzn.to/2G067ii
Dupont wires Female to Female can be used for individual connections. $6.98 http://amzn.to/2FYRVpQ (all the wires you'll ever need)
With all these wires you don't have to do any crimping of your own (just some soldering).
heat shrink tubing for finishing the soldered wires: $7.99 http://amzn.to/2tlT4oN
Step 2: Assembling the Stepper Drivers
The TMC2130 drivers come un-assembled so first we need to prepare each stepper putting the all the pins in the right places.
Very important about steppers. Trinamic seems to be the only company to do it right. Adding the usual heatsinks on top of a chip is a bit of joke as heat travels below the chip through the board. These little boards are build such that the chip will be underneath the board when assembled and the heat sink can be applied on top of the board.
For this project I added the 4 PSI pins as well as the end stop pin (for end-stop-less homing).
I cut the strips of pins in the right size for assebly (row of 8 pointing down), 4 PSI up, 1 Diagnostic up, one down (En) and 2 down (Dir, Step)
First I will solder the top pins to the driver (I'm using a piece of double sided PCB board to place and rest the pins).
Next I place the bottom pins in place on the PCB board and lay the driver on top and solder the downward facing pins.
Once all pins are soldered simply rinse and repeat for the remaining chips.
Before putting the drivers in your RAMPS 1.4 please note that you can remove the three jumpers that used to set your stepping to 1/16th. It is now handled by the software. I removed mine but I've read you may leave them as they no longer are connected to anything (probably did something to the pins that are now pointing up).
Step 3: Wiring With AUX 3 Available
The common setup TMC2130 setup for marlin assumes that the both Aux 2 and Aux 3 on the RAMPS board are available (like the first image of this step). If your are using a LCD with SD Card adapter, Aux 3 is not available and wiring for that situation will be discussed in the next Step.
The wiring image shows how all wires go to the 2 Aux clusters. Also note that three of the 4 wires are all combined and end up on 1 pin on Aux 3
SDI for X/YZ/E0 all go to pin D51
SCK for X/YZ/E0 all go to pin D52
SDO for X/YZ/E0 all go to pin D50
CS for X goes to D53
CS for Y goes to D49
CS for Z goes to D40
CS for E0 goes to D42
For my project I created a wiring harness that consists of 4 repurposed Stepper wires.
I solder and combined all Black wires into one single black wire ending up with a female connector for a single pin
I solder and combined all Green wires into one single black wire ending up with a female connector for a single pin
I solder and combined all Blue wires into one single black wire ending up with a female connector for a single pin
The Red wires each end up with their own single female pin connector as they each have their own pins assigned on Aux.
Look at the schematic image to see where all wires go
Step 4: Wiring With LCD Installed (Aux 3 Not Available)
Okay, so browsing around the web I can't find a real clean solution to this. It's not that hard to reroute X CS and Y CS to other ports but the RAMPS 1.4 only seems to have one SCK and the two MISO pins which are used by the Card Reader on the LCD Unit.
The solution I've come up with for now is to extend the LCD connector with three pins on top. It's not pretty but it seems pretty sturdy (if soldered well). If you screw it up a new adapter only costs a few dollars on Amazon.com (http://amzn.to/2oNVPdM).
In order to reroute the CS pins, you'll need to update the pin_RAMPS.h file
Change the pins to
DEFINE X_CS_PIN 44
DEFINE Y_CS_PIN 64
//<br>// Steppers // #define X_STEP_PIN 54 #define X_DIR_PIN 55 #define X_ENABLE_PIN 38 #define X_CS_PIN 44
#define Y_STEP_PIN 60 #define Y_DIR_PIN 61 #define Y_ENABLE_PIN 56 #define Y_CS_PIN 64
Redirecting these pins works but I'm a bit concerned about some of the threads I'm reading on using the SD card in combination with the TMC2130 (now sharing the same pins as the SD Reader). I will have to runs some more testing once all installed.
The new schematic images will show the new wiring configurations. Just follow the lines.
Step 5: Setting Up the Software
IMPORTANT: YOU NEED Marlin bugfix-1.1.x.zip for this to work. If you find that your distance traveled has changes on any of the axis you have the wrong version.
Once all the hardware is connected (in fairness, I did one Stepper at a time) you will need to make the software aware of the new Drivers. If you are rerouting some of the CS pins because you're using an LCD (adapter) you've already made some changes to the pins_RAMPS.h file but for normal operation most changes occur in the Configuration_adv.h
If you have the latest (or a newer version) of Marlin (I'm using 1.1.8 as of this writing) you can open the configuration_adv.h and search for TMC2130. It will take you right to the TMC2130 section.
First thing you do is uncomment (remove // from in front of) #define HAVE_TMC2130
// @section TMC2130, TMC2208/** * Enable this for SilentStepStick Trinamic TMC2130 SPI-configurable stepper drivers. * * You'll also need the TMC2130Stepper Arduino library * (https://github.com/teemuatlut/TMC2130Stepper). * * To use TMC2130 stepper drivers in SPI mode connect your SPI2130 pins to * the hardware SPI interface on your board and define the required CS pins * in your `pins_MYBOARD.h` file. (e.g., RAMPS 1.4 uses AUX3 pins `X_CS_PIN 53`, `Y_CS_PIN 49`, etc.). */ #define HAVE_TMC2130
Next you un-comment those lines that represent the Stepper motors you will be controlling with the new TMC2130 drivers.
In this case I uncomment all three Axis and the Extruder (E0)
#if ENABLED(HAVE_TMC2130) || ENABLED(HAVE_TMC2208) // CHOOSE YOUR MOTORS HERE, THIS IS MANDATORY #define X_IS_TMC2130 //#define X2_IS_TMC2130 #define Y_IS_TMC2130 //#define Y2_IS_TMC2130 #define Z_IS_TMC2130 //#define Z2_IS_TMC2130 #define E0_IS_TMC2130 //#define E1_IS_TMC2130 //#define E2_IS_TMC2130 //#define E3_IS_TMC2130 //#define E4_IS_TMC2130
The next section when you scroll down is where you define the power setting of all and each of the divers. In may case I'm pretty much leaving these as is. The first setting R_SENSE I believe has to do with any resistance the motor meets and when to do something with it. Some speculation as I haven't found much on it (let me know if you do)
The second setting HOLD_MULTIPLIER will lower the current by half (or what value you set it to) when the motors are idle. It reduces heat but in some cases also handle the high pitched whining of idle motors.
The third setting INTERPOLATE is what gives the magic to these new drivers so leave it set to true. I will take the 16 steps your RAMPS sends the driver and turns it into 256, giving is the silent and smooth motion.
/**<br> * Stepper driver settings */ #define R_SENSE 0.11 // R_sense resistor for SilentStepStick2130 #define HOLD_MULTIPLIER 0.5 // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256
In the following section you can set the Current and Micro Steps per motor. This is a really nice feature as you no longer have open up your electronics and mess with the little pot-meter on each driver. You can set this value in the configuration here but there's also a way to change it on the fly with g-code M906 (M906 X900 sets the current for X to 900mA). You can play around with these values to figure out what works best for you.
The _MICROSTEPS setting is a bit confusing but, if you had 3 jumpers underneath your old driver leave it at 16, The interpolation will still bring it to 256.
The TMC2130 can run in two modes: spreadCycle of StealthChop. It's the StealChop that's making your printing invisible (to the ears that is). So most of you will install it for that reason. With StealthChop you also get less power and thus you can't print as fast as you might have once wanted (personally I think speed is overrated).
But to be clear, the cutoff between StealthChop and SpreadCycle by default is 100mm/s I don't think most of you will loose speed by using StealthChop and clearly TMC2130 allows you to go WAYY past 100mm/s (that is considered the threshold between slow and fast).
In SpreadCycle Mode the drivers can run your prints faster as it can create more torque. It also get noisier though. If you're interested in the TMC2130 for it's lack of noise you will want to enable the StealthChop mode by uncommenting the following:
/** * Use Trinamic's ultra quiet stepping mode. * When disabled, Marlin will use spreadCycle stepping mode. */ #define STEALTHCHOP
The next setting of MONITOR_DRIVER_STATUS I'm unfamiliar with (as of yet) so I'm going to leave it commented.
Should you wish to have the best of both worlds: Quiet when possible and powerful when needed you can choose to enable the hybrid mode:
/**<br> * The driver will switch to spreadCycle when stepper speed is over HYBRID_THRESHOLD. * This mode allows for faster movements at the expense of higher noise levels. * STEALTHCHOP needs to be enabled. * M913 X/Y/Z/E to live tune the setting */ #define HYBRID_THRESHOLD <br> #define X_HYBRID_THRESHOLD 98 // [mm/s] #define X2_HYBRID_THRESHOLD 100 #define Y_HYBRID_THRESHOLD 98 #define Y2_HYBRID_THRESHOLD 100
You can set the speed at which the printer should switch from one mode to the next. The long and peaceful quiet may be gone.
As of this writing I will not go into sensorless homing yet as I'm quite happy with the homing I have today.
Before uploading the software I would recommend enabling the TMC debuggging option by un-commenting TMC_DEBUG. With the m122 command you can get useful information (especially when first trying out the new steppers).
/**<br> * Enable M122 debugging command for TMC stepper drivers. * M122 S0/1 will enable continous reporting. */ #define TMC_DEBUG
Step 6: Testing the New TMC2130 Drivers
If you're lucky like me you have enough spare parts laying around to do some testing. In this case I'm using a spare RAMPS 1.4 kit, and 4 steppers I had laying around.
I've inserted all four stepper drivers and hooked up the motors.
In order for you to test with RAMPS 1.4 you need to AT LEAST connect a thermistor to the TEMP0 (without Marlin does not like to operate, unless major code changes).
If you want to test the extruder stepper you will also need to disable the PREVENT_COLD_EXTRUSION or change the EXTRUDE_MINTEMP to room temperature (something like 18 Celcius)
// This option prevents extrusion if the temperature is below EXTRUDE_MINTEMP.<br>// It also enables the M302 command to set the minimum extrusion temperature // or to allow moving the extruder regardless of the hotend temperature. // *** IT IS HIGHLY RECOMMENDED TO LEAVE THIS OPTION ENABLED! *** //#define PREVENT_COLD_EXTRUSION //#define EXTRUDE_MINTEMP 170
Hook up your RAMPS to a 12 Volt source (powerful enough to run the steppers) and upload your Marlin to the test board.
You can now connect to the board via USB with a program like Pronterface and test some things.
First off run the M122 command which, if you enabled the TMC_DEBUG (in previous step) will provide a bunch of information on the stepper drivers.
The following is a dump of the information of my drivers.
>>> m122<br>SENDING:M122 X Y Z E0 Enabled false false false false Set current 800 800 800 800 RMS current 795 795 795 795 MAX current 1121 1121 1121 1121 Run current 25/31 25/31 25/31 25/31 Hold current 12/31 12/31 12/31 12/31 CS actual 12/31 12/31 12/31 12/31 PWM scale 128 128 40 39 vsense 1=.18 1=.18 1=.18 1=.18 stealthChop true true true true msteps 16 16 16 16 tstep 1048575 1048575 1048575 1048575 pwm threshold 0 0 0 0 [mm/s] - - - - OT prewarn false false false false OT prewarn has been triggered false false false false off time 5 5 5 5 blank time 24 24 24 24 hysterisis -end 2 2 2 2 -start 3 3 3 3 Stallguard thrs 0 0 0 0 DRVSTATUS X Y Z E0 stallguard sg_result 0 0 0 0 fsactive stst X X X X olb X X ola X X s2gb s2ga otpw ot Driver registers: X = 0xE0:0C:00:00 Y = 0xE0:0C:00:00 Z = 0x80:0C:00:00 E0 = 0x80:0C:00:00
I'm not going to bore you with too much details (Still have to figure out a bunch myself) but if in the Driver registers at the bottom you see 0xFF... it means something is not connector properly for that stepper driver.
You can now start sending commands to the motors and see if they are running properly. in the video below you hear the Case fan of my CoreXY Printer (next project). The motors themselves, I cannot hear.
Step 7: Conclusion
The installation of the new TMC2130 seems more daunting than it is. Yes, you will need to do some soldering, there are more wires than ever before but I can't wait to install these permanently into my CoreXY printer.
Here is a comparison of my old A4988 Steppers to the new TMC2130.
Let me know what I got wrong, I'm here to learn myself. If you're eager to learn more about the sensorless homing, please support me on Patreon.com. I will need to purchase a new set of Drivers for that one.
Participated in the
Epilog Challenge 9
3 years ago
Hello, I got the drivers today, in my case I never use the SD card, I just use octoprint, do I need to redirect the pins for cs? But I use a lot the lcd, thanks in advance
Reply 3 years ago
Nothing in the wiring changes, whether you use or don't use SD card. You still need to wire as seen above. It just so happens SD card uses same signal pins as tmc (and some claim it creates issues, which I have yet to experience).
4 years ago
Very detailed guide.. thank you for sharing.
Im also using KFB board. But it has dual extrusion can u share wiring am firmware changes for that
Reply 4 years ago
The KFB board has a heater0 and heater1 output for that purpose. I've never worked with dual extrusion but the configurations should be fairly straight forward. I believe the only thing in the configuration.h
// This defines the number of extruders
// :[1, 2, 3, 4, 5]
#define EXTRUDERS 2
Question 4 years ago on Step 6
Hi. Thanks for your instructable! it is very clear. I wanted to ask you something. I am using a CNC shield with the A4988 drivers and I want to test the TMC2130 with the RAMPS 1.4. I know it doesnt make much sense for a CNC, but I want to try it. I am using 3 nema 1.7. In my actual CNC configuration I power the shield with 24 volts - 5 AMP power suply. What type of power suply should I use for the RAMPS 1.7 & 3 nema 17? Absoute beginner..;)
Reply 4 years ago
Pretty much all ramps are operated with these universal power switches. In case of 24V that would be this one https://amzn.to/2sRqDwz. It outputs 15Amp. The ramps has 2 inputs 5A and 11A (simply connect them both).
4 years ago
Recent Marlin Firmwares (at least from January 2018) support Software SPI
So it is now possibile to use only AUX-2 pins without the need to solder anything.
I have tried (with MK4Duo / MarlinKimbra FW) and it works correctly.
AUX-2 has 8 pins so 3 pins used for MOSI-MISO-CLK and the others 5 free to select up to 5 TMC2130 drivers
Reply 4 years ago
Hi, I have ramps 1.4 and TMC2130 SPI for X and Y too. Can you explain which AUX-2 pins have you used?
Reply 4 years ago
Hi, I have used software SPI with this configuration (MK4Duo firmware 4.3.6) :
In file Configuration_Overall.h :
#define X_DRIVER_TYPE TMC2130
#define Y_DRIVER_TYPE TMC2130
#define Z_DRIVER_TYPE TMC2130
#define E0_DRIVER_TYPE TMC2130
#define E1_DRIVER_TYPE A4988 /* I haven't second extruder default to A4988 */
And in file Configuration_Pins.h :
#define X_CS_PIN 59
#define Y_CS_PIN 64
#define Z_CS_PIN 44
#define E0_CS_PIN 63
#define E1_CS_PIN NoPin /* use 40 if you have second extruder */
#define SOFT_MOSI_PIN 66
#define SOFT_MISO_PIN 65
#define SOFT_SCK_PIN 42
Reply 4 years ago
Hardware SPI or Software SPI?
Reply 4 years ago
Thx! I know there was issues with it at the time of this writing (and beyond) so I didn't even go that route. I'm glad it has all worked out for you.
In Configuration_adv.h there is a section for Software SPI
* Use software SPI for TMC2130.
* The default SW SPI pins are defined the respective pins files,
* but you can override or define them here.
//#define TMC_SW_MOSI -1
//#define TMC_SW_MISO -1
//#define TMC_SW_SCK -1
Most of my printers now run on KFB2.0 which has a seperate SPI block of pins which makes it easier too.
As an FYI, I tried upgrading to Marlin 1.1.9 and had to stop as it wasn't recognizing the TMC2130 for E0. Download the latest bug-fix to get around that.
Reply 4 years ago
MarlinKimbra, now MK4duo, (https://github.com/MKFirmware/MK4duo) is Marlin fw rework with many additions from other sources (many but not all additions present on MarlinKimbra only probably will be reinserted in Marlin 2.0) and the config files are a bit different but the principle is the same (and the Software SPI has been taken from Marlin sources).
I have only found out that the clock signal is not constant.
Using a Logic Analyzer it is evident that the clock source is a signal which changes period (and so frequency) many times during comunication.
All other SPI comunication which I have seen had always a fixed clock.
I do not know if it is due to spi software or it will also be present on hw spi and is a normal firmware operation.
Nevertheless it seems to work with my printer (Velleman K8200 / FuturaElettronica 3DRag).
Question 4 years ago
after finishing i got this m122
X Y Z E0
Enabled false false false false
Set current 650 650 650 800
RMS current 1160 1160 1160 1436
MAX current 1636 1636 1636 2025
Run current 20/31 20/31 20/31 25/31
Hold current 10/31 10/31 10/31 12/31
CS actual 0/31 0/31 0/31 0/31
PWM scale 0 0 0 0
vsense 0=.325 0=.325 0=.325 0=.325
stealthChop false false false false
msteps 256 256 256 256
tstep 1048575 1048575 1048575 1048575
threshold 0 0 0 0
[mm/s] - - - -
OT prewarn false false false false
OT prewarn has
been triggered false false false false
off time 0 0 0 0
blank time 16 16 16 16
-end -3 -3 -3 -3
-start 1 1 1 1
Stallguard thrs 8 8 0 0
DRVSTATUS X Y Z E0
sg_result 0 0 0 0
stst X X X X
X = 0x80:00:00:00
Y = 0x80:00:00:00
Z = 0x80:00:00:00
E0 = 0x80:00:00:00
what do you see???before i go to motor testing???? thanks
Answer 4 years ago
Three differences from mine (below). You seem to not have enabled stealthchop and it looks like you're using stallguard for X and Y
The one thing that looks off is; you have set your micro steps to 256, The RAMPS doesn't go that high. Set it to 16 or leave it at what it was before (this applies to the RAMPS steps/unit calculation)
#define X_MICROSTEPS 16 // 0..256
#define INTERPOLATE true will bump that up to 256 (without effecting the steps per unit calculation).
Here's my output:
Enabled false false false false
Set current 800 800 750 800
RMS current 795 795 734 795
MAX current 1121 1121 1035 1121
Run current 25/31 25/31 23/31 25/31
Hold current 12/31 12/31 11/31 12/31
CS actual 12/31 12/31 11/31 12/31
PWM scale 0 0 0 0
vsense 1=.18 1=.18 1=.18 1=.18
stealthChop true true true true
msteps 16 16 16 16
Recv: OT prewarnfalsefalsefalsefalse
Recv: OT prewarn has
Recv: been triggeredfalsefalsefalsefalse
Recv: off time5555
Recv: blank time24242424
Recv: Stallguard thrs0000
Recv: Driver registers:X = 0x80:0C:00:00
Recv: Y = 0x80:0C:00:00
Recv: Z = 0x80:0B:00:00
Recv: E0 = 0x80:0C:00:00
Question 4 years ago
Hi excellent guide , did you solve the SD card problem , i am afraid to install the ramps with tcm drivers because I print exclusively from SD card . please help.
Answer 4 years ago
Thank you. As far as I can tell there are NO issues with the SD card in combination of this wiring. I print both SD card and Octo Print and have seen no issues printing from SD. Check out the tip from jfpayeur on the elongated pins he uses to "extend" the LCD adapter.
5 years ago
i have a megatronics v3. Anyone know how to wire them to that?
5 years ago
Hi from Spain!
Something very strange happens to me, before I had marlin 1.1.6 and now when updating to the latest version, it does not let me retract at a speed higher than 12mm / sec, if I do it it makes a very big vibration in the motor, and if i want back to the previous version does the same thing to me, what could be happening? I have the A8 motors that are 1.7A and I have 800mA configured, thank you very much
Reply 5 years ago
I had trouble with the original Marlin 1.1.8 and was instructed to download the bug_fix release. It solved my issues https://github.com/MarlinFirmware/Marlin/archive/b...
Also are you running in stealthchop or spreadcycle mode?
Reply 5 years ago
I'm using the stealthchop mode, in the spreadcycle mode the motors make me much more noise and emit a very loud and continuous beep that, although the power of the motors is not reduced, I am waiting for a new motors to arrive, that I have are those of the anet a8 and are of dubious quality