Crazy new idea … I’ve been playing around with using an extruder step pin (which follows acceleration) with promising results. Thought I’d share my research here in case others have ideas.
What I did was (this is all on RAMPS):
- Changed the extruder pin to D11 so I can access it from the board easily
- Changed extruder steps to 20 (to control the timing on the pin)
- Connected the extruder STEP pin (D11) into an ESP8266 that monitors the stepper timing (the plan is that the ESP8266 would then output a PWM signal matching the extruder step rate)
- Wrote a small program to monitor the steps and report on the timing in microseconds
I found the acceleration was giving me a bunch of headaches, as was trying to control extrusion without affecting the desired speed (since extrusion is based on volumetric flow and affects distance moved based on flow). So I made these changes:
- M200 D0 ; disable volumetric extrusion, using linear instead
- M201 E400 ; set extruder to use same acceleration as XY is defaulted to in the firmware
Both of these settings can go into firmware as well, but for now it’s easier to play with the gcode.
Finally, I set the “laser power” using the extruder flow rate via M221 S### where S controls the relative flow rate.
With these settings, I find I see fairly accurate timing of the movement including acceleration. I’m not out of the woods yet, but here is what I have:
Setting flow rate at 100:
- M221 S100
- G1 X50 Y50 E40 F3000
- After acceleration, I see pulses around 850us, with deceleration slowing down to around 6000us. Total run time is 845ms.
Setting flow rate at 200:
- M221 S200
- G1 X50 Y50 E40 F3000
- After acceleration, I see pulses around 423us (twice as fast) with deceleration slowing down to around 2900us. Total run time is 878ms (or about 3.75% slower than flow rate 100).
Setting flow rate to 10:
- M221 S10
- G1 X50 Y50 E40 F3000
- After acceleration, I see pulses around 8800ms (10x) with deceleration slowing down to around 18000us. Total run time is 765us (or 9.46% slower than flow rate 100).
So the fantastic news here is that the pulses have a very nice, linear alignment to desired power.
But why does feed rate change (10% at low speed) as that isn’t great for consistent burn. Now it is worse at low values, and those likely have less impact on the laser usage but I’d like to try to figure out how to mitigate this.
I do know that acceleration plays a big part of this. If I disable all acceleration, the problem goes away (but then again, we lose all tracking of acceleration which is the point of this silly project). I tried lowering just the extruder to a lower scale - like M201 E50 - the timing problem gets much worse. When I raise it - like M201 E2000 - the timing doesn’t change much, but the relative stepper delay is worse for converting to PWM.
One other detail is that the post processors will have to calculate the value for E based on feed rate, as that controls the total XY movement speed - but my few initial tests show this is doable using a linear equation. I’ve not done much testing here to be confident of that so that could present new challenges.
What do you think? Hopefully this is all pointless soon if Marlin gets laser working out of the box, but for the cost of an ESP-M1 (less than $2 from china, and under $5 in US) it’s not expensive to play around with.