3D Printer AUTO-CLEANING! | A must have!
In this tutorial you will learn the basics about scripting in G-CODE to make your 3D Printer AUTO CLEANING procedure , and also Moving bed forward after print scripts.
https://www.youtube.com/watch?v=S1xoH0h2za8
Before we begin, what you will need:
- Basic knowledge of g-codes (if you don’t, check my another tutorial about g-codes CLICK HERE )
- A fully operating 3D printer
- Some “wasted” space on your bed
- know your printer sizes (example: after homing, how much can i move X, Y, and Z?
Now that we got everything lets begin:
How to know my “limits”?
First, open your favorite host software and send a “home all” command, and make sure the positions will be zeros!

NOTE: you might be limited by firmware settings, in this case, you need first to check how much space can you move the X axis beyond the limit, than increase the value on configuration.h. alternatively you can just move your glass a bit to the left/right and find a place for dropping the filament
After that, you now know your limits!,
now we will find a place to drop our filament,
How to find a place to drop the filament?
You will need somewhere to drop the wasted filament, it can be anywhere off the bed, maybe a broken corner, maybe some wasted space, check out how is mine:
Is outside the printable area (glass) and reachable by the nozzle. after knowing where you want to drop your filament, you need to write it in coordinates (X and Y, y can me homed or 0)
The script
I want that my printer, before it start printing,my bed to 110ºC
- Heat my bed to 100ºC
- heat my nozzle to 200ºC (just pre heating)
- make my filament go back (retract) for 5mm (to avoid oozing)
- go home
- do auto-leveling
- heat the nozzle up to 230ºC
- move nozzle to the right corner, on the deposit area
- extrude 10mm (5mm is of the retraction) of plastic while moving forward on Y
- start printing
How we do this? using some G-codes!!!
First a brief introduction of what they will do:
- G1 = Move to somewhere, while extruding (if you want)
- M104 = Heat the nozzle to a certain temperature and WAIT for R (R is a minimal temperature before letting the host do something
- M140 = Heat the bed to a certain temperature and R (same as above)
- G 28 = Go home (if no axis define will go on all)
- G29 = Auto bed leveling (must have it configured)
- G90 | G91 = Set to Absolute/Relative Positioning
M140 S110 ; this will heat the bed to 110 degrees
M104 S180 T0 ; this will heat the nozzle to 180 degrees
G91 ; set to relative
G1 E-4 F600 ; retract filament
G90 ; set to absolute
G28 ; home all
G29 ; auto leveling (dont write this if you dont have!)
G1 X0 Y0 Z0 F4800 ; go to the zero point
G1 X195 Y20 F4800 ; go to the starting waste point
G91 ; set relative
G1 X180 Y80 E15 F600 ; go to the end waste point extruding 15mm of plastic all the way
G90 ; set to absolute
Now, how will i write this on my 3dprinter?
FIRST, change it to your values!, on the line most softwares allows you to use ; as a commentary (example, some program languages use // or /* – */ )
SECOND, check is the G and M are capital! and check for erros
Now you just need to run it and see if it works!, if it doesn’t, check the positions
also remember to clean it sometimes, the filament will probably go down because of the movements, but is better check it
BONUS SCRIPT
Moving the bed forward after the end of a printing
If you got this far you probably already know how to do it. but if you didnt got the g-code spirit, i’ll show you how.
you can download it here, but please help us keep our work by subscribing!
[CMDM-download id=1351]
Good Luck!, and if it has helped you, share with your friends!
Great tutorial, it’s always great to have these to learn and/or refresh! Wasn’t able to get the video to play though.