MKS closed loop stepper 42b

Need help with Coding for the MKS closed loop stepper. Have been tru several tutorials using regular Nema17 and can get them to function as the code describes. Using a Arduino Nano, and DRV8825 driver with expansion bd. Going to the MKS 42b, you remove the driver and replace with cable to the encoder/driver on the stepper. Able to get the code provided on GitHub to work, but not any further. For now I want to code the stepper to go to a specified position in degrees. If I can get that far, I will be able to set up an array for the different position I need with input for sensor to analog ports.
Is this enough to go on or do I need to provide more info?

Hi @GregM,

Could you link the code provided on GitHub? Is it this one?

I see that it is based on this project: Misfittech and they have a command list that mentions the “move” command which is exactly what you need to use for your project.

Thanks for the reply, I got the code from GitHub. But opening this one, it looks different than what I was going to before? Before when I down loaded the code I ended up with a “Code 1” I believe. So let me check this out . Will the Misfit code work on the MKS as well?
A lot of the sites I check out mostly said how to check it out or said it was a good replacement option for 3d printing, but gave little info on coding it for other uses.
Thanks for any help

The MKS SERVO42B is a board that combines an STM32F103C8T6 microcontroller and an encoder to control and get feedback from the stepper motor, but makerbase also provides the firmware to “easily” use it. To upload the firmware simply follow their user manual which I believe is what you’ve already done, however as you mentioned there’s not a lot of documentation on how to use for other applications so I suggest contacting the manufacturer/developers directly. About the compatibility with the Misfit firmware I think you should read this:

If you want my recommendation, if you are a beginner and you want to control a stepper for a specific project (not to replace the stepper on a 3D printer) and you want to learn about this I recommend you to follow the route you had before, use an arduino and a stepper driver with good documentation and preferably with a library or example code that you can follow and modify according to your needs.

1 Like

Thanks again for the reply. I think for now I’m going with your recommendation. I have found some sketches that I think I can adapt for my project. Some are using different libraries or none. Best way to find documents showing the meaning of terms “commands” so I can covert to the library I’m using (AccelStepper).

1 Like

A post was split to a new topic: Arduino Nano + DRV8825 + NEMA17 Error