Wednesday, April 20, 2011

Flow Rate Redux

After spending the weekend trying to understand the Flow Rate settings in Skeinforge by going back to basics and looking at the physics of extrusion, I then found this newsgroup post that talks about the changes to Skeinforge 40. In this new version of the tool the Skeinforge calculates the volume of filament entering the extruder and hence the volume coming out.


This requires some changes to the firmware. In the original firmware the E_STEPS_PER_MM variable specified the number of 'steps' the extruder needed to make to extrude 1mm of filament. With Skeinforge 40 it now specifies the number of 'steps' needed to push 1mm of filament into the extruder. This combined with the new setting in Skeinforge that specifies the filament diameter allows the tool to figure out how much filament it needs to extrude for a given speed - no more calibrations required.


I followed the technique described in the newsgroup post to calculate my new E_STEPS_PER_MM value.


Initially it started off at 20.1, but after setting Repsnapper to output 100mm (Length on the Print tab) and measuring the amount of filament entering the extruder, I came up with the following value:


 100*20.1/3mm = 670


I used 80% of this value (536) as the value in the Gen6 FW, recompiled, up-loaded and retested. Now 65mm of filament was pushed into the extruder. Repeating the calculations gave the following value:


100*536/65mm = 824.62


Recompile, up-load and repeat testing gave about 75mm filament pushed into the extruder. This clearly was incorrect, so I watched the extruder carefully. It was slipping so I had to tighten the idler bolts, then I retested it again. Now 104mm of filament was fed into the extruder.


100*824.62/104mm = 792.90


You guessed what comes next. Now it was 97mm of filament, so....


100*792.90/97mm = 817.42


Finally I had 100mm of filament entering the extruder.


I tested the settings with my favorite test prints - Feed Rate and Flow Rate set to the same value, and right of the bat they were amongst the best I've had. I could even change the layer height from 0.4mm to 0.3mm without any other tweaks and still get a perfect print.


So how does this compare with the physical analysis in my previous post?


With the new settings the E/L in the GCode file was around 0.04355mm/mm. This should scale by the ratio of the new E_STEPS_PER_MM over the old one and come out around the 1.617 value I calculated previously.


0.04355 * 817.42/20.1 = 1.77


Fairly close, but not exact. However, going forward I'll be using the new version of Skeinforge to calculate the settings - it's a lot more straight forward.

Saturday, April 16, 2011

Calculating the Flow Rate value


The Flow Rate setting under the Speed menu in Skeinforge appears to be the first key to getting high quality prints. However, it’s still a bit of a mystery to me. From what I have read, the aim appears to be to vary the Flow Rate until the layer height is equal to the Layer Thickness setting in the Carve menu while at the same time creating a layer width equal to Layer Thickness multiplied by Perimeter Width over Thickness ratio (both in the Carve menu).

The settings for these values I have selected are Layer Thickness = 0.4mm, Perimeter Width over Thickness ratio = 1.8. This means that the perimeter filament width should be 0.4mm x 1.8 = 0.72mm wide.

So the aim of adjusting the flow rate setting is find the value of flow rate that creates both a layer height of 0.4mm and a layer width of 0.72mm. This can be a tedious task of printing multiple test structures and accurately measuring the width and height of the resulting object – there has to be a way to calculate the values without all the trial an error.

Working through the Physics:

Let’s consider a situation where the extruder is stopped over the bed and the nozzle is 0.4mm above the bed. The nozzle extrudes filament at 0.5mm:
 
Minimum Filament Extrusion to Fill the Space Under the Nozzle:

Figure 1: Nozzle Extruding Minimum Amount of Filament to Fill Space under Nozzle


The minimum volume of filament deposited in this situation is :


 = 0.07854mm3



Creating the Required Extrusion Profile:

To get the required filament width we need to extrude more filament than the minimum so that it is forced to spread out under the nozzle and create a wider trace. The Layer Thickness should always be 0.4mm as the filament will be trapped by the nozzle head and it is unlikely to end up thicker than this height – so we don’t need to worry about the Layer Thickness. It could conceivably get thinner if the flow rate is too low, as it will get stretched as the extruder head moves.

Figure 2: Nozzle 'over-stuffing' to Create Wider Trace under Nozzle


The volume of this squashed filament can be calculated by approximating the cross sectional area and multiplying by the length. The cross-sectional area looks roughly like this:


This area can be calculated as:

Where:
H = 0.4mm and W = 0.72mm
Therefore, A = 0.253664mm2

The volume is therefore A x L = 0.37933 x 0.5 = 0.12683mm3


So, to extrude sufficient filament to create the oval cross section, for every millimeter the extruder travels, the extruder needs to extrude 0.12683/0.07854 = 1.6148mm (Something I will refer to as the Volume Ratio)

Setting up the Flow Rate:

Now we need to find a flow rate setting that creates a GCode file that attempts to extrude 1.6148mm of filament for every 1mm of extruder travel.


The easiest way to do this is to set an arbitrary Flow Rate value and create a GCode file. Then look at pairs of G1 codes to calculate the length the extruder head moves and compare it to the extruder E-values. To calculate the distance the extruder head moves:







GCode Fragment:


G1 X91.08 Y89.73 E34.7135
G1 X89.73 Y91.08 E37.801

Calculating Extruder Travel:

L = [(89.73 – 91.08)2 + (91.08 – 89.73)2]0.5
L = [-1.352 + 1.352]0.5
L = [1.8225 + 1.8225]0.5
L = 3.6450.5
L = 1.9092mm

The Extruder head is moving 1.9092mm from (91.08, 89.73) to (89.73, 91.08), at the same time the extruder is being told to extrude:

E = 37.801 – 34.7135 = 3.0875mm of filament

So the extruder is outputting E/L mm of filament per mm traveled.

E/L =3.0875/1.9092 = 1.617

In this example, the Flow Rate setting that was used to generate this GCode file is set perfectly. But, if E/L is too high, decrease Flow Rate and re-run the GCode generation and calculation. If E/L is too low, increase the Flow Rate and re-run the GCode generation and calculation until you get the right value.

I have written a Python script that performs the calculations on the whole GCode file to make things simpler when trying to find E/L.

I’ve also found that multiplying the Volume Ratio by 547 yields the correct Flow Rate value.

Test Print:

With my parameters, the Flow Rate value works out to be 880. When I create a GCode file of a test object with this value and print it on my Mendel I get very high quality print results as shown below. The width of the filament varies between 0.71mm and 0.78mm based on a dozen measurements around the perimeter, with the average value being 0.74mm – just marginally bigger than my required 0.72mm.


Figure 3: Side View of Test Print Hollow Cube


The bottom layer fill is very full without being over-filled. The inner-layer fill still needs a bit of work, it appears that the overlap settings aren’t quite right as the inner fill disrupts the outer layers on solid objects. I think that I’ll reduce the Infill Perimeter Overlap, I’m also going to add an extra shell on all layers to give an extra thick shell on the outer layers to try and keep it as neat as this test print.

Figure 4: Bottom Layer of Test Print Hollow Cube - A little over-filled in one corner.

Monday, April 11, 2011

Building a Spool

After the other night's test print it has become clear that a spool is really required to stop the filament getting tangled and keep an even draw on the extruder. This weekend I used up some of the odd's and end's I had kicking around the workshop to build one.


I used some 1/4" plywood, 3/4" dowel rod, some old bearings, some steel rod and scrap 4x2.
The New Spool



In hindsight the bearings may have been a bad idea, its so friction free that it will freely spin for several minutes after I give it a good heave. I've had to force the stand up close to the bearings to introduce some friction into the system.


Compulsory Action Shot
Unraveling the coil of filament I had and winding it on to the new spool is not a task I'd wish on anyone. There was at least two and half hours of manually untangling the various 'knots' that had formed - it was like the worlds worst telephone cord! Then there was at least 90-minutes of winding it on to the spool. Throw in two failed attempts, multiple curse words and you had a whole Sunday evening of fun. Still the results should give better prints at the end of the day!


Thursday, April 7, 2011

Updating Gen6 Electronics Firmware

This post focuses on how to update the firmware on the Gen6 Mendel electronics.


Install Arduino Tool-Chain:


First you'll need the correct tool chain to be able to compile, link and download the firmware to the Gen6 board. Download and install the Arduino tools from here: Arduino Tools

You'll also need to install the Sanguino add-on from here: Sanguino Tools

Get the Latest Gen6 Firmware:


The latest firmware currently resides here: Gen6 FW

The firmware includes all the source code, so you can make any changes or modifications required. My specific changes are listed below.


Compile the FW Project in the Arduino Tool-Chain:


Run the Arduino tools and 'Open' the project by navigating to the latest firmware directory and opening the file 'FiveD_GCode_Interpreter.pde'.


Once you've made any changes you need, press CTRL+R to compile and verify the code. If you get any compilation errors, fix them now.


Upload the Build to the Hardware:


Once you get a clean build you can upload the code to the board. Power up the Gen6 board and connect the USB. I would also suggest that you open RepSnapper and connect to the printer and just jog the bed before attempting an upgrade, otherwise you'll get a communication failure error from the Arduino tools.


Verify that under the 'Tools->Board' menu you have 'Sanguino' selected. Also under the 'Tools->Serial Port' make sure that you have the correct COM port selected.


Now you can press the 'Upload' button (Right pointing arrow on the tool bar), this will compile the code and then attempt to upload the code to the Gen6 board.


If you get the following error from the Arduino tools: 



Problem uploading to board. See http...
Binary sketch size: 23982 bytes (of a 63488 bytes maximum)
avrdude: stk500_getsync(): not in syinc: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51


Try opening RepSnapper and jogging the bed again before shutting the RepSnapper tools (don't turn the printer off), then try the upload again. 


Once the upload completes you can close the tools and power cycle the hardware.


My Specific Changes:


As I mentioned previously, I have different drive pulleys on my stepper motors. This required that I recalibrate my steps/mm calculation in the firmware.


In 'configuration.h' under the section #ifdef Mendel (around line 163 in FW from Jan-2011) at the end of the pulley descriptions I added this section:



  #ifdef MCMASTER_10XL_PULLEYS
  // define XYZ parameter of McMaster 10-tooth XL-series pulleys
  // Added by JMB - 29-Oct-2010


    #define X_STEPS_PER_MM   31.484 //31.641   
    #define X_STEPS_PER_INCH (X_STEPS_PER_MM*INCHES_TO_MM) // *RO
    #define INVERT_X_DIR 1
    
    #define Y_STEPS_PER_MM   31.599 //31.394
    #define Y_STEPS_PER_INCH (Y_STEPS_PER_MM*INCHES_TO_MM) // *RO
    #define INVERT_Y_DIR 1
    
    #define Z_STEPS_PER_MM   2689.682
    #define Z_STEPS_PER_INCH (Z_STEPS_PER_MM*INCHES_TO_MM) // *RO
    #define INVERT_Z_DIR 0
    #endif

I also added the following line (around line 82) where the configuration is determining which pulleys are being used:

  #define MCMASTER_10XL_PULLEYS

The board should now be configured and programmed with the latest version of firmware, Happy Printing!

Wednesday, April 6, 2011

Leveling the X-axis and the Bed

Tonight's main focus was on leveling the X-axis and the bed to try to correct this continual Z-offset that keeps occurring. Last nights attempt to adjust the Z-flag had helped but it was still occurring.


I started by verifying that the Y-rods were level, which they were. Then I used those as a reference to measure the distance between the X-rods. There was a delta between the two ends of a few tenths of mm. Given that 0.1mm variation in extruder height can make a difference between good first layer adhesion and not, this needed to be corrected.


I loosened the tensioning pulley on the Z-belt and manually adjusted each Z-screw until the reading on the calipers was the same for each Y-rod to front X-rod distance. Then I tightened everything back up making sure that nothing moved. When it was all back together I reverified the measurements to make sure nothing had moved.


I then used a similar technique to set the height of the bed from the Y-rods. This was a loooong process as each adjustment changed the other spring heights slightly. Once they were all the same I could proceed to verify the bed against the extruder nozzle. It was fairly level now, but did require some minor adjustments to bring the separation between the nozzle and bed even in all corners.


I also discovered something interesting with the printed 'W' bed springs. They don't apply even force to the bed. I had them running parallel with the bed, but I found that on the top of the spring was not always flat and applied more pressure either before the bolt or after (depending on how the top was distorted), changing the bed height very slightly. I decided to rotate the springs 90-degrees to be perpendicular to the bed, so their top surface has less contact along the length of the bed. This appears to help these slight bed distortions.


I then was able to get on to some more test prints. I dialed down the flow rate to 1200 (from 1300), the print quality was very good. Possibly one of the best to date. The first layer still had too much flow, so I may need to play with the first layer settings. As the print went on, the higher layers got more ropey, I put that down to how I have my spool of filament. It doesn't turn very easily and after some time printing the force required to pull filament off the spool is too much for the extruder - unless I manually turn the spool a bit. Must get a better spool!


The print continued to pause nearly every layer - just like last night, so I did roll-up my sleeves and dive into the G-Code. Skeinforge appears to be generating the deprecated M108 code (old code to control the extruder). A quick search and replace removed them all and the GCode printed without issues. I need to add M108 to my replace file.


I also updated my Gen6 Firmware to the latest version that came out earlier this year. Tomorrow I'll write a detailed article on how to upgrade the firmware and some of the changes I made (these for my own benefit so I can figure out how to do it again when the next release comes out!)

Tuesday, April 5, 2011

Tweaking Skeinforge Begins Again

Tonight was the first night since the move (and replacing the extruder!) that playing with Skeinforge's settings began again in earnest.


First things first, I wanted to correct this continual negative Z-offset that keeps occurring after a few prints. My current theory is that this is caused by the Z-flag not having a parallel edge causing it to cut the IR beam in minutely different places each time. First task for the evening was to remove the flag and verify if the end was square - it wasn't. A few seconds with a file sorted that out. 


Over the course of the evening the negative Z-offset still occurs, but it is definitely not as significant as it was previously. I think tomorrow I'll work on verifying that the X-rods are still level. They may have got knocked out of kilter during the move.


As I mentioned previously I'll be using the Skeinforge settings from mendel-parts.com as the starting point for my tweaking.


I copied the defaults into the '.skeinforge' directory in the users folder. Just using these settings as is doesn't appear to work very well on my Mendel. The feed rate of 50mm/s and  flow rate of 1400mm/s does not appear provide sufficient  flow, resulting in lots of missing threads on the test pieces and the infill gets very thin in places.


Notching the filament as it travels into the extruder shows that it is moving sporadically during periods when it should be flowing quickly and freely - e.g. around the perimeter of the object. I don't think my sprung pinch-wheel is the problem as it appears to flow freely when I run the extruder from RepSnapper. I think that the flow rate is too high for my melt zone. 


I think that the filament is being fed in too quickly for the hot end to melt it fast enough to keep a constant flow. My first tweak is then to slow down the feed rate from 50mm/s through 40mm/s to 30mm/s. This appears to give fairly consistent filament feed now. However, the extruded filament is clearly two thick in places. So I'll need to play with the flow rate and bring that down to get everything back in balance.


A quick test with the flow rate at 1300 (from 1400) gives reasonable results, but I've had better, so more tweaking needed there. Also, it appears to generate GCode that causes RepSnapper to hang once per layer and need to be kicked. Not sure why that one change should cause that, but if it keeps doing it I'll roll up my sleeves and start digging in the GCode.



Saturday, April 2, 2011

New Workshop is Up and Running - I'm Back in Business!

It's been a few months since my last post due to the house move. But I can now say that the move is complete, the 'Honey-Do' list is all done - at least all the niggly things for now - and the new workshop is organised and up and running. I can now get back to tweaking my Mendel.


The nice thing about the new house is that one of the garage bays had already been converted to a workshop with benches, pegboard and storage - which saved me some effort.


As you can see, still have to find a home for the drill press, at the moment it's living beneath one of the benches.


There's plenty of lighting and plenty of storage and work-surfaces.



Still need to find a home for my son's bikes, but at least they are fairly mobile!


Today's first Mendel task was to change the blue painters tape, re-level the bed and test the extruder still worked.


Since I last had a chance to play with my Mendel, Camiel at mendel-parts has switched to using Skeinforge as his G-Code generator. He's having some good success and has posted his settings in the downloads section on his website. I thought I'd use his values as my starting point going forward, since my Mendel is very similar to his build Mendel's.


I only had to time to run a quick test cube. The first layer went down well, although I'm still having problems with my Z-Axis zero setting getting lower with time - need to look at that when I get the chance, probably something better can be done with the flag. However, above layer five, it started to break-down. Not sure if the feed setting isn't high enough, or if the extruder is skipping or something else. 


I didn't get a chance to play more today and investigate. Now the workshop is up and running I'll be able to tinker around with it in the evenings and get things dialed in. Look for more updates shortly.