Tag Archives: g-code

How Does Your 3d Printer Know What to Print.

what does your 3d printer understand

Believe it or not your 3d printer is a dumb machine. It needs to be told exactly what to do and when to create those wonderful models you require from it.

So how does your 3d printer know what to print: The file you create with your slicer tells the 3d printer exactly what to do and when to do it. It contains commands to move the printhead and how much material – if any – to place on the build plate and the heat the bed and nozzle need to be kept at.

Your 3d printer contains mechanical parts – the stepper motors- which need telling what to do. You also have heaters which need to know what temperature to be at…

What tells your printer what to do 

Your 3d printer is a bit like the old paper printer in the respect that it needs another computer to tell it what to do.

You can think of your 3d printer in the respects of the paper printers.

how a slicer works

Think of a pile of paper sat next to the model you want to print.

If you could push the pile of paper into the model then each

piece of paper would have a slice of the model on it.

If these are printed out in the right order then what you get with your 3d printer is a finished model.

If they are not printed in the right order what you get is a mess of plastic….

What are slices

As shown above you can have a pile of paper the same height as the model to represent each individual layer of your model.

But you can change this – within reason- with the size of your 3d printers nozzle.

The larger the diameter of nozzle the thicker the slices can be.

So instead of paper think cardboard….

A lot less slices.

But with that comes a lot less detail.

So if you are printing a plain box with little detail, would you use the finest nozzle you can or the largest nozzle to get the job done quickly…

I know i would be using the largest nozzle…

As i said you can control the thickness of the slices, this is done in a slicer program on your computer.

What does the slicer do

A 3d printer slicer does the same job as those meat slicers in the butchers.

Place the model in where the lump of meat goes .

butchers meat slicer
by Flickr

Dial in how thick you want the meat ….

And slice it off layer by layer.

That’s where the analogy stops as the slicer has to recognize what is an outside layer.

How thick have you set the wall thickness to be and what infill do you want.

It is a pretty complex program which takes your model and cuts it up into slices and works out where to position the nozzle and how much filament to extrude at that time.

And when it is moving between printing areas to turn off the extrusion and move quickly to prevent oozing and start printing again.

As the inside of the mode is not seen it doesn’t have to be full of plastic, so can be printed with an infill of a certain percentage, just to support the structure as it grows upwards.

You can adjust this infill, right up to full, to allow the parts to be used mechanically.

To allow the material out of the nozzle it has to be heated up so that it becomes runny, but not overheated…

So the slicer tells the printer that the nozzle needs to be at this temperature and the printer adjusts the heater until it reaches it. The printer now controls the nozzle temperature until told to change it.

The same with the bed temperature to help the model stick to the buil platform.

Every little move, very little extrusion must be listed in a file to control the various parts of the printer correctly.

So the final push of the slice button may, on a complex model take a few minutes to create the file for your printer to create the model from the screen.

What is g-code

The file the slicer produces is in a format called g-code.

This was invented to control CNC machines – or even further back for manufacturing pcbs.

The pcb’s conductive layer is in effect a single slice of a model, and can be printed using conductive filament…..

As CNC can work in 3 dimensions this format was thought to be ideal for adopting for 3d printers.

There is a move to change the format to one which is more suitable, but the adoption is slow…

So…the g-code – what does it look like….

example of gcode

This just looks like a bunch of numbers with letters in front – and that in essence is g-code.

It tells the printer where to start and then how far to move in the x direction and y direction, how fast and how much material to extrude over that time.

Then at the end of the layer is tells the z axis to move up to the next layer.

And it follow this file step by step until is reaches the end.

Where it switches off the heaters for the extruder and bed, makes the stepper motors go silent and waits to print the next model.

What are the main codes in a g-code file

The file commands th printer to go through a process.

The first command usually is to home the printer (G28), so that it know where it’s printhead is.

Then it heats up the bed and then the nozzle( M140,M104 and M109).

It usually raises the nozzle and goes to the start point for printing(G0,G1).

And now goes through the move and extrude commands in the file.

Even for a simple 25mm square calibration piece you have thousands of commands, depending on the layer height.

How do you get the file to the printer

There are three main ways to get the g-code file to the 3d printer and they are :

  1. SD card
  2. Usb cable
  3. Octoprint

Copying the file onto an sd card and inserting it into the printers card slot allows you to select the file to print.

There can be issues with sd cards not being read– with the shaking that the 3d printer does and the card slot being on the casing can make the contacts intermittent and fail to read the next command, in which case the print fails.

This can happen at any height, but with the anet a8 it usually happens as the model grows in height and the slightly unstable frame rocks a bit more.

But it is normally a reliable method of file transfer and means you can power down your computer or use it for other things while printing without worry.

If you decide to use the usb then you need to make sure the computer does not go to sleep while printing.

Or update any software to make it reset – a common problem with windows….

It also means the computer needs to be located close to the printer  – not always convenient to use at the same time.

And you need to not overload and stop the usb from communicating as the printers are not overly intelligent and will crash with too many commands.

Alternatively you can add a raspberry pi with octoprint to control your printer.

You can communicate with it wirelessly – sending the file over for the model and then this is sent onto the printer.

You can get feedback on how the printer is doing, how much longer the print has to go and other information that means that you can locate the printer in a remote part of the house if desired.

And finally….

So you now know how your 3d printer takes the file from your slicer.

Where you have set the height of the slices and what the filament needs.

Which the slicer finds the paths of the model to create the outer skin and the infill.

In the background it is a very complex process, but on the surface one which is getting easier to use.

And hopefully in the future even easier, with the slicer embedded into the printer itself.

Then it will be download or create the model and select the quality and hit print….

At the moment you need a few more steps and to follow a workflow.

Getting used to going through a process will prevent you from making too many mistakes -we all make them don’t worry…..

And being happy with the newly created model from your printer is what this process is about.

Understanding a little more, when you see the g-code now it may not be all confusing as you start to see a pattern or use craftware to view the model before you print and see the holes and start to know what to alter to repair them.

If you have any questions about this process please leave them in the comments below and i wish you good printing.


My Filament is Not Coming Out : Why?

no filament out of the nozzle- find out why...

Filament problems with your 3d printer – find out what causes them and how to fix them.

It’s always the case – the print that matters – you have setup the printer and made sure everything is working – you go to print and even the perimeters are not printing  -now what…..

The filament is not coming out of my hotend : There are a few reasons that filament may not come out of your hotend: nozzle too close to the print bed, extruder not working, clogged throat or the filament not loaded correctly.

But all of these problems are solvable, once you sort out the main reason, in this article I take you through the possible causes of the filament not coming out of your nozzle and the solutions….

  1. Extruder motor not working
  2. Extruder gear not turning
  3. Extruder gear misaligned
  4. Not enough tension on filament
  5. Filament not loaded correctly
  6. Throat clogged
  7. Nozzle cold
  8. Nozzle jammed
  9. Nozzle height too low

Let’s have a look at each one, what you see and how to correct it.

Extruder problems

Extruder motor not turning

After you have determined that the printer doesn’t have any filament coming out of the nozzle, look at the extruder gear /shaft and see if it is turning.

If you cannot see these due to the fan obstructing them then hold the filament gently and you will feel it being tugged into the extruder.

And you will feel the motor stepping.

If you don’t feel the motor moving there can be two causes.

  1. The G-code has become corrupted and no extruder information is in there
  2. There is a problem with the motor driver, motor wiring or motor.

After halting the print you can examine the G-code to determine whether it is correct, it is always worth just checking the G-code to see what you are sending to your printer – i tend to use ideamaker or craftware ( my favorite as you see the G-code).

The printer may have just had a glitch and restarting it will print ok, but go through the rest of this article and make sure everything else is ok before restarting the print.

To test the motor use the manual movement menu to move the nozzle away from the bed.

Navigate to the extruder menu and retract a couple of mm and see the filament move – or at least try to ( but only if the nozzle is up to temperature – see below).

If the motor doesn’t move then you need to fault find on the motor system.

See my motor system fault finding article for more information.

But the basics are :

  • Check the wiring for open wires
  • Check the motor for open windings
  • Check the motor driver for correct operation

You can swap the extruder motor for the x motor ( if you know that is working correctly) to test for wiring and motor problems.

Remember to swap it back afterwards.

Extruder gear not turning

This is a commonish fault, where the grub screw works its way loose.

The motor is turning, but the gear is not turning – so no filament is being fed into the hotend.

Use the movement menu to move the extruder ( again if the hotend is up to temp) both forwards and backwards to make sure that the gear  rotates correctly.

Re tightening the grub screws fixes this.

Make sure one of the grub screws it located on the flat of the shaft –

tip for seeing whether the shaft and gear are turning in synch - add a linethis way it takes a lot more to have this fault.

One tip is to use an indelible pen to mark the gear and shaft to see if they are rotating together.

This way, when you carry out your routine maintenance ( you do do it don’t you) you can see at a glance that the gear is rotating with the shaft both on load and retraction.

Extruder gear misaligned

This fault is common when you build the printer.

You push the gear onto the shaft and tighten it

When you load the filament you don’t notice that the filament is not catching on the teeth, but on the shaft and cannot be fed into the hotend due to no force on the filament.

You can visually see this when you remove the cooling fan.

Repair is to loosen the gear and realign it with the friction wheel.

Check that when you load the filament you can feel the motor turning when you pull on it gently ( and a visual check is worth it)

Not enough tension on filament

This fault shows no flow of filament from the nozzle.

The filament is catching the teeth of the extruder gear.

There is no clicking of the extruder motor.

There is no grinding of the filament.

There are no marks when it is unloaded.

This would indicate that there is not enough tension on the filament and the gear is slipping over the filament.

To test that filament is coming out of the nozzle, making sure the nozzle is up to temperature, push on the lever to release all the tension and gently push down on the filament, forcing it out of the nozzle.

Correction is to increase the tension on the filament by adjustment of the screw on the spring for the pinch roller.

Filament not loaded correctly

This is another problem you come across when starting out.

Feeding the filament into the extruder and down to the hotend can be problematic.

Knowing whether it has entered the hole for the throat and has gone in far enough to reach the hot end without hitting an obstruction.

If you suspect this then mark it at the top of the extruder and withdraw it.

Measure the depth of the extruder and hotend to the nozzle and see it this measurement ties up with the mark on the filament.

If it is a lot short there maybe an obstruction in the throat or a misalignment of the liner to the nozzle – something that prevents the filament reaching the hotend and then coming out.

A thin wire or toothpick (preferred) can be carefully inserted into the throat – feeling for any obstructions – this is carried out after removal of the extruder motor.

Mark the toothpick and if necessary disassemble the hotend noting whether there is any obstruction at the height you measured.

Reassembly and readjustment of the z height will be necessary before you print again – so this one is a last resort if possible.

Hotend problems

Throat clogged

If your filament rises too far on retraction it can drag heat too far up the throat and on cooling the filament can start to cause a problem feeding the filament down.

If your hotend is too hot, the heat can rise through conduction melting the filament above the hotend causing a blockage – preventing the filament being fed through the nozzle.

You may hear a ticking as the extruder gear jumps on the filament, it is a regular tick….tick as the gear tries to feed the filament into the hotend.

To test for this – release the pressure on the pinch wheel and push gently onto the filament – forcing it down.

You will feel whether it is moving or not.

If it doesn’t move then try retracting it.

This is done with the hotend hot.

If it wont retract then it maybe jammed in the throat.

Removal of the extruder motor and lifting the extruder gear and pinch roller off the filament before cutting the filament and stripping down the hotend is the only way to cleat the blockage.

Make sure the nozzle is hot when you remove it as i have sheared one when trying to remove it full of filament.

You maybe able to force the filament down through the hotend to get it out.

This is one of worst faults as you need to reset the whole of the hot end and bed height, it all takes time.

Do check your retraction lengths and temperature you are running your material at.

Make sure there is adequate cooling at the extruder – put the fan back on….

Nozzle cold

If the extruder doesn’t start to click and the print starts to fail with no filament coming out, then flick your eyes up to the nozzle temperature before you abort the print.

If the temperature is below 180 degrees then there is a safety cutout where the software stops feeding the filament below that temperature.

This maybe due to a hotend heater failure or an intermittent connection.

With the movement you get on the hotend, unless the wires are secured the movement can cause a rapid failure at stressed points – like where the wire comes out of the heater.

This connection maybe made when the nozzle is on the bed, but open when the z height raises, causing a little confusion as to where the problem is.

A gentle tug on the wiring will determine whether it is secure into the heater or comes away easily.

Replacement of the heater cartridge or heatblock is the only course of action – making sure you secure the wires to reduce this in the future.

Replacement of the heatblock will mean that you have to check the bed clearance again….

Nozzle jammed

So with the above fault you were not able to withdraw the filament from the throat.

With this one you can.

But still pushing down on the filament, with the hotend hot nothing is coming out.

You may get the same ticking from the extruder as in the fault above.

Ok, so you now have a blocked nozzle.

Thee are two ways you can deal with this.

With the nozzle hot – replace it.

Or try a cold pull to remove the material from the nozzle and hopefully the debris.

To carry out a cold pull take the nozzle temp down to 100c with the filament still inserted.

Once it is there – release the tension on the pinch roller and give the filament a hard yank – but don’t damage your printer.

Hopefully the filament has come loose from the nozzle and reformed itself into the lining of the throat before it cools.

When it comes out it should look like the inside of the nozzle shape on the end.

Thee maybe little black bits on it – these could be burnt filament or other debris gone down into the hotend causing it to be jammed.

It maybe that the filament comes out but it doesn’t feel like all of it came out, to test this cut the end at 45 degrees and reinsert – if it doesn’t go all the way down then you have a piece stuck in the throat.

Using a drill smaller that the throat you could try to force the filament down to the hotend and try the cold pull again – or remove the nozzle and then force the filament down the throat.

Whichever way you do it – remember there maybe debris on the end that will cause a blockage again – so don’t just force it down and carry on printing…..

The easiest way is to carry stock of the common nozzles you use and replace it if it jams. They are cheap enough to carry a few in stock.

There are on the market nozzle cleaning kits.

These are made up of very thin steel wires used to force the filament out of the nozzle when it is jammed.

For me i wonder at the damage you can do the the brass nozzle ( which is very soft compared to the steel) waggling the pin around trying to clear the jam.

But really all you are doing is to move it to one side, waiting for it to clog the nozzle again- or partially clog it in a few minutes or hours…

Now you go back to printing with an unknown nozzle size and wonder why your prints are not as good as they used to be.

As you can tell I am not really a fan of these as they can do more damage than they fix.

If you take off the nozzle you can then clear it out from the rear without damaging the accurate exit hole.

Bed height

Nozzle too close to bed

This fault is one most beginners get , I still get it occasionally, but i know quickly what to do.

The first layer starts to print – you have spent hour s leveling the bed and it is perfect.

But no filament is coming out.

Then you hear the extruder gear clicking.

And you think you have a clogged nozzle .

So you abort the print – raise the nozzle and push the filament through.

Only to have it come out of the nozzle quite happily -dropping straight down.

This maybe a case where the blockage is the bed itself.

With the nozzle too low no filament can be forced onto the bed.

When you get a little more experience then you will be able to use the time your printers takes to print the perimeter lines to adjust the bed.

Knowing that a whole turn of the bed screws adjust the bed down 0.45mm to 0.5mm depending on whether you have 2.5mm or 3mm screws.

You know that there is quite an adjustment if you don’t see any filament come out, then you see the filament ooze around the nozzle and know that it will not stick to the bed.

You could try pinning it down with a scalpel to try to drag it off the nozzle, but 9 times out of 10 I halt the print and clean off the nozzle and give the bed screws half a turn to move the bed downwards – wondering why it has moved again.

Checking the z endstop tightness to see if that as caused this problem…

And Finally

I hope reading through this has helped sort out thing to try to clear the fact that the filament is not coming out of the nozzle.

Let me know if you find any more which can cause this and i will add it to the list.

Thanks for reading