*Learn
How to Program in PHP, the Code below will create the Calculator Above. *Say It!

**This example and the above calculator are to help with DIY CNC Software Configuration, Mach3, EMC, and interpreting Firmware requires this information and usually in Metric measurement.**

**Determine
Steps per MM using Imperial Threaded Bar (Steps per MM):**

**To
help, if you don't know what the T.P.I (Threads Per Inch) is for your machine just count the threads within one inch then follow the link below to boltdepot and use the Chart for help.**

https://www.boltdepot.com/fastener-information/Measuring/US-TPI.aspx

Common Step Angle for Stepper-Motors:

1.8-Deg * 200 = 360-Deg

0.9-Deg * 400 = 360-Deg

Axiom #1 *** One Revolution = 360 Degrees ***

Axiom #2 *** One Inch is equal to 25.4-MM ***

**With
that information we can make a Calculator!**

Two values are required to get 360-Deg or one revolution. Say for fun the stepper being used in this example has a step angle of .5 deg, we calculate that by using the following equation 360/.5 = 720 steps per revolution.

Now onto the Threads-Per-Inch or TPI, one thread is equal to one revolution so it will take 720 steps to make one revolution, if the bar is 16-TPI we multiply; 720*16 = 11520-steps per inch.

To go from steps per inch to steps per MM we now convert one more time by using 25.4, in this case one “ 25.4th” of one inch is 453.5433070866142 steps, so, to get to one MM with a .5-Deg Motor with a 16TPI Screw the Motor will require 453.5433 pulses to move one MM, or 2.267716535433071 revolutions. This is also known as PWM an acronym for Pulse Width Modulation.

Some PHP Source code!

<?php

function inchmm(){

if (isset($_POST['stepangle'])) {

$rotation = '360';

$inchtomm = '25.4';

$stepangle = $_POST['stepangle']; // user entered value

$TPI = $_POST['TPI']; // user entered value

$numsteps = '$rotation/$stepangle'; // one inch

$stepperinch = '$numsteps*$TPI';

$steppermm = '$stepperinch/$inchtomm';

echo $steppermm;

echo ' Steps Per MM from $TPI Threads Per Inch';

}

}

inchmm();

?>

<form action="index.php" method="post">

Enter Step Angle: <input name="stepangle" type="text" /><br>

Enter TPI (Number of Threads in One Inch): <input name="TPI" type="text" />

<input type="submit" />

</form>

Try It Above!