OT: stall detection DC motor / Stepper

76 views
Skip to first unread message

Bas de Bruijn

unread,
Jul 13, 2019, 1:38:04 PM7/13/19
to machi...@googlegroups.com
Hi,

I’ve recently been asked about a stall detection, from a DC motor, or a stepper with one of the trinamics silent stepsticks with stall detection.

The DC motor should be driven by switching an on/off relay and left/right by switching direction by a relay, and i want to check when the motor stalls (runs into an endstop).

For the stepper motor, I’d want to detect missing steps, but other than I know these drivers are on my prusa, I have no knowledge on these and if these would be plug and play with for example a cramps board.

Anyone with experience on these 2 applications? The reason I would not use encoders is that I’d like to have an alternative to “just buy closed loop driver + motor + encoder”. Most important is that this should be a reliable setup, where performance may suffer at the expense of cost.

Cheers,
Bas

justin White

unread,
Jul 13, 2019, 6:06:45 PM7/13/19
to Machinekit
How’s the dc motor driven? Straight dc, or a dc drive of some type? Assuming it’s just a brushed dc motor you can install a current sensing device like a shunt resistor and feed it back to an analog input. A stalled dc motor will draw high current. You can use a comparator in Hal to trigger a fault output when the analog input voltage is higher to the setpoint on the other comparator input. Better idea is to use an h-bridge driver that has its own current fault output. Dc motors do a number on relay contacts used for reversing anyway so a simple drive is a better bet.

I didn’t see good documentation on those step drivers on the website but the only one I see with stall detection is the spi model. There are 1 or 2 diagnostic pins, find out how they work. If they output high or low level on a current fault you can use them on a gpio input. Otherwise maybe they do something over spi? If you find out more I could probably help you better.

Bas de Bruijn

unread,
Jul 14, 2019, 4:18:59 PM7/14/19
to justin White, Machinekit


> On 14 Jul 2019, at 00:06, justin White <blaz...@gmail.com> wrote:
>
> How’s the dc motor driven? Straight dc, or a dc drive of some type?

The former, just to move a gripper to a position. No need to have position control, no need to be fast, just running into a product making physical contact. I prefer to have a signal in my program logic as opposed to working with timers to make sure I’m at the right position.

> Assuming it’s just a brushed dc motor you can install a current sensing device like a shunt resistor and feed it back to an analog input. A stalled dc motor will draw high current.

Yes, and I’d like to prevent burning the motor so I’d like to switch off the motor when stalled. I’d hoped there was some protocol board, but I guess that I need to do some calculations depending on supplies voltage (24 or 12V) and motor resistance. I’ll start digging.

> You can use a comparator in Hal to trigger a fault output when the analog input voltage is higher to the setpoint on the other comparator input. Better idea is to use an h-bridge driver that has its own current fault output. Dc motors do a number on relay contacts used for reversing anyway so a simple drive is a better bet.
>
> I didn’t see good documentation on those step drivers on the website but the only one I see with stall detection is the spi model. There are 1 or 2 diagnostic pins, find out how they work. If they output high or low level on a current fault you can use them on a gpio input. Otherwise maybe they do something over spi? If you find out more I could probably help you better.

Yes, I need to dig into spi for those drives. I’m getting a few to test.

Thanks!

Bas de Bruijn

unread,
Jul 14, 2019, 4:23:21 PM7/14/19
to Chris Albertson, machi...@googlegroups.com


On 14 Jul 2019, at 02:56, Chris Albertson <alberts...@gmail.com> wrote:

For a DC motor, there are two things you can try.    

1) Measure the current.  Actually, you measure the voltage across a shunt resistor and if the current is above some threshold you may assume the motor is stalled.
2) You need to place a shaft encoder on the motor and measure the position/speed and then if it is not what you expect you can assume it is because the motor is stalled.     Encoders cost about $10 on eBay and are easy to use.

For a stepper motor only #2 is possible.  

That’s a great idea too, just some simple low resolution encoder, I just need to know if the speed has dropped. Some experimentation if  I can detect this is fast enough to not burn the motor.

Thx!

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/0770E383-352E-466C-9042-0C6824D40398%40basdebruijn.com.
For more options, visit https://groups.google.com/d/optout.


--

Chris Albertson
Redondo Beach, California

Michael Brown

unread,
Aug 19, 2019, 8:21:56 AM8/19/19
to Machinekit
Hi Bas
So far I have not been able to generate any documentation for my Trinamic_SPI tool yet:
However I have (in the summer months) been dabbeling with A setup to utilize Trinamics Stall detection in Machinekit on the Mksocfpga
Using the Mesa (D)BSPI's and a ham component, together with a Gui for machinekit client.
For now only for the Trinamic drivers with a 20-bit config string like tth:
TMC262_BOB60_V1_2
TMC2660_BOB_V1_2

(not the cheaper 40 bits ones)

This setup:
DExx_Nano...
and machinekit client
Plus a Trinamic SPI driver with 2-bit config registers.

Enables setting and testing Trinamic SPI parameters on 1 stepper, and looks like this.

Trinamic_spi.png

:-)


On Sunday, 14 July 2019 22:23:21 UTC+2, Bas de Bruijn wrote:


On 14 Jul 2019, at 02:56, Chris Albertson <alberts...@gmail.com> wrote:

For a DC motor, there are two things you can try.    

1) Measure the current.  Actually, you measure the voltage across a shunt resistor and if the current is above some threshold you may assume the motor is stalled.
2) You need to place a shaft encoder on the motor and measure the position/speed and then if it is not what you expect you can assume it is because the motor is stalled.     Encoders cost about $10 on eBay and are easy to use.

For a stepper motor only #2 is possible.  

That’s a great idea too, just some simple low resolution encoder, I just need to know if the speed has dropped. Some experimentation if  I can detect this is fast enough to not burn the motor.

Thx!

On Sat, Jul 13, 2019 at 10:38 AM Bas de Bruijn <b...@basdebruijn.com> wrote:
Hi,

I’ve recently been asked about a stall detection, from a DC motor, or a stepper with one of the trinamics silent stepsticks with stall detection.

The DC motor should be driven by switching an on/off relay and left/right by switching direction by a relay, and i want to check when the motor stalls (runs into an endstop).

For the stepper motor, I’d want to detect missing steps, but other than I know these drivers are on my prusa, I have no knowledge on these and if these would be plug and play with for example a cramps board.

Anyone with experience on these 2 applications? The reason I would not use encoders is that I’d like to have an alternative to “just buy closed loop driver + motor + encoder”. Most important is that this should be a reliable setup, where performance may suffer at the expense of cost.

Cheers,
Bas

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to machi...@googlegroups.com.

Michael Brown

unread,
Aug 19, 2019, 10:23:19 AM8/19/19
to Machinekit

justin White

unread,
Aug 19, 2019, 11:46:19 AM8/19/19
to Machinekit
It didn't occur to me to mention it when I first replied to this post, but I have a component for something similar that I use to detect spindle stall on my mill. It's a pretty simple component and it could probably benefit from a  time based pin, but it does work well on my mill and since it looks like you may wind up using an encoder this might work for you. I've never compiled it for ARM but it should compile fine.
spindle_monitor.comp
Reply all
Reply to author
Forward
0 new messages