TMC5130A-TA BOB & ARDUINO UNO

Have questions about the equipment used for macro- or micro- photography? Post those questions in this forum.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

Adalbert
Posts: 2427
Joined: Mon Nov 30, 2015 1:09 pm

TMC5130A-TA BOB & ARDUINO UNO

Post by Adalbert »

Hello everybody,
Inspired by Mike I would like to test the TMC5130 as a driver for the NEMA 17.
Instead of the suggested Raspberry Pi I would use Arduino Uno (I have already one :-)
As far as I can see I only have to resolder one resistor on the TMC5130-EVAL from position R3 to R8
https://blog.trinamic.com/2017/04/05/ho ... uino-mega/
But what should be done with the BOB if I don’t use any donkey ?
Now, I’m trying to understand the function of the crazy Eselsbruecke (bridge of donkey) and EVAL-board :-)
BR, ADi

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

ADi,

Know how the BOB boards connect with the RPi (at least the way I've got them configured), but have no experience with the Eval boards on the RPi or Arduino (which I have no experience with either).

The Eval boards appear to be different than the BOB boards. Suggest you study the schematics of the Eval and BOB boards to see how they are configured.

Having studyed and tested various Trinamic device for some time now, I can speak from experience, and a word of caution when dealing with these Trinamic BOB devices.

The motor supply needs to be a good high current source with a low resistance cable, not the usual cheap eBay types. You also need to decouple the motor supply near the chip (both physically and electrically) to prevent "glitches" during startup and handups when developing code. A large and quality high frequency capacitor is a must! My recommendation is a quality lab supply with adjustable current limit and continuous voltage and current monitoring for code development work. This way you can "see" when something happens while monitoring the motor voltage and current (another reason I developed the Hall Effect motor current sensor).

The Trinamic devices utilize a unique internal architecture and when configured as the BOB get internal Vcc logic power from the motor supply input with an on-chip 5V regulator, some like the high current TMC5161 have an additional 11.5V regulator. The I/O interface supply (Vcc_IO) is a different logic supply than the internal Vcc, and is used as either 3.3V or 5V depending on the interface requirements. I drive the Vcc_IO with a RPi GPIO pin at 3.3V to allow software cycling the Vcc_IO to reset the chip without removing the motor supply.

When a motor power "glitch" occurs, like at startup or code induced "H Bridge" lockup, the instantaneous motor supply voltage will drop. If it drops sufficiently the internal 5V will also "glitch" and this can create a chip lockup. This causes the motor to jerk as high current is passing thru the windings, and sometimes sustained current and everything must the power recycled. To prevent or reduce this condition a good quality supply with low resistance cable and proper decoupling are required. The better the decoupling size and quality capacitor the less influence the power supply and cable have. On my high current TMC5160 controller system note the special high frequency decoupling cap on the BOB board (gold cap low ESR and ESL 220uF), as well as the large 470uF black cap on the PCB. The gold 220uF cap locally provides the high dynamic chip current demands and the black 470uF cap averages the motor and chip demand currents for the motor supply, thus reducing the peak current demand from the motor supply and minimizing the motor supply & cable effects.

Hope this helps understand these Trinamic devices a little better.

Spend some time (lots of time), studying the Trinamic device Data Sheets. They include lots of detailed information on these very complex, but powerful chips. Once you digest this information you will be able develop a configuration to control and optimize your motors/rails at performance levels to be "stunned" as Charles indicated :D

Best,

Image
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

Adalbert
Posts: 2427
Joined: Mon Nov 30, 2015 1:09 pm

Post by Adalbert »

Hello Mike,

Many thanks for the hints!

I have already collected some documents but haven’t begun to read them up to now. I have just taken a look at but haven’t found what I’m looking for. 
I only would like to see the table of the pins which have to be connected (Arduino to TMC5130 BOB). Something as for the EVAL in the source code.
Probable because the EVAL’s are more expensive than the BOB’s :-)

BTW, I could use the power supply 24V and a VA-driver for 5V but I would like to use the power from the Arduino for the TMC5130 (IC).

BR, ADi

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

Adi,

The 24 V supply should be OK "if" it's got enough surplus current capability and the cable is low resistance. If it was from a cheap eBay supplier, likely not. As mentioned when developing code you are likely to encounter a motor H Bridge lock up induced by a "glitch", which may cause a direct motor connection to the H Bridge from the supply to ground. Without monitoring and current limit capability this is likely to burn up the Trinamic Chip even tho they are "supposed" to be protected against this.

Don't know about the Eval boards but the BOB boards have a temperature sensitive "blue dot" to indicate a over temperature condition. This is likely to allow Trinamic to deny replacement because the chip was abused, "overheated" and failed.

My experience is NEVER depend on Over-Voltage, Over-Current or Over-Temperature on-chip protection as a 1st order preventive, only as a last resort. You must ensure these conditions don't happen from outside the chip, otherwise you'll be replacing chips often. This is why the drivers like the DRV8825 & A4988 are on cheap boards (not the quality BOB boards) that are plugin...because you will be replacing them often :shock:

Another "popular" failure mode for motor driver chips is Over-Voltage cause by motor inductive "Kickback", this occurs when one disconnects the motor while current is flowing. Never disconnect a motor while current is flowing, always remove the motor supply and with a proper designed controller board the board will absorb the inductive kickback to safe levels and allow gradual motor current decay.

Don't know how to hook the BOB or Eval up to the Arduino, check the Trinamic blog site or use Google.

Good luck with your Arduino project & setup, wish I could help more.

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

kaleun96
Posts: 270
Joined: Sat Oct 20, 2018 3:47 pm
Location: Stockholm, Sweden

Post by kaleun96 »

I would probably recommend going with a Trinamic driver that has a user friendly breakout board instead of an eval board, any one of these would do:
https://shop.watterott.com/SilentStepSt ... tor-driver
https://shop.watterott.com/SilentStepSt ... tor-Driver
https://shop.watterott.com/SilentStepSt ... r-soldered

The one Mike has also has a convenient breakout board but it has a different form factor if you're used to working with A4988 / DRV8825 styled drivers. Not sure if this version has any benefits compared to Watterott's form factor but in the end it's probably mostly a question of convenience.
Mike's one can be found here I believe:
https://www.trinamic.com/support/eval-k ... 5130a-bob/

Perhaps the 2209 would be best as it's the latest model (e.g. StallGuard4) but it also has less support from existing Arduino libraries put together by teemuatlut. Those libraries aren't necessary, they just save you having to write to the registers manually yourself. They have convenient functions when you just need to input the value for each motor parameter.

I also can't stress Mike's recommendations regarding the power supply enough. I damaged 2 boards before getting the issue with my supply fixed, Watterott were very helpful in diagnosing the issue at least. Even though I've had the driver working for some time now, I'm still worried about it getting killed by an accidental power disconnect or such.

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

kaleun96 wrote:I would probably recommend going with a Trinamic driver that has a user friendly breakout board instead of an eval board, any one of these would do:
https://shop.watterott.com/SilentStepSt ... tor-driver
https://shop.watterott.com/SilentStepSt ... tor-Driver
https://shop.watterott.com/SilentStepSt ... r-soldered

The one Mike has also has a convenient breakout board but it has a different form factor if you're used to working with A4988 / DRV8825 styled drivers. Not sure if this version has any benefits compared to Watterott's form factor but in the end it's probably mostly a question of convenience.
Mike's one can be found here I believe:
https://www.trinamic.com/support/eval-k ... 5130a-bob/

Perhaps the 2209 would be best as it's the latest model (e.g. StallGuard4) but it also has less support from existing Arduino libraries put together by teemuatlut. Those libraries aren't necessary, they just save you having to write to the registers manually yourself. They have convenient functions when you just need to input the value for each motor parameter.

I also can't stress Mike's recommendations regarding the power supply enough. I damaged 2 boards before getting the issue with my supply fixed, Watterott were very helpful in diagnosing the issue at least. Even though I've had the driver working for some time now, I'm still worried about it getting killed by an accidental power disconnect or such.
You folks using Arduinos should collaborate, I can't help much with the Arduino.

Are the smaller footprint 2130 & 2190 boards you mention capable of supporting direct software controlled motor currents (looks like the have pots for current setting like the older designs, and thus limited software motor current control), with IRUN and IHOLD parameters or by way of GOBALSCALE? They don't look as nice as the BOB boards, more like the eBay A4988 and DRV8825 boards I've seen (not ones from Pololu), the 5160 looks OK though. Also seem to lack the motor supply close to chip decoupling, the 5160 appears to have some but not the 2130 or 2190. The BOBs allow you to utilize dual limit sensors, encoders and have pins for external system clock (different from SPI clock), full 4 pin SPI, and Motor Drive Enable. These are what some of the pins are use for on the BOB, not sure exactly how the smaller boards are configured.

I'm incorporating & testing code now with the RPi based systems allowing dynamic current control and modulation. This opens up a lot of options for motor control even beyond what the controllers have build in.

If enough interest rises I might develop a controller/motor overcurrent protector circuit that fits between the motor supply and driver board. This would just take the power supply plug and operate from that supply and provide a standard plug out to the motor controller. The circuit would automatically detect and have a settable overcurrent from 0.5 to 2A for any load or controller at any supply voltage from 9 to 35 volts. When an overcurrent condition is detected the circuit would quickly disconnect and attempt reconnecting after a delay of a few seconds.

This shouldn't be expensive and I'll design the circuit and PCB if enough folks are willing to participate.

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

kaleun96
Posts: 270
Joined: Sat Oct 20, 2018 3:47 pm
Location: Stockholm, Sweden

Post by kaleun96 »

mawyatt wrote: You folks using Arduinos should collaborate, I can't help much with the Arduino.
Definitely! Thinking of starting a thread on this at some stage.

mawyatt wrote: Are the smaller footprint 2130 & 2190 boards you mention capable of supporting direct software controlled motor currents (looks like the have pots for current setting like the older designs, and thus limited software motor current control), with IRUN and IHOLD parameters or by way of GOBALSCALE? They don't look as nice as the BOB boards, more like the eBay A4988 and DRV8825 boards I've seen (not ones from Pololu), the 5160 looks OK though. Also seem to lack the motor supply close to chip decoupling, the 5160 appears to have some but not the 2130 or 2190..
They do support setting motor currents via SPI, the pots are just for if you're running the driver in non-SPI mode and don't want to configure via SPI. In my case I drive the motor via STEP/DIR but configure via SPI. You can see some of the current setting configuration functions (for the IHOLD_IRUN register) in the README.MD file of this library: https://github.com/teemuatlut/TMC2130Stepper
mawyatt wrote:Also seem to lack the motor supply close to chip decoupling, the 5160 appears to have some but not the 2130 or 2190. The BOBs allow you to utilize dual limit sensors, encoders and have pins for external system clock (different from SPI clock), full 4 pin SPI, and Motor Drive Enable. These are what some of the pins are use for on the BOB, not sure exactly how the smaller boards are configured.
I know these Watterott ones have 4 pin SPI, Motor EN, and DIAG0 and DIAG1 pins for "active on stall" as well as LOST_STEP functionality. I'm using DIAG1 with a pin interrupt on the Arduino to automatically trigger, no matter what code is running, when a stall is detected. Don't think these have the limit sensor or encoder functionality but to be honest I haven't looked into them much past what I've needed to use.
They don't look as nice as the BOB boards, more like the eBay A4988 and DRV8825 boards I've seen
Yeah not as fancy of a PCB but Watterott does collobroate with Trinamic on the design of these BOBs (both being German companies). Though there are also Chinese clones of these TMC2130 boards, not as nice and you have to do a bit more work than the plug-n-play style from Watterott.
mawyatt wrote: I'm incorporating & testing code now with the RPi based systems allowing dynamic current control and modulation. This opens up a lot of options for motor control even beyond what the controllers have build in.
Could you elaborate on this a bit? By dynamic current control and modulation I'm not sure what functionality you might be adding in addition to what the driver is capable of.


I just had a thought earlier today, has anyone tried having a rail that is constantly moving as it takes photos? With your skills in minimizing jerk and vibration Mike this is probably unnecessary but it would be interesting to see how a stack would perform if you optimized the speed to cover a certain distance in the given timeframe so that each photo was taken at the optimal points. It's exactly the same as a regular stack, except the motor isn't starting and stopping each time and thus vibration may be reduced a bit.

I can see it being problematic at high magnifications and with setups that require slow shutter speeds but a quick test at 6x didn't result in discernible vibration while running the stepper extremely slowly.

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

mawyatt wrote: I'm incorporating & testing code now with the RPi based systems allowing dynamic current control and modulation. This opens up a lot of options for motor control even beyond what the controllers have build in.
Could you elaborate on this a bit? By dynamic current control and modulation I'm not sure what functionality you might be adding in addition to what the driver is capable of.
Using a soft motor transition from zero to IRUN like you get in reverse with the THOLD parameters from IRUN to IHOLD, also soft from IHOLD to IRUN. Another is a long term vs. short term IHOLD to allow long holds without too much heat buildup, but not sacrificing short term holding torque, and may use a different IRUN for going Forward vs. Reverse since gravity is involved.

I'm sure you know that micro steps and motor magnetic cog steps are not fixed locations on the shaft, they will move ever so slightly as the load varies and more so when using micro steps. For the best position accuracy one should try and stay on the cog increments which have the more holding torque. This may not always be possible, so by altering the motor IHOLD & IRUN you can compensate for the micro step lower holding torque and create a uniform position profile between cogs.

This is all an outgrowth of trying to do massive S&S sessions which require very long periods of time but still require the precision of much shorter stacks. I like to do my best with the hardware and let Zerene take care of the small misalignments, rather than be sloppy and let Zerene bail me out :roll:

I just had a thought earlier today, has anyone tried having a rail that is constantly moving as it takes photos? With your skills in minimizing jerk and vibration Mike this is probably unnecessary but it would be interesting to see how a stack would perform if you optimized the speed to cover a certain distance in the given timeframe so that each photo was taken at the optimal points. It's exactly the same as a regular stack, except the motor isn't starting and stopping each time and thus vibration may be reduced a bit.

I can see it being problematic at high magnifications and with setups that require slow shutter speeds but a quick test at 6x didn't result in discernible vibration while running the stepper extremely slowly.
[/quote]

You must be listening in on my future thinking from last year :lol:

This is certainly an option to consider once you get these Trinamic based controllers in operation and "tuned" properly. They produce almost no measurable induced vibration and with a strobe as your exposure shutter you have extremely fast effective shutter speeds. I've already achieved 1~2 second exposures, and have a very fast recycle strobe that produces very quick optical bursts for this very project, it recycles so fast that it's tripped my house breaker for overcurrent :shock:

For example, you could use a 400 step motor with a 1mm pitch thread and shoot every second with a motor half revolution (256*400/2 micro steps) for a step size of 1.25 microns. So the velocity would be 1.25 microns/second at 51,200 Pulses/second.

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

Adalbert
Posts: 2427
Joined: Mon Nov 30, 2015 1:09 pm

Post by Adalbert »

Hello everybody,
I have just started to find out the connections:
Image
But I’m not sure if SS of Arduino should go to the CSN of TMC5130.

BTW, you have already mentioned boards as: TMC2130, TCM2190, TMC5160, etc.
So, which one does work as a driver for the stacking-rail in the best way?

BR, ADi

kaleun96
Posts: 270
Joined: Sat Oct 20, 2018 3:47 pm
Location: Stockholm, Sweden

Post by kaleun96 »

Adalbert wrote: But I’m not sure if SS of Arduino should go to the CSN of TMC5130.

BTW, you have already mentioned boards as: TMC2130, TCM2190, TMC5160, etc.
So, which one does work as a driver for the stacking-rail in the best way?

BR, ADi
Yes the SS pin on Arduino will map to the CSN pin on the TMC5130.

Might be hard to say which is best as I haven't tried them all against one another. Mostly it's a matter of which version of StallGuard or SilentStep you want and how much load the driver can deliver. You can see a basic comparison here: https://learn.watterott.com/silentstepstick/comparison/

I'd like to try the TMC2209 at some point as it's their latest driver suited for our purposes, it has StallGuard4 instead of StallGuard 2 and some other small improvements. Though it uses a UART interface rather than SPI for configuration and driving the stepper motor. That may work out better for some than for others. Since I'm using an Arduino Mega I have plenty of pins for UART but other boards that's not the case. And because it uses UART instead of SPI, it's not easily switchable with the TMC2130 without re-doing the wiring.

Have you had any experience with the A4988 or DRV8825 drivers? If not I would recommend playing around with those first to get comfortable with them as these TMC drivers are quite a step up in difficulty and complexity.

Adalbert
Posts: 2427
Joined: Mon Nov 30, 2015 1:09 pm

Post by Adalbert »

Hi kaleun96,

Thank you for the info!

OK, my rail should run standalone (without any connection to the computer).
Therefore I could use UART too (the Pin0 and Pin1 of the UNO).
Actually I’m not interested in StallGuard, SilentStep, etc.
I would like to have stable steps. Please take a look at my test of the THK (last link).


BTW, I have already assembled a rail-controller based on TB6560:
https://www.photomacrography.net/forum/ ... highlight=
So, I have already used it for magn. till 100x.
With THK KR2001A (without any gear-box) works as follows:
https://www.photomacrography.net/forum/ ... c&start=15

BR, ADi

kaleun96
Posts: 270
Joined: Sat Oct 20, 2018 3:47 pm
Location: Stockholm, Sweden

Post by kaleun96 »

Adalbert wrote:Hi kaleun96,

Thank you for the info!

OK, my rail should run standalone (without any connection to the computer).
Therefore I could use UART too (the Pin0 and Pin1 of the UNO).
Actually I’m not interested in StallGuard, SilentStep, etc.
I would like to have stable steps. Please take a look at my test of the THK (last link).
Nice work! I've been reading your "Accuracy of the NEMA 17 0.9°16micro-steps & THK KR2001A" thread the past few days :D

Even though you say you're not interested in SilentStep (stealthChop) I would still recommend it. You may want to use SpreadCycle for faster movement of the rail (perhaps while finding initial position on the rail) but I would definitely recommend SilentStep for the stacking procedure. Largely because it can result in practically zero vibration and dead-quiet motor noise. It also will keep the motor cool while stepping / idle but you don't necessarily need SilentStep for that.

You could use UART on pins 0 and 1 but keep in mind that you cannot have the driver connected to these pins while programming the Arduino and/or viewing the Serial Monitor output of the IDE. The Arduino needs these pins to communicate with the computer so if you connect the driver, this communication is broken.

It's a pain to get around, you'd need a method of physically disconnecting the driver from these pins while programming the Arduino and then connecting them again afterwards. The Arduino Mega has several UART pin pairs (UART 0, 1, 2, and 3) so you can connect to the 1, 2, or 3 TX/RX pair and leave TX0 and RX0 for the programming via the IDE:
https://i.pinimg.com/originals/81/7d/47 ... 152a9b.png

The SPI boards (e.g. TMC2130) may work better for you in that case since you can use Software SPI and have a greater choice of pins to use.

Adalbert
Posts: 2427
Joined: Mon Nov 30, 2015 1:09 pm

Post by Adalbert »

Hi kaleun96,
Yes, I know the problem of UNO with the UART.
But I have already used the Pin1 for the relay.
It makes some noise when the sketch is written but programming works.

Unfortunately WATEROTT doesn’t compare TMC5130.
How big is the difference between 2130 and 5130 ?
Probably the TMC5160 is the best one because it is sold out :-)

Yes, 2130 could be for me :-)

BR, ADi

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

ADi,

Agree with kaleun96, you will want to use the Silent mode since it produces almost no motor noise even when running at high velocities.

Seems that if you are starting from a new development then go with the BOB boards with all the features, better quality board, better close to chip supply decoupling for just a few more $. The only reason I would consider the smaller boards would be to fit into a smaller existing space (think replace a A4988 or DRV8825 board), or pack more controllers onto a RPi board (thinking 3), where only 2 of the BOB will fit unless you use the RPi board backside. I might get the smaller Silent Step Stick based upon the TMC5160 for high current applications to fit 3 on the RPi board in a later project.

Haven't used the 2130 or any of the smaller boards...yet, but have fully operational and using the TMC5130, TMC5160, TMC5161 and TMC5072, all BOB boards. Basically the 5130 is the standard baseline "do all" full featured controller, the 5160 is a higher current version using separate NMOS FETs, the 5161 is a higher current version using higher current on-chip NMOS FETs, the 5072 is a dual version with lower current and less features.

Have custom boards built up with the 5130, 5160, 5161 & 5072 BOB, and 5130 & 5072 BOBs for 3 axis, and dual 5072 BOBs for 4 axis. All these custom boards have test software and stacking software, are fully operational and tested, used in evaluation stacks and 3 axis and 4 axis in S&S efforts.

The 5130 has the most testing and evaluation time, and would recommend for starters. If you decide on the smaller boards then use what kaleun96 recommends.

However, I would not recommend you use the higher current 5160 or 5161 of any flavor, since these are higher current devices which require careful attention to layout, current handling, motor, decoupling and supply details, otherwise you likely will be replacing the boards and possibly motors!!

Get your feet wet first with the 5130 or what kaleun96 recommends before diving in on these high current 5160 & 5161 devices. I only got all these right the first go around because of years experience (>50) in electronics dealing with many similar electrical situations (high currents and frequency). So kind of "been there done that" which helped avoid all the pitfalls that lay ahead, and believe me there are many pitfalls awaiting!!

The nice commercial controllers we use from Stackshot, WeMacro and so on have lots of engineering, development & testing time behind them. That's why they work so well and don't require a high degree of attention to the controller and motor interface details, you can follow the directions and be up and shooting in short order :D

Not so with these complicated, custom built, DIY controllers which require a tremendous level of learning and attention to detail :shock: Once you've paid that price the level of performance is amazing tho :)

Best,
Last edited by mawyatt on Fri Jun 28, 2019 6:54 am, edited 1 time in total.
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

Adalbert
Posts: 2427
Joined: Mon Nov 30, 2015 1:09 pm

Post by Adalbert »

Hello Mike,
Many thanks for the explanation!
So, the best candidates for me would be 5130 and 2130.
Unfortunately WATEROTT doesn’t offer any 5130.
BR, ADi

Post Reply Previous topicNext topic