Welcome! Log In Create A New Profile

Advanced

Detecting when a move command sequence finishes

Posted by sarangj 
Detecting when a move command sequence finishes
July 03, 2015 04:45PM
I am working on a project using a 3D printer that is focused primarily on low-level control of its movement properties. I'm using a PrintrBot Metal Simple as a test bed. I have the ability to send G codes and receive data over the serial port.

Since G0/G1 move commands are buffered, it seems that there is no way of knowing when the printer has actually finished executing the move command. G28, for example, seems to return an "ok" response only when the printer has physically returned to the home position, whereas a G0/G1 command instantly returns an "ok" response, even though the printer is still in motion. Is there a way that I can detect the end of a move command?

Also, because of this property, when I send a M114 command (to find the current position) after a G0/G1 move command, the printer returns immediately with what seems to be the predicted position at that point in the g code sequence. Is there a way to receive the hardware position at the time of the printer receiving the command?

Thanks for your help!
Re: Detecting when a move command sequence finishes
July 04, 2015 12:58AM
Check out the M400 command. I believe it returns ok after all buffered commands finish.
Re: Detecting when a move command sequence finishes
July 04, 2015 02:53AM
You could try to measure the time elapsed, since the G0/G1 code was printed.
With the given acceleration/speed and coordinates of the starting point, you can calculate the estimated time for the hole move.
It´s an integral calculation, not the easiest one ( acceleration and deceleration). Maybe the 8bit controllers are to slow to do it while printing...

If you need to know it before you print, you could write a gcode-postprocessing-routine ( excel? ). So the PC will have all the hard work...
-Olaf
PS: Another way to know, when the move is finished is reading the "step" signals of the x/y drivers.

Edited 2 time(s). Last edit at 07/04/2015 03:02AM by o_lampe.
Re: Detecting when a move command sequence finishes
July 08, 2015 02:25PM
@jbernardis - M400 (and the equivalent G4 P0) is exactly what we were looking for! I think we might estimate the time taken to finish the command (as @o_lampe suggested), and then to confirm that the command has finished use M400.

Thanks!

Edited 1 time(s). Last edit at 07/08/2015 02:27PM by sarangj.
Sorry, only registered users may post in this forum.

Click here to login