Welcome! Log In Create A New Profile


Marlin, Dwell Command (G4), and Acceleration

Posted by Hypoborean 
Marlin, Dwell Command (G4), and Acceleration
March 02, 2019 05:49PM
Hi all,

I'm using Marlin+Pronterface to drive a set of electric motors + an inkjet printhead.

The issue I'm having is how the dwell command interacts with my movement command set. As an example, if I'm trying to print an array of 60x60 droplets, using Gcode to move to each position in turn before printing a single droplet by trying pin P4 high and then low, I can print that pattern in ~60s if I don't include any dwell commands.

In that case, each 'droplet' print appears as:

M42 P4 S255
M42 P4 S0
G0 X0.5 F7000 [or Y0.5, if I'm moving to the next line]

However, while this works fairly well for the 60x60 case, if I do a test that's only 10x10 I get some pretty odd results.

First, the first 15 droplets all come out before the carriage starts moving. This means a bunch of "pin high; pin low" commands are processed before the G0 commands that happen BEFORE them in the Gcode file. This isn't a case of the printhead being triggered multiple times by a single pin high command though, because the last fifteen droplets in the 10x10 pattern are missing (even though the printhead moves along their path after it's stopped firing).
Second, even for the 85 droplets that come out "normally" they aren't regularly spaced out in the line. The first two and last two droplets have different inter-droplet spacings than the ones in the middle of the line, probably due to the printhead accelerating.

I was able to fix this acceleration and general weirdness problem by adding a dwell command before each droplet. This means that each 'droplet' print instead appears as:
G4 P1 [1 ms]
M42 P4 S255
M42 P4 S0
G0 X0.5 F7000

This produces a nice even grid of 10x10 droplets. However, if I try to print 60x60 droplets, the print that used to take ~60 seconds without that dwell command now takes ~540 seconds (9 minutes). That is, adding 3.6s of total dwell time to the print increases the print time by ~480 seconds, or about 120ms per droplet (where the inter-droplet spacing is 0.5mm). I thought this was a problem with the time it takes to accelerate / decelerate, but increasing the X acceleration from 3000mm/s^2 to 12000mm/s^2 using the M201 command (and increasing the P,R, and T accelerations from 3000mm/s^2 to 12000mm/s^2 as well with the M204 command, as otherwise their upper limit seems to override the increased X-acceleration and produce no change) only decreases the print time from ~9 minutes to ~8 minutes (and make the print carriage much noisier).

Also bizarrely, adding 'extra' dwell commands do not seem to affect the print time
G4 P1
M42 P4 S255
G4 P2
M42 P4 S0
G0 X0.5 F7000
The above pattern (with 3 dwell commands per motion, not 1) also prints the 60x60 pattern in ~9 minutes.

So, at this point, it seems like EITHER the dwell command has a secret minimum dwell time that only applies to the first dwell to occur after a G1/G0 motion command, or the acceleration routine has a secret minimum acceleration time that is only slightly affected by changing the acceleration in X.

I need my 60x60 prints to happen in ~1 minute for solvent drying reasons, but having to deal with all the acceleration weirdness and get consistent prints is very daunting, so I'd really like to speed up the "dwell before every droplet" method if at all possible. Does anyone know how to do this?

Re: Marlin, Dwell Command (G4), and Acceleration
April 17, 2019 01:45AM
I'm not sure I've understood the problem but maybe you can start the motion before the ink is activated so that the print head is up to speed before printing. Then activate printing and when done add extra motion without printing to decellerate. So use a lead in and a lead out, if you've got the space to do so.

Kind regards

NFAN CoreXY printer:
Sorry, only registered users may post in this forum.

Click here to login