0

Using Audrino Nano and MKS SERVO42 42 Stepper Motor With Driver Board Closed Loop with the LCD. I have got the motor going by using the menu on board. Now able to run Code1 https://github.com/makertut/Arduino-Closed-loop.git out of GitHub and it runs as it is designed. Line 5 int numstep = 1030; cc runs the number of steps indicated and changing this number will determine the movement. I can do the math to calculate the degrees for number of step for a particular stepper. I would like to use degrees instead of steps for my program. Does anybody know how to code this? Thanks Greg

4
  • 1
    convert the angle to step count
    – jsotola
    Oct 26, 2020 at 0:53
  • 1
    You can find the number of steps per revolution in the specification of the stepper motor. Then just calculate the angle from the steps. Simple rule of three
    – chrisl
    Oct 26, 2020 at 9:38
  • If you can calculate the number of steps per degree you can calculate the number of degrees per step. It's high school math. Not even high school math. It's bordering on preschool math...
    – Majenko
    Oct 26, 2020 at 10:49
  • Thanks for reply. I said I could do the math in my question. Maybe I wasn't clear in my question or didn't supply enough info. I going to monitor multiple sensors, When one sensor is detected I want the stepper to turn to a certain degree such as 45, If another, different sensor is detected it would move to that place say 90. Every sensor would be assign a specific degree or position. Will steps act the same as degrees? If the stepper is at 90 degrees (or 50 steps) and the first sensor is then detected will it move to the 45 degree position (or 25 steps) position. 360/1.8=200
    – Greg
    Oct 26, 2020 at 22:30

1 Answer 1

1

This is basic algebra 1.

Say steps / degree = 5

So write that as 2 fractions:

steps   5
----- = -
degree  1

Then take the reciprocal of both sides:

degrees   1
------- = -
step      5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.