Klipper guide: Input shaping, pressure advance and macros (manual + accelerometer)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
we're going to start reaping the rewards of clipper with how-to guides for macros pressure advance and the game changing input shaping [Music] this is the latest in my series on clipper trying to demystify a very powerful firmware that might seem daunting to those who are unfamiliar previously i had two sister videos on the actual installation covering variations from two different printers i then covered three interface options for adding a control ui to the machine and today we continue with guides to macros pressure advance and input shaping i had great results with input shaping when building the rat rig vcore 3 so it will be interesting to see if these results adjust as good with a delta printer and an i3 style bed slinger using two printers also allows me to cover both manual measurement and auto calibration with an accelerometer there's a lot in here so please use the chapters to find what you're after and we're going to start with macros it makes sense to start by looking at what exactly a macro is i would define a macro as a series of commands to be run when a specific command is input however a simpler description might be a user-defined g-code shortcut to create a macro we need to format it in the correct way and this is described on the clipper command templates reference inside our printer configuration file we need to have a square bracket then gcode underscore macro a gap and then the name of our micro which is completely up to us but should not contain any spaces finally we close the square brackets and on the next line we write g code followed by a colon and a list of whatever commands we want to run let's look at a simple example say we've come from marlin and we're running auto bed levelling with the g29 command however in clipper g29 is not supported instead the command bed mesh calibrate is used and here's a macro to convert between the two in my printer config i call the macro g29 and the g-code is simply bed mesh calibrate so when clipper receives a g29 command from my slicer this macro will convert it to the clipper specific command of course macros can have more than one line for example here's one set up by rat rig called start print as we can see it lists multiple lines they'll run one after each other we just need to preserve the indentation on the left for each line potentially with a macro like this you could replace all of your existing start g-code in the slicer with the start print command that means that g-code sliced a long time ago can still be up-to-date if the start print macro is edited a great place to find sample macros is on the clipper github there's lots of useful things here great for copying and pasting and then modifying to learn how they work this is where i got the m600 filament change macro that i'm using on multiple machines for when the filament runs out you'll notice in some of these macros that we have sections of code inside curly brackets clipper is built on python so the formatting and structure matches this but if we visit the status reference page we can find a list of all of the printed variables that can be used when we write our own macros and as an example of these variables here's the world's most useless macro i've called it update underscore fan and it uses m117 to send a message to the lcd to report on the current fan speed and i access this variable by having curly brackets and inside printer.fan.speed times 100 to turn it into a percentage if i run the macro the lcd reports the fan percentage as zero and if i turn the fans on and run the macro again the lcd reports it as 100 my example was useless but macros particularly with variables are quite powerful a great place to look for good ones is on community groups let's continue our journey with pressure advance we'll start again by asking what is pressure advance a simple description is special control of the extruder to reduce ooze and provide sharper corners on your 3d prints if you're coming from marlin it's essentially the same as linear advance i've linked my marlin video for linear advanced below and you can see on the thumbnail how much crisper the edges are when our 3d printer is extruding plastic we'd hope that those extrusions came out quite uniform but in reality we have under extrusion as the nozzle pressure builds good extrusion in the middle once the pressure stabilized and then an over extrusion blob due to the pressure still left in the nozzle after the extruder stepper stops turning this tends to give our prints quite bulbous corners but once we tune linear or pressure advance the extrusion should be a lot more uniform is a before and after on the cr10 max which has a 0.6 millimeter nozzle in case you can't see it here's the bulges we're trying to eliminate in green and with pressure advanced tuned for the print on the right they're pretty much gone as always clipper provides a reference page that we're going to follow to tune pressure advance for our printer the first thing we're going to do is go to the link on the page to download the square tower test print we'll then follow the instructions on the page to set it up properly in our slicer just follow the slicing guidelines on the instruction page and you can't go wrong you can preview the gcode if you like and then upload it to your machine before we start the print we need to copy and paste some commands into the terminal for the firmware the second of these is the actual tuning tower and we have two listed the first for a direct drive extruder and the second which i'm using here for a printer with a bowden tube these commands set up the firmware for a pressure advanced test and once we've entered them we can start the print at the base of this print the pressure advance will be set to zero but if you check the terminal mid print you'll see that it's constantly increasing this is in accordance with the factor we entered earlier when your print is complete it should look something like this you'll notice the lower corners look terrible and the upper corners will likely look terrible too but hopefully there's a goldilocks zone somewhere in the middle and after we've identified the area we're going to measure the distance between it and the base of the print i recommend comparing several corners for this adjusting your measurement in my case i rounded mine up to 32 millimeters please note that if you've got elephant's foot like in this print the lower layers will be compressed and that's going to throw off your vertical measurement it's also worth noting that you can run this test with any sdl that you've sliced here i did it with an oversized calibration cube just take your vertical measurement in the same way after it's done we're going to enter our measurement into a formula on the instruction page our start height was 0 then we add our measured height in my case 32 and then we multiply that by the tuning tower factor that we used before the print for this fl sun super racer i use the default factor of 0.02 so that's what i put into my calculator and that gives me a pressure advance value of 0.64 now we go to our printer configuration file head to the extruder section and replace the pressure advance value with the one that we've just calculated save and restart the firmware if you happen to run a before and after print you should see the difference quite obviously please note that you'll need to retune pressure advance if you modify any hot end or extruder components you'll also need to retune it if you're using a substantially different filament such as something that's flexible for best results it's worth revisiting your slicer settings for retraction as pressure advance will already minimize the oozing on to the main event which is input shaping again we'll start with the question what is input shaping a technical explanation is that it's a control technique for reducing vibrations on our 3d printer but what you really need to know is that it's a way to print fast but without the usual reduction in print quality as we up speeds and especially acceleration 3d printing becomes a lot more violent the vibration of the mechanical parts can be seen as an artifact on the surface of the 3d print known as ringing or ghosting some printers suffer from bad ghosting even at low speeds because they've got a particularly heavy print head to move around but in any case we should notice that the oscillations seen on the surface repeat at a regular interval and this is related to the resonant frequency of the machine resonant frequencies when used correctly can be a powerful tool such as a musical instrument where resonant frequencies are exploited to play specific notes if we can find a way to measure the resonant frequency of our 3d printer clipper has precise enough control of the stepper motor movements that it can compensate and magically make ringing or ghosting disappear just like a bird on a windy branch can cancel out those vibrations keeping its head still to track prey there's two ways of setting up input shaping both of which you're going to see in this video the first is manual measurement which is completely free but won't be effective unless you can take accurate measurements alternatively you can use an accelerometer and that automates the whole process but there is additional parts required and additional software to set up an outstanding feature and to implement it with either of those methods we first need to generate a baseline print for this one we're going to follow the resonance compensation page and again we're going to start by scrolling down and downloading the ringing tower like with our pressure advance test clipper will specify what settings we need to apply in the slicer to prepare this file a crucial one is making sure your external perimeters are at least 80 to 100 millimeters per second and you might like to verify this with a calculator this is what your test print should look like once it's sliced and you can upload it to the machine before we hit print there's a few things we need to set up the first of those is temporarily raising our max acceleration and acceleration to deceleration values and the suggestion here is 7 000 but if you want to run the test with even higher acceleration you should up your maxes to suit square corner velocity needs to be set to five save the config to restart the firmware and apply the changes and once clipper reports that it's ready we're once again going to copy and paste some commands from the instructions starting with disabling the pressure advance for the print that's about to come turning off any input shaping in case you already have that section in your config if you don't the unknown command error is completely normal finally we issue the tuning tower command this is just like our pressure advance test except this time we're changing our acceleration as the print continues upwards with everything set up we can finally start the print after laying down a base at the bottom of the print the rest of it will be hollow and in five millimeter bands the acceleration will increase up to a maximum of seven thousand millimeters per second per second for the super racer this was absolutely perfect there was no ringing down below but it did gradually increase as the acceleration stepped up a great baseline for the cr-10 max however which has a truly enormous moving bed these higher acceleration values near the top of the tower were just too much for the printer to handle this resulted in an epically failed print so i repeated the test with more conservative values but that was still too much resulting in layer shifts and i repeated it a third time but this time it wasn't aggressive enough and i couldn't really see any ringing on the fourth attempt i finally nailed one that went from no ringing to ringing and then the start of some layer shifts which is a great bass line for comparison i now have a bass line for both of my printers for the cr-10 max i'm going to show you how to apply input shaping using only manual measurement we're going to continue further down the same page until we get to the section explaining how to measure the ringing we want to examine the repeating pattern measure the start and end of the oscillations as well as how many are in between in the example given the six oscillations spread over 12.14 millimeters we need this measurement for both the x and y surfaces so match them up to what's on the model carefully mark where your oscillations are measure their total length as well as how many oscillations are between the start and end points in our printer configuration file we need to add an input shaper section and the minimum parameters within that a shape of frequency x shape of frequency y and shaper type time for some number crunching and i'm doing the x axis first we start with our exterior wall feed rate in my case 80. we multiply that by the amount of oscillations for me that was two and then we divide that by the distance measured and for me that was 4.8 millimeters that gives me a result for x of 33 and a third which i enter next to x in my printed configuration now we repeat the calculation for the y-axis an exterior wall speed of 80 x 2 oscillations divided by the distance between the start and end which for me was 7 and that gives me a number of 22.86 when rounding up i now enter that into my configuration next to y the last piece of the puzzle is which input shaper to use the two main ones are mzv or e-i and e-i is meant to be more suited for bedslinger printers so that's what i started with entering it next to shaper type before saving the configuration and restarting clipper time for a follow-up print this time with input shaping working we once again turn off pressure advance and we set the same acceleration tower commands as before and now print the same g-code as earlier my first follow-up was with the e-i input shaper and i also experimented with mzv running the same g-code and tower tuning again and here's the results no input shaping on the left and ei input shaping on the right as you can see the ringing is almost completely gone for the mzv algorithm it was pretty much the same maybe very slightly better at the higher acceleration values some of the edges are starting to get a little bit curved and we can also see this gap is opening up the higher up we go so for this reason rather than sticking with the max acceleration i'm actually going to go with around 2000 which is halfway up the tower my final step in the printer configuration is to set my final acceleration values down from the temporary 7000 for testing to the much higher than before 2000 save the config restart the firmware and we're done as i had hoped this very large bedslinger 3d printer can now print with higher acceleration without any loss in quality so how about the delta this time using an accelerometer previously i set up input shaping on my rat rig but that was by connecting the accelerometer directly to the main board in this video we're going to do the traditional method which is connecting it to the raspberry pi another difference is thanks to a tip from viewer jarek we're using the adafruit adxl343 it's still an accelerometer but for me it costs less than half the price over the traditional 80xl345 you'll need the soldering iron to add on the headers and you'll need the tools and ability to make up a cable to go from the accelerometer to the main board and i've got a video linked to help you with that to set up for the accelerometer we're going to follow the measuring resonances page basically we're going to connect via ssh with putty and copy and paste the commands one at a time remembering that to paste in putty we simply right click for some commands you'll be prompted to enter your admin password but apart from that it's really straightforward after a few steps you'll be prompted to click through to a second document to set up the raspberry pi after copying and pasting some more scripts we'll then enter a gui to enable sbi communication on the pie again you don't need to understand exactly what's happening just follow the instructions as they're written after that we're going to enter the make menu config just like when we originally set up our microcontroller installing clipper except this time we set the microcontroller architecture to linux process we finish by stopping the clipper process and installing the new microcontroller code before starting clipper up again our final software setup is back on the measuring resonances page and we need to access our printer configuration file and paste in three separate areas despite the fact i'm using an adx l343 instead of a 345 i didn't need to change any code here the only alteration i made was changing the probing point to 0 0 to reflect the fact that i'm using this on a delta now's also an excellent time to add a blank input shaper section to your config now we simply save and restart at this point i came back up to the top of the page to tackle the wiring just to confirm this accelerometer was compatible i started by using some short jumper cables following a combination of the table on the page and the wiring diagram opened in a new tab to make it big enough i was able to match up all of the pins to verify everything was working i sent accelerometer underscore query and measurements rather than an error means you're good now is when i made up my proper length cable and designed a mount to hold my abl sensor with the accelerometer next to it this is neat and compact the infrared probe still works and i can plug in the accelerometer when needed it's worth noting that for a bedslinger 3d printer you need two accelerometers one on the printhead to measure x and another attached to the bed to measure why as the instructions state you want to make sure your accelerometer is rigidly mounted for a device we're using to measure vibrations we don't want to introduce any from sloppy mounting with everything in place using the longer cable i sent another accelerometer query to verify it was good we can now home the machine and then enter into the terminal shaper underscore calibrate what's happening now is the print head is being vibrated back and forth by the firmware most of the time it's too subtle to see but you should be able to hear a wine of increasing pitch if you check the terminal it will confirm that the testing frequency is increasing and after it finishes testing vibrations for the x-axis it will complete some calculations and then repeat the process again for the y axis when it's finished testing x and y some suggestions will be made as to the best input shaping parameters for your particular printer to accept them all we need to do is type save underscore config and wait for the firmware to restart once it does we can scroll to the base of our printer configuration file and an input shaper section has been added with the calculated settings for our follow-up we're once again going to turn off input shaping and start the same acceleration tower before printing the same g-code the result just like when i used an accelerometer with the rat rig is fantastic our before print is shown on top and we can see the ringing up the top from the higher acceleration but this is pretty much gone on the lower print with our automatically tuned input shaping enabled this is now the third printer where input shaping has given me a fantastic result our last step is to look at the tower and adjust our max acceleration in the printer config i'm going to settle on 5000 which is almost double what i was running before but now without any ringing for best results it's necessary to reach in pressure advance but with input shaping enabled you can leave the accelerometer mounted to the printer and not plugged in this will make it convenient to re-tune input shaping if you change any components that affect the printer kinematics that concludes my clipper series for now at least if there's any vital features you think i've missed please head down below to the comments to post them there thank you so much for watching and until next time happy fast printing without any loss in quality g'day it's michael again if you like the video then please click like if you want to see more content like this in future click subscribe and make sure you click on the bell to receive every notification if you really want to support the channel and see exclusive content become a patron visit my patreon page see you next time you
Info
Channel: Teaching Tech
Views: 34,271
Rating: undefined out of 5
Keywords: 3d printing, 3d printer, 3d printed, 3d print, klipper, marlin, firmware, input shaping, guide, how to, lesson, tutorial, instructions, step by step, raspberry pi, accelerometer, adxl345, adxl343, adafruit, pressure advance, linear advance, explained, what is, acceleration, ringing, ghosting, print quality, tuning tower, macros, variables, resonance compensation, configuation, reference, printer.cfg, mounting, tuning, tune, calibration, filament, slicer, g29, abl
Id: EJapxNsntsQ
Channel Id: undefined
Length: 20min 7sec (1207 seconds)
Published: Fri Oct 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.