Welcome! Log In Create A New Profile

Advanced

Marlin Input Shaping on Prusa?

Posted by baobab_pig 
Marlin Input Shaping on Prusa?
February 12, 2023 07:24PM
I have an old, well used, second hand Prusa MK2. I have modded it quite a bit and changed firmware to marlin 2.0.9.3.

However, the printer frame is not rigid and the whole machine vibrates when printing with high acceleration. I find that accel of ~1000 and jerk of 10 (or even lower) works fine, while anything higher results in too much vibrations. Even if I don't care about print quality (surface finish), I wouldn't use much higher acceleration, because I feel that the machine would shake itself apart after long use.

The new version of Marlin (2.1.2) has introduced Input Shaping, so I'm wondering:

1) Can it be used on a Prusa with its 8-bit board at all? If it can, are there some restrictions? Has anyone tried it?

2) Is it worth it? That is, does it make sense to use Input Shaping, not to achieve very high speed and accel (which an old MK2 can never dream of in any case), but for protecting the hardware at only slightly increased acceleration (e.g. 2000-3000)? Would it also reduce noise?
Re: Marlin Input Shaping on Prusa?
May 26, 2023 06:22AM
I have finally tested this myself, and the conclusion is the following:

Input Shaping can be used on 8-bit board, BUT only for a single axis (e.g. Y) and it still slows down when printing detailed shapes (e.g. circle with many segments). Therefore it's pointless (except maybe for large simple shapes to print, more to remove ringing on accel 1500-2000 then to achieve higher accel).

To have Input Shaping on 8-bit board, it seems that the only option is external computing power and Klipper.
Re: Marlin Input Shaping on Prusa?
May 26, 2023 10:33AM
The first input shaping added to Marlin was deigned and tested on a 8 bit board.

The issue is not all 8 bit boards are equal.

IS takes quite a bit ram, It was designed on a atmega1284p which has 8 KB while the much more commonly used atmega2560 only has 4KB of ram

You can run IS on a mega2560, but you have to reduce the max feed rates to reduce the amount of ram used.

You also seem to be a little confused

All machines no matter how rigid have a resonance frequency. IS is designed to avoid this frequency.

It it not designed to 'fix' a floppy loose machine

Edited 2 time(s). Last edit at 05/26/2023 10:36AM by Dust.
Re: Marlin Input Shaping on Prusa?
May 26, 2023 11:11AM
I use Marlin input shaping myself with both X and Y axes on an ATMega2560. It makes a significant difference and, when combined with the stepper optimisation changes coming up in 2.1.3, allows an 8 bit board to achieve much higher speeds and accelerations than before. The physical components of my printer are nothing to write home about, it's entirely home-made from a combination of home-printed, scavenged and aliexpress components. The PSU is 12V. And, as I say, the mainboard is 8 bit. Yet I am close to printing a sub 20 minute benchy with it.

To be able to use IS with an ATMega2560 you need some available RAM and that may mean making some config trade-offs. I use bilinear leveling rather than UBL, which helps. As it happens I really like bilinear so this is not a problem for me.

With limited RAM it is also worth paying close attention to `DEFAULT_MAX_FEEDRATE` as Dust recommends (the default values are possibly higher than you'd can get anyway so reduce them to something realistic). Alternatively just directly override `SHAPING_MAX_STEPRATE`, following the advice in the comments above the input shaping config section. This will give shaping that is less effective at high speeds but which still adds a lot of value. Also, if you're setting `SHAPING_FREQ_X` and `SHAPING_FREQ_Y` to zero for a default shaping off behaviour, ensure `SHAPING_MIN_FREQ` is set to the lowest of your axis resonant frequencies.

And, of course, tighten up any slack physical components on the printer. This is just good to do anyway for print quality but it will also increase resonant frequencies which will reduce the need for a larger IS buffer.

Oh and, full disclosure, I implemented both the IS and stepper optimisation changes. So I have a vested interest here.
Re: Marlin Input Shaping on Prusa?
May 26, 2023 12:40PM
Thank you for replies.

I know that IS is not designed for compensating a bad machine frame, but I wondered if it could help, that's why I asked as I couldn't find any info on it. I did make the frame on my printer stiffer (with Z braces) before trying IS, and the print quality improved a bit. However, it's an old printer so it also has well used bearings (especially on Y axis). I don't want to invest too much in this machine (both money and time) as it does print pretty well now, only at slower speeds (I use accel 800 most of the time). I just want to make most out of this printer without spending much more (if I spend some money, I'll rather buy a new printer later, I'm looking at Positron V3).

I'm glad that I was wrong, that it is not pointless to use IS on 8-bit board. When I have time, I'll try out 2.1.3 (or even later) to test IS again. I don't have any background knowledge about firmware (I've learnt what I know by fixing and setting up this and a few other printers recently), so I had no idea what to do with IS other than using default settings and measuring frequencies on a test print.

My DEFAULT_MAX_FEEDRATE is 150, and I rarely print higher than 100mm/s. I shall test SHAPING_MAX_STEPRATE, what value should I use, is the default 10000 good for my machine?

I use manual mesh bed leveling (without a probe), but only sometimes (I switch between two plates: glass and creality magnetic one). When printing on glass, I don't need mesh bed leveling, does it affect RAM usage if it is enabled in fw but turned off?

To reduce RAM usage I shall consider removing some options from configurations, but I don't know what affects RAM and how much. These are some options that I changed from the default config that I can live without, which of these can be removed to reduce RAM usage?:
ADAPTIVE_STEP_SMOOTHING (I don't even know what this does, I only found info that it is "better")
PRINTCOUNTER
LCD_INFO_MENU
STATUS_MESSAGE_SCROLLING
SET_PROGRESS_MANUALLY
SHOW_REMAINING_TIME *
POWER_LOSS_RECOVERY
SDCARD_SORT_ALPHA
LIN_ADVANCE
EXTRA_FAN_SPEED *
FWRETRACT (autoretract off)
ADVANCED_PAUSE_FEATURE
VOLUMETRIC_EXTRUDER_LIMIT *
GCODE_MACROS *
CANCEL_OBJECTS *
*I added these after giving up on IS

What else can be done to reduce RAM usage?

Edited 2 time(s). Last edit at 05/26/2023 08:27PM by baobab_pig.
Re: Marlin Input Shaping on Prusa?
May 27, 2023 04:45AM
2.1.3 is not yet released so no hurry there. But even with 2.1.2 input shaping adds value. One thing that 2.1.2 exposed and 2.1.3 will fix is that there is a problem with multistepping. This is where the processor is not able to generate step pulses fast enough so it starts generating them in bursts. This works surprisingly well up to a point and then it just causes the motors to skip steps. So that puts a limit on your max speed which can be ameliorated by reducing microstepping and thereby decreasing the step rate at any given speed. But this reduces print resolution so it's a tradeoff. Anyway 2.1.3 will fix that.

Before enabling `SHAPING_MAX_STEPRATE` first get `DEFAULT_MAX_FEEDRATE` right and reduce memory consumption by disabling things you do not use. Then if there is still not enough spare RAM, play with `SHAPING_MAX_STEPRATE` until you get a firmware image that has enough free RAM for the code to actually operate. Something like 1kB of spare RAM should do. You'll know there isn't enough RAM if the firmware starts randomly crashing.

I am fairly confident (without going back to look at the code) that mesh bed leveling allocates a static buffer to hold the leveling data regardless of whether leveling is enabled. This is easy enough to check, compile with and without the option and see what it does to the RAM. However I think mesh is probably pretty good with RAM. `AUTO_BED_LEVELING_BILINEAR` with `PROBE_MANUALLY` might be a bit better. This is functionally equivalent to mesh bed leveling but the `G29` syntax is different.

`ADAPTIVE_STEP_SMOOTHING` works better of faster processors. In principle it generates smoother lines. I really salute the principle here but, in reality, I have never been able to see the difference. On an 8 bit processor it will often not be enabled anyway and definitely will not be enabled if printing fast. If it is a choice between ASS and IS I would take IS any day.

For the rest, it's really a case of whether you use the features. i.e. do you actually use firmware retract or do you let the slicer generate retractions? If the latter, switch it off.

`LIN_ADVANCE` is a good feature. I would keep that if possible.
Re: Marlin Input Shaping on Prusa?
May 27, 2023 03:42PM
When I have time to set up Input Shaping properly, I'll probably have two variants of firmware ready to switch between, one with many useful features (e.g. FWRETRACT which I can use to add or increase Z-hop on the fly, macros, bed leveling, etc.) and the other "stripped down" to be able to handle IS reliably. In the meantime I'll just print slow (most of the time it doesn't make a significant difference anyways).

Only, where and how can I see RAM usage? Can I see it somewhere immediately after compiling (before flashing firmware), or do I need to use some host software that receives data from the printer? I have no idea where to look.
Re: Marlin Input Shaping on Prusa?
June 06, 2023 02:22PM
I figured out how to see RAM usage - I needed to uncheck "Silent Build" in the top right corner of Auto Build Marlin panel.
Re: Marlin Input Shaping on Prusa?
June 16, 2023 09:39AM
I've found some time to test this again, and the conclusion is: Input Shaping does work on a Prusa MK2 (8-bit board)!

For anyone who is interested, here is what I've done:

First I've made the printer frame stiffer, which helps increase resonate frequencies which is better (improved print quality by itself and it's better for Input Shaping).

In Marlin 2.1.2 I've turned on the following in Configuration_adv.h:
#define INPUT_SHAPING_X
#define INPUT_SHAPING_Y
#define SHAPING_MENU

and I've changed this to my measured frequencies (in my case the same on X & Y):
#define SHAPING_FREQ_X 35
#define SHAPING_FREQ_Y 35

Also, since 'Rambo' board on MK2 has low RAM, some things have to be tweaked to reduce RAM usage if there is not enough left (there should be some unused RAM, in my case: used 6953 from 8192 bytes). Just in case, I've lowered max feedrate (speed) for X & Y to 120, in Configuration.h:
#define DEFAULT_MAX_FEEDRATE { 120, 120, 12, 120 }
this should reduce RAM usage when Input Shaping is enabled, but I don't see a difference - maybe it could be set a bit higher without problems (I haven't tested that).

Note: I tried using SHAPING_MIN_FREQ in order to have Input Shaping turned OFF by default (by setting frequencies to 0), but then I decided to leave it ON and manually disable it from LCD menu if needed. If you do use SHAPING_MIN_FREQ, set it as high as possible (at the lowest measured frequency, or very close), because if setting frequencies lower, the RAM usage will grow.

Before Input Shaping I was using acceleration of 800mm/s^2 for a decent print quality (although not perfect, there was a tiny bit of ghosting/ringing even at that low accel). Now with Input Shaping I can use acceleration of 3000mm/s^2 with the same print quality, and it can handle 5000 if I don't mind a little lower (but still acceptable) print quality. Even with lower top speed (under 100mm/s), increased acceleration means significantly faster print, as the print head would never reach even moderate speeds in short moves when using low accel.

The old 8-bit board can't process very fast speeds at high resolution, with or without Input Shaping. This problem can be mitigated by making the sliced model simpler, using lower resolution in the slicer, or using Arc Welder to convert many small segments of a curve into a single command. But I haven't tested this yet.

Before, when printing at accel of 1200 or higher, the printer would be louder, especially when moving Y axis (bed). At higher accelerations, beside lower print quality, it sounded as if the printer is damaging itself (at least making bearings and rods wear faster). Now, with Input Shaping, even at 3000 accel, the printer is silent (no rattle of Y axis) and it feels smooth.

So, Input Shaping improves print quality at increased accelerations and (probably) reduces wear on the hardware as well. Actually, it can partially compensate for a 'bad' hardware such as unoptimized design for high speed (bedslinger) and well-used components (e.g. bearings that have seen better days).
Re: Marlin Input Shaping on Prusa?
September 20, 2023 01:04PM
Guys, interesting topic!
At first I looked for a mention of Positron V3, I only found it here.
And then I realized that there was interest in overclocking slow printers.
I have a Tevo Tornado, it was not the first hand I got, but almost everything works. Yes, some things had to be replaced with better parts, for example the glass-ceramic bed. Because of this, we had to make the printer wider. Actually, I toake it to print parts about 30 cm.
Now about Positron V3. I'm building it myself. Most of the parts are already there, the rest will arrive soon. It’s interesting to find a community to discuss the building; I have questions.
I know about the discord for Positron LT, but it’s difficult to register.
Re: Marlin Input Shaping on Prusa?
September 25, 2023 08:51AM
Well, I'm only planning to buy Positron sometime in the future (when I have time and money, and when it's available as a full kit or assembled printer). Otherwise I don't know anything about it.

Regarding speeding up a slow printer, you can make sure that the frame is stiff (by adding some braces for the Z part of the frame), and you can set up Marlin firmware for it and turn on Input Shaping and other features (depending how much fit in memory of the motherboard). If you will be printing something large that doesn't require finest detail, the most important thing to upgrade is the hotend that can achieve high flow (either some sort of longer nozzle like Volcano, or special nozzle like Bondtech CHT, or some special high flow hotend), because for low detail parts that is the first bottleneck.

Edited 1 time(s). Last edit at 09/25/2023 08:52AM by baobab_pig.
Re: Marlin Input Shaping on Prusa?
November 25, 2023 10:39AM
Hey there! Would it be impossible to share the Prusa MK2 firmware image here? Or does the image have to be made manually?
Re: Marlin Input Shaping on Prusa?
November 25, 2023 11:34AM
Can you share the firmware image that you used? I'm new to 3d printing and just got an second hand prusa mk2
Re: Marlin Input Shaping on Prusa?
November 25, 2023 03:06PM
I'd be happy to share the firmware image, but I have changed the settings to fit my machine, which is very different from the original one: relocated the PINDA probe to use it as a simple endstop, changed max print size, changed nozzle to Volcano, added a filament sensor using an old switch, etc. (here are the changes that I did: [www.printables.com]). Therefore, it wouldn't work on a "normal" MK2.

Actually, I've never even found Marlin configurations for Prusa MK2, only for MK3/S here:
[github.com]

To set up my machine, I looked at the MK3 configurations and guessed what is similar so I can use those settings, looked up on various other websites to find pieces of information, and generally analyzed how Marlin firmware works in order to figure out what to do. I didn't even attempt to set up auto bed levelling, because I have moved the PINDA probe (I have actually "downgraded" the machine, by adding manual levelling knobs, in order to be able to use any non-magnetic print surface, like glass).

In short, my settings are highly customized, so they are not compatible with a regular MK2.
Re: Marlin Input Shaping on Prusa?
November 26, 2023 06:20PM
Totally fair! In that case would you be opposed to sharing your config and config_adv? The MK3 has SO SO many changes :/
Re: Marlin Input Shaping on Prusa?
November 27, 2023 09:00AM
Sure, but you will have to check everything that I changed and more (because I haven't set auto bed levelling). It does work well on my machine, but use with caution, because I may have done something wrong (I learned all I know only recently, by working on this and a few other printers, so don't rely on my settings).

I've used default Marlin config and changed that. I added my comments in the files, so you can see all the changes. I use Marlin 2.1.2 [github.com] , so if you want the latest (2.1.2.1), you will have to transfer the changes to the newer config.
Attachments:
open | download - Marlin 2.1.2 configurations for modified Prusa MK2.zip (315.6 KB)
Re: Marlin Input Shaping on Prusa?
November 28, 2023 06:03PM
You are an absolute legend, thank you so so much!!! This saved me hours of frustration and got the printer working consistently!
Re: Marlin Input Shaping on Prusa?
November 28, 2023 06:49PM
Great! I'm glad I could help. When I wanted to modify my MK2, and later try Input Shaping, I couldn't find much info anywhere (regarding MK2 particularly), so I had to figure it out myself. If you have some insights about the settings, feel free to share.
Sorry, only registered users may post in this forum.

Click here to login