Notifications
Clear all

convert steps to inches

3 Posts
2 Users
3 Likes
406 Views
(@muggs)
Member
Joined: 3 years ago
Posts: 3
Topic starter  

Hello All,

First time post. I'm driving a NEMA23 linear ball screw with an Arduino Nano, and I have determined that 4072 steps will move the carriage 1.000".

What I am trying to do inside the sketch is:

Set 1.000 = 4072 (with a float variable or map function?) So when the user inputs a dimension eg.1.125 the stepper will move 4581 steps in this example.

Maybe just multiply the input by 4072 each time!?

Anyway, that's the issue, so any feedback you be greatly appreciated.

TIA,

Muggs

 


   
Biny reacted
Quote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2535
 

@muggs

Welcome to the forum.

float   stepsPerInch = 4072.

....

float distance =  1.125; // whatever you calculate as distance

long  steps = distance*stepsPerInch;

 

Gives steps = 4581.

You want to keep steps per inch and distance in float to maintain accuracy. Multiplying them and assigning the result to a long will result in a usable step count.

If you want to improve this, you can round the product before assigning it to the long variable, but at 4072 steps per revolution, your maximum error is only .0122% anyway.

Anything seems possible when you don't know what you're talking about.


   
Inst-Tech and Biny reacted
ReplyQuote
(@muggs)
Member
Joined: 3 years ago
Posts: 3
Topic starter  

WOW, thanks Will! This is great, I will implement it get back.

Thanks also for the welcome.


   
ReplyQuote