Closed loop stepper help - Detect physical resistance

Hi all,

I've been working on my stepper motor/Uno project and have come to realize I likely need a closed loop motor with an encoder to achieve my objectives.

Basically imagine the stepper is connected to a cog and rotates in certain patterns and speeds. This is not for a printer. As part of a game, a person tries to grab the cog, but not necessarily with enough strength to halt the stepping. I want the program to be able to detect any sudden change in resistance on the cog, and to perform other actions.

I've been looking into buying the MKS Servo42C for my purposes. Link is here.

Will the MKS work for this purpose? Does anyone have any example code to detect stepper resistance? I can't seem to find any code/functions on this. I'm currently using Mobatools for my open loop stepper, not sure if that'll still be viable.

Thanks for any advice.

I doubt you will get any related replies other than to say it appears your design includes likely personal injury, so no further comment.

This project has nothing to do with injuring people or torture if that's what you were thinking. No one's actually putting fingers into cogs, but the concept of placing physical resistance against the stepper is similar.

If I understand right you want to detect mechanical "resistance"
with using the correct tecnical terms You want to detect an increase of torque while a cog is rotating.

A stepper-motor is designed to STEP
This means by any chance rotate to the next FINISHED step.

If you apply a higher torque to a stepper-motor the stepper-motor will
finish its step completely if the torque that the stepper-motor creates is higher than the mechanical torque applyed
or
loose a step completely if the torque that the stepper-motor creates is smaller than the mechanical torque applyed

The electrical current that flows through the stepper-motor will always be the same.
Regardless if the stepper-motor is "free-wheeling" or works against any amount of torque.
Because the current flows through the stator = the still standing not moving part of the stepper-motor.

All in all a stepper-motor even a closed loop stepper-motor is not suitable for detecting a change in mechancical torque

If you want the community and its knowledge to really help you with your application
the best thing is to describe in detail what your device is.

No idea if a device that is able to measure mechanical torque is the right thing for you.
Other motors like classical DC-motors or brushless motors are easier to use for measuring mechanical torque.

a torque-sensor like this

Use a motor driver that has a current monitor output.

And use a motor where the current changes under load.

A stepper-motor regardless of beeing a open-loop or a closed-loop stepper-motor
does not change its current under load.

Edit as I have learned from the MKS Servo 42C
This special-driver of the MKS-Servo 42C can indeed report back torque

It looks like the MKS-Servo42C gives a measure of error between the steps called for and the steps moved:

command 4: e0 39 tCHK

read the error of the motor shaft angle.

Return e0, error(int16_t), rCHK.

The error is the difference between the angle you want to control minus the real-time angle of the motor, 0-FFFF corresponds to 0~360°, for example, when the angle error is 1°, the return error is 65536/360= 182.444, and so on.

Example:

Send e0 39 19

return e0 00 B7 97 (error 1 °)

User manual:

The correct design for this product is a flexible coupling between the stepper shaft and the device it turns. Timing the difference between a step of the motor and a step of the device will tell you the resistance of the device.

Edit: I used the wrong term for the coupling. It should be a resilient coupling so it will return to it's original state when the torque difference is removed.

The wiki does not tell anything on the wiki-mainpage about the special features
only the main-main-page

I would likely be looking at a rotary torque cell to sense the load and when the load increases do whatever you choose your motor to do. A rotary torque sensor for example will monitor your free running torque and if a load is applied the torque will increase and when it hits your preset limit you decide what you want to happen.

Ron

OK the MKS 42C has a "torque"-mode.
I found in the manual

Set the maximum torque (MaxT) parameter

command28: e0 a5 XX XX tCHK
MaxT value range (0 ~ 0x4B0). (Default 0x4B0)
Return e0 , result (uint8_t), rCHK.

result:
01- successful;
00- Failure

For example:
Send "e0 a5 02 58 df" (MaxT = 0x258)
return "e0 01 e1" (successful)

which means set a max torque. What the TO wants sounds like request actual torque at any time, receive actual torque and send the torque-value towards the microcontroller.

It seems like the MKS can indeed provide torque information.

See youtube video I found and the torque test at 4:08.

https://youtu.be/R1TghZmE6Gs?si=YWmbIckQkNddJKTo&t=248

The github manual isn't particularly helpful. StefanL38, do you have any suggestions on how to implement torque mode in Arduino IDE? I'm not familiar with working with hex.

The video shows
If motor stands still = 0 rpm an a external torque is applied to the motorchaft the display shows the position-error

applying torque to the steppermotor-shaft

display showsposition-error

You have described:
"cog will be rotating (instead of standing still) a person tries to grab the cog which will apply extra torque to the stepmotor-shaft"

very unprecise description.
There is nothing like implementing the torque-mode into the arduino-IDE

The torque-mode is something the motordriver is adjusted to.
If you go on beeing that unprecise I highly doubt that you will get things working.

What you are looking for is the error-angle

google is always worth a five minute search
https://www.google.com/search?q=arduino+ide+hexadecimal+numbers

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.