Quantcast
Channel: Reprap Forum - Firmware - Marlin
Viewing all articles
Browse latest Browse all 2836

Step Motor Speed (2 replies)

$
0
0
Hi, I am using MKS Robin Nano v3.0 card

I am controlling Step Motor (Nema 17 0.47 Nm)

Here is the simple python code that to move step motor and wait for its finish

device.serial.write("G91\n\r".encode())
while 1:
    data = device.serial.readline()
    if data == b"ok\n":
        break

s=time.perf_counter()
for i in range(25):

    device.serial.write(b"G1 Z0.001\r\n") # move up 1 micrometer (0.001 mm)
    device.serial.write(b"M400\r\n")      # wait for current move finish
    c = 0
    while 1:
        data = device.serial.readline()
        print(data)
        if data== b'ok\n':
            c += 1
        if c == 2:  # "ok" message will return after "G1 Z0.001" and "M400" command
            break
print(time.perf_counter()-s)


output: 2.56 seconds. Total time is 2.56 second for 25 step (25 micrometer)

Problem : I think step motor is very slow, I am not expert driving step motor, I change some parameter via software but total time is very long time, how can I reduce this time ?


Here the other scenario ( I only added time.sleep(0.1) before the next command ):

device.serial.write("G91\n\r".encode())
while 1:
    data = device.serial.readline()
    if data == b"ok\n":
        break

s=time.perf_counter()
for i in range(25):

    device.serial.write(b"G1 Z0.001\r\n")
    device.serial.write(b"M400\r\n")
    c = 0
    while 1:
        data = device.serial.readline()
        #print(data)
        if data== b'ok\n':
            c += 1
        if c == 2:
            break
        
    time.sleep(0.1)    
print(time.perf_counter()-s)

Now total time is 2.77 seconds but I expect 25*0.1 + 2.56 = 5,06 seconds

Where I am wrong ?

Step motor input voltage 24V

Thse are current settings:

>>> M503
SENDING:M503
echo:; Linear Units:
echo:  G21 ; (mm)
echo:; Temperature Units:
echo:  M149 C ; Units in Celsius
echo:; Steps per unit:
echo:  M92 X400.00 Y400.00 Z25600.00
echo:; Max feedrates (units/s):
echo:  M203 X15.00 Y15.00 Z1000.00
echo:; Max Acceleration (units/s2):
echo:  M201 X180.00 Y180.00 Z1000.00
echo:; Acceleration (units/s2) (P R T):
echo:  M204 P180.00 R180.00 T180.00
echo:; Advanced (B S T X Y Z):
echo:  M205 B20000.00 S0.00 T0.00 X10.00 Y10.00 Z1000.00
echo:; Home offset:
echo:  M206 X0.00 Y0.00 Z0.00
echo:; Stepper driver current:
echo:  M906 X800 Y800 Z800
echo:  M906 I1 X800 Y800
echo:; Hybrid Threshold:
echo:  M913 X104 Y104 Z123
echo:  M913 I2 X104 Y104
echo:; Driver stepping mode:
echo:  M569 S1 X Y Z
echo:  M569 S1 I1 X Y


Also config files attached.

Viewing all articles
Browse latest Browse all 2836

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>